Decimal Point Deserialization error
nmaarse opened this issue · 1 comments
nmaarse commented
I ran into a very weird situation that a specific number results in a decimal point error.
The following test results in an assertion error for value "56.27332073976768".
Message:
Expected pressureResult to be 56.27332073976768, but found 5627332073976768.0.
The other values work fine.
I'm using FluentAssertions and Xunit together with Utf8Json version 1.3.7
[Theory]
[InlineData(56.27332073976767)]
[InlineData(56.27332073976768)]
[InlineData(56.27332073976769)]
public void UnexpectedDecimalPointError(double value)
{
var pressureJson = Utf8Json.JsonSerializer.ToJsonString(value);
double pressureResult = Utf8Json.JsonSerializer.Deserialize<double>(pressureJson);
pressureResult.Should().Be(value);
}
tomsoftware commented
I think you are not using an "English environment" ? see fix #247