Permalink
Browse files

Fix a bug when serializing numbers. Somehow the % got dropped from th…

…e .17g floating point format specifier.
  • Loading branch information...
1 parent 83c6e4f commit 607e7d6b0cac6b2c925960fa6b3b444fa64caefc @johnezang committed Mar 31, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 JSONKit.m
View
@@ -2884,7 +2884,7 @@ static int jk_encode_add_atom_to_buffer(JKEncodeState *encodeState, void *object
double dv;
if(JK_EXPECT_T(CFNumberGetValue((CFNumberRef)object, kCFNumberDoubleType, &dv))) {
if(JK_EXPECT_F(!isfinite(dv))) { jk_encode_error(encodeState, @"Floating point values must be finite. JSON does not support NaN or Infinity."); return(1); }
- return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, ((encodeState->serializeOptionFlags & JKSerializeOptionExtendedFloatingPoint) == 0) ? ".17g" : "%a", dv));
+ return(jk_encode_printf(encodeState, cacheSlot, startingAtIndex, encodeCacheObject, ((encodeState->serializeOptionFlags & JKSerializeOptionExtendedFloatingPoint) == 0) ? "%.17g" : "%a", dv));
} else { jk_encode_error(encodeState, @"Unable to get floating point value from number object."); return(1); }
}
break;

0 comments on commit 607e7d6

Please sign in to comment.