[CSHARP-1731] JsonWriter.WriteDouble serialize value is invaild on x64 Created: 01/Aug/16  Updated: 19/Oct/16  Resolved: 19/Oct/16

Status: Closed
Project: C# Driver
Component/s: BSON
Affects Version/s: 2.2.4
Fix Version/s: 2.4

Type: Bug Priority: Minor - P4
Reporter: Shrimpz [X] Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: Bug, Portable
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

x64, vs2015 update1-3



 Description   

In "MongoDB.Bson\IO\JsonWriter.cs", line 220

var stringRepresentation = value.ToString("R", NumberFormatInfo.InvariantInfo);

need replace to
var stringRepresentation = value.ToString("G17", NumberFormatInfo.InvariantInfo);

???

In some cases, Double values formatted with the "R" standard numeric format string do not successfully round-trip if compiled using the /platform:x64 or /platform:anycpu switches and run on 64-bit systems.

https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx#RFormatString



 Comments   
Comment by Githook User [ 19/Oct/16 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1731: Use "G17" instead of "R" when converting Double to String for improved accuracy.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/d918bb829beafa619db061394ce183f00619b880

Generated at Wed Feb 07 21:40:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.