Skip to content

Commit

Permalink
Retain the sign when parsing -0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stig committed Sep 26, 2012
1 parent d863525 commit 7f4edf4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Classes/SBJsonTokeniser.m
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ - (sbjson_token_t)getNumberToken:(NSObject**)token {
if (!isFloat && !hasExponent) {
*token = [NSNumber numberWithLongLong: isNegative ? -mantissa : mantissa];
} else if (mantissa == 0) {
*token = [NSNumber numberWithInt:0];
*token = [NSNumber numberWithFloat:-0.0f];
} else {
*token = [NSDecimalNumber decimalNumberWithMantissa:mantissa
exponent:exponent
Expand Down
2 changes: 1 addition & 1 deletion Tests/Data/valid/number/float/output
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[0.0001,2.5,4.4,99.99,720.17300000000000182,0]
[0.0001,2.5,4.4,99.99,720.17300000000000182,-0]

0 comments on commit 7f4edf4

Please sign in to comment.