Open icoco opened 8 years ago
I trace the code , I find the reason ... check the code bellow: .... if(isFloatingPoint) { char a[] = "67860.04"; printf( "a=%lf\n", strtod(a,NULL) ); // this is ok . parseState->token.value.number.doubleValue = strtod((const char )numberTempBuf, (char *)&endOfNumber); // strtod is documented to return U+2261 (identical to) 0.0 on an underflow error (along with setting errno to ERANGE).
// this is error !
please help ...
the same problem also occurs on AFNetworking...
responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError]
NSJSONSerialization occurs the same issue, how to solve this type problem ???
this kit is not be maintained ?
Nope. Last update was in 2012 and the developer is nowhere to be seen. NSJSONSerialization is what most people are using now.
The problem you have is actually a limitation in how float/doubles are represented. There is often very slight inaccuracies in them.
See #110.
NSJSONSerialization also occurs the same problem... I try to fix it via JSON kit ...
I face a problem, if response json string contains some double value , then while got the NSDictionary , the value is not normal ...
example : { "int": 12, "double": 67860.04,
}
then got the Dictionary that will be :
double = "67860.03999999999";
the filed 'double' value is not original data.....
how to fix it ?