-Fixed parsing large floating point numbers

This commit is contained in:
James Newton-King
2013-07-01 19:55:02 +12:00
parent 2e6760ca87
commit e49d8e8b02
4 changed files with 48 additions and 4 deletions
@@ -1260,6 +1260,9 @@ bye", reader.Value);
reader = new JsonTextReader(new StringReader(long.MaxValue.ToString()));
ExceptionAssert.Throws<OverflowException>("Arithmetic operation resulted in an overflow.", () => reader.ReadAsInt32());
reader = new JsonTextReader(new StringReader("9999999999999999999999999999999999999999999999999999999999999999999999999999asdasdasd"));
ExceptionAssert.Throws<FormatException>("Input string was not in a correct format.", () => reader.ReadAsInt32());
reader = new JsonTextReader(new StringReader("1E-06"));
ExceptionAssert.Throws<FormatException>("Input string was not in a correct format.", () => reader.ReadAsInt32());
@@ -446,6 +446,16 @@ namespace Newtonsoft.Json.Tests.Serialization
}
#endif
[Test]
public void DeserializeLargeFloat()
{
object o = JsonConvert.DeserializeObject("100000000000000000000000000000000000000.0");
CustomAssert.IsInstanceOfType(typeof(double), o);
Assert.IsTrue(MathUtils.ApproxEquals(1E+38, (double)o));
}
[Test]
public void SerializeDeserializeRegex()
{