Comments (8)
I can't reproduce the issue. The results are "i" respectively "1e-9" as
expected. What kind of error message do you get? The only possible explanation
i have is that muparserx might be used in non complex mode. Please verify this
with the reference implementation provided in example.cpp.
Original comment by [email protected]
on 1 Jun 2014 at 7:22
from muparserx.
The following is the result of executing example.cpp. There are many errors
concerning the expressions, "value i" and "value n". I made the executable by
using Makefile (by the way, in Make file, one source file
(mpParserMessageProvider.cpp) is missing.). I could not figure out the origin
of the issue.
The compiler I used is
$ clang++ -v
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
on Mac OSX 10.9.3
Thanks for checking the issue.
-------------------------------------------------------------------------
__________ ____ ___
_____ __ _\______ \_____ _______ ______ __________\ \/ /
/ \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ /
| Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \
|__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \
\/ \/ \/ \/ \_/
Version 3.0.2 (20140601; development snapshot)
Copyright (C) 2014 Ingo Berg
-------------------------------------------------------------------------
Build configuration:
- RELEASE build
- ASCII build
- compiled with GCC Version 4.2.1
- IEEE 754 (IEC 559) is available
- 64 bit
- Floating point type is "d" (15 Digits)
-------------------------------------------------------------------------
Running test suite:
testing parser value types...passed
testing implicit definition of undefined variables...passed
testing error codes...
Expression: "(1+3i)/(8*9i)+"hallo"" Code:1 Expected:44
Expression: "(1+3i)/(8*9i)-"hallo"" Code:1 Expected:44
Expression: "(1+3i)/(8*9i)*"hallo"" Code:1 Expected:44
Expression: "(1+3i)/(8*9i)/"hallo"" Code:1 Expected:44
Expression: "3n[1]" Code:1 Expected:40
failed with 5 errors
testing sample equations...
Expression failed: "1e1234" (no exception raised).
Expression failed: "-1e1234" (no exception raised).
failed with 2 errors
testing if-else conditional...passed
testing string functions...passed
testing matrix calculations...passed
testing complex calculations...
1i : Undefined token "1i" found at position 0.
norm(3+4i) : Undefined token "4i" found at position 7.
norm(4i+3) : Undefined token "4i" found at position 5.
norm(3i+4) : Undefined token "3i" found at position 5.
real(4.1i+3.1) : Undefined token "4" found at position 5.
imag(3.1i+4.1) : Undefined token "3" found at position 5.
imag(2.1i) : Undefined token "2" found at position 5.
-(4i+5) : Undefined token "4i" found at position 2.
a=1+2i : Undefined token "2i" found at position 4.
-(1+2i) : Undefined token "2i" found at position 4.
-(-1-2i) : Undefined token "2i" found at position 5.
(2+4i)*(8-6i) : Undefined token "4i" found at position 3.
(-1+5i)^2 : Undefined token "5i" found at position 4.
c=(a=1+2i) : Undefined token "2i" found at position 7.
failed with 14 errors
testing vector operations...passed
testing binary operators...passed
testing postfix operators...
1n : Undefined token "1n" found at position 0.
8n : Undefined token "8n" found at position 0.
8n : Undefined token "8n" found at position 0.
failed with 3 errors
testing infix operators...passed
testing multiarg functions...passed
testing script features...passed
testing value reader...passed
Test failed with 24 errors (556 expressions)
-------------------------------------------------------------------------
Special parser functions:
list_var() - list parser variables and return the number of variables.
list_fun() - list parser functions and return the number of functions
list_const() - list all numeric parser constants
Command line commands:
exprvar - list all variables found in the last expression
rpn - Dump reverse polish notation of the current expression
quit - exits the parser
Constants:
"e" 2.718281828459045235360287
"pi" 3.141592653589793238462643
-------------------------------------------------------------------------
muparserx>
Original comment by [email protected]
on 1 Jun 2014 at 10:53
from muparserx.
I'm confused. It should definetively not look like this. The code runs fine
with GCC and VCC so i guess this is a LLVM specific issue. I'll see whether i
can get LLVM running on my system. But something seems odd: The code identifies
the compiler as GCC 4.2.1 which would be a very old version. So old it
shouldn't even compile the code. Is this a switch in LLVM? Which compiler was
actually used LLVM or GCC?
Original comment by [email protected]
on 2 Jun 2014 at 11:04
from muparserx.
I don't understand what happens actually. Although Apple provides more or less
older version of gcc because of the license issue, I have never encountered any
problems with various open software compiled by at least the latest version
provided officially by the latest version of Mac OSX. This problem occurs even
with the older version of muparserx 2.2.3 with g++ and clang++.
Original comment by [email protected]
on 2 Jun 2014 at 2:43
from muparserx.
I'm able to compile and run it with clang (3.2.0) on linux without issues. I
suspect reading numbers from a stream works different on a mac. My guess is
that DblValReader::IsValue / Line 66: stream >> fVal is failing on a mac if a
string like "2i" is found. On Linux/Windows the two is parsed then parsing
stops. On a Mac nothing seems to be parsed for whatever reason. I have no
explanation since gcc/lvwm should work identically on all systems.
Can you compile and run the following sample for me? It is supposed to output
2. If it does not something is wrong.
#include <sstream>
#include <iostream>
int main(int argc, const char **args)
{
double val;
std::stringstream("2i") >> val;
std::cout << "Parsing result:" << val << std::endl;
return 0;
}
Original comment by [email protected]
on 2 Jun 2014 at 10:04
from muparserx.
I compiled the following code, and got the output:
Parsing result:0
error ? 1
So as you expected, a Mac parses "2i" in a different way. But, I guess the
assumed behavior for "2i" using stringstream is not strictly specified by the
standard c++, even though Linux/Windows work in the same way.
//////////////////
#include <sstream>
#include <iostream>
int main(int argc, const char **args)
{
double val;
std::stringstream ss("2i");
ss >> val;
std::cout << "Parsing result:" << val << std::endl;
std::cout << "error ? " << ss.fail() << std::endl;
return 0;
}
Original comment by [email protected]
on 2 Jun 2014 at 11:03
from muparserx.
Thanks for helping me out here. This is also an issue for muparser that was
unexpainable for me until now. I will fix it.
Details:
I think this is a bug although IMHO not in my code. The parsing is effectively
done by strtod/strtold and should terminate when an invalid character is found
(see http://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt,
http://en.cppreference.com/w/cpp/locale/num_get/get and finally
http://en.cppreference.com/w/cpp/string/byte/strtof). The portion of the string
that is valid should be parsed, the rest not. This is not happening on a Mac
since the entire string is rejected.
Original comment by [email protected]
on 3 Jun 2014 at 9:29
- Changed state: Accepted
- Added labels: OpSys-OSX
from muparserx.
I decided to pass on this issue. Since it is seemingly a known bug in the
libc++ shipped with MacOS X. (More details:
http://llvm.org/bugs/show_bug.cgi?id=17782)
Fixing this would require an unreasonable ammount of my time just for working
around a problem someone else is causing. This is a failure in a very basic
part of the standard library.
Original comment by [email protected]
on 6 Jun 2014 at 3:33
- Changed state: WontFix
- Added labels: Priority-Low
- Removed labels: Priority-Medium
from muparserx.
Related Issues (20)
- Missing header HOT 1
- README says that the version is 4.0.9 but the last tag is 4.0.8 HOT 2
- how to switch rad or gra when use trigonometric function HOT 2
- Incorrect Assignment Multiplication HOT 1
- Inconsistent Use of Signedness for Binary and Hex Numbers
- Feature Request: Add an Octal Value Reader
- logic operator lack shor-circuit feature
- 4.0.10 FTBFS HOT 1
- constant starting with letter 'o' HOT 5
- Example fails on macOS HOT 7
- int to bool conversion HOT 3
- type checking HOT 1
- xor is listed in the documentation but not implemented HOT 3
- Is it possible to directly represent a matrix instead of using many lines to define it? HOT 4
- FunTan and FunSin error HOT 2
- Is matrix algebra in SetExpr possible? HOT 2
- fail at parsing boolean linear operation HOT 2
- [4.0.12] SEGFAULT in mupTokenReader
- Example couldn't be built on MINGW windows
- how to create a Loop Expression ? please a demo HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muparserx.