-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use the MAX constants from <float.h>? #26
Comments
(maybe not relevant to this issue) could you please provide your compiler version? *** at *** in ~/t/cJSON> clang -c cJSON.c -Wall -Woverflow
*** at *** in ~/t/cJSON> ls
CMakeLists.txt Makefile README.md cJSON.h cJSON_Utils.c test.c tests
LICENSE README cJSON.c cJSON.o cJSON_Utils.h test_utils.c
*** at *** in ~/t/cJSON> my compiler version: *** at *** in ~/t/cJSON> clang -v
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin |
sure, XC32 (v1.42) http://www.microchip.com/xc32, its for embedded systems |
Out of interest, what IS your DBL_MAX? |
|
Ok, so, you have a non IEEE754-compliant floating point implementation. |
Here it is suggested to use a |
yes it does, good catch |
This is not a great change for the master branch. 1e60L is, as you say, a long double, the comparison against which requires a lot of legwork on the FPU (specifically an upcast to long double of the other value). This change worsens performance for JSON print for everyone, whilst fixing a bug for one platform with a non IEEE754 compliant floating point implementation. |
I reverted the commit. This should be easy enough to fix by hand if needed. |
compiler warns with
cJSON.c:170:4: warning: floating constant exceeds range of 'double' [-Woverflow]
i think it might be better to use the constants defined in
<float.h>
throughout the code, likeDBL_MAX
, etc...The text was updated successfully, but these errors were encountered: