<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:41:15 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-1979] Math.Round doesn&apos;t work anymore with MongoDB</title>
                <link>https://jira.mongodb.org/browse/CSHARP-1979</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;The following fix broke an important feature of rounding Double to a few digits.&lt;/p&gt;

&lt;p&gt;Commit : d918bb829beafa619db061394ce183f00619b880&lt;br/&gt;
Issue :  &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1731&quot; title=&quot;JsonWriter.WriteDouble serialize value is invaild  on x64&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1731&quot;&gt;&lt;del&gt;CSHARP-1731&lt;/del&gt;&lt;/a&gt;: Use &quot;G17&quot; instead of &quot;R&quot; when converting Double to Strin...&lt;/p&gt;

&lt;p&gt;The standard C# Double.ToString() method serializes 15 digits instead of 17 and this is on purpose. It allows approximation to look like an exact number. For instance, 7.33 is stored as &lt;br/&gt;
7.3300000000000001. Using G17 instead of R prohibit using Math.Round to output a JSON document that contains &quot;7.33&quot;. &lt;/p&gt;

&lt;p&gt;Sample Code:&lt;br/&gt;
            Double d1 = 7.33333333333;&lt;br/&gt;
            Double d2 = Math.Round(d1, 2);&lt;br/&gt;
            BsonValue v2 = d2;&lt;br/&gt;
            String s2 = v2.ToString();&lt;/p&gt;

&lt;p&gt;The main problem for me is when I consume the JSON document in JavaScript with Meteor on the website. I need again to round in JavaScript. Would that be possible to at least provide an option or another class like BsonDoubleR that would allow to control the desired behavior. That was working before I upgraded the driver for MongoDB 3.4 support.&lt;/p&gt;</description>
                <environment>x64</environment>
        <key id="381739">CSHARP-1979</key>
            <summary>Math.Round doesn&apos;t work anymore with MongoDB</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="luc@bekno.com">Luc Begnoche</reporter>
                        <labels>
                            <label>Bug</label>
                    </labels>
                <created>Sun, 7 May 2017 19:10:54 +0000</created>
                <updated>Fri, 27 Oct 2023 13:25:08 +0000</updated>
                            <resolved>Tue, 16 May 2017 18:57:55 +0000</resolved>
                                    <version>2.4.3</version>
                                                    <component>Serialization</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1572620" author="rstam" created="Tue, 16 May 2017 18:57:55 +0000"  >&lt;p&gt;Closing this ticket because the desired behavior can eventually be accomplished using the changes implemented in &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1858&quot; title=&quot;Add user configurable output converters to JsonWriter&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1858&quot;&gt;&lt;del&gt;CSHARP-1858&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="1572616" author="rstam" created="Tue, 16 May 2017 18:56:49 +0000"  >&lt;p&gt;This isn&apos;t really related to Math.Round, which simply maps one double value to another double value.&lt;/p&gt;

&lt;p&gt;It is related to how double values are serialized to JSON. &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1731&quot; title=&quot;JsonWriter.WriteDouble serialize value is invaild  on x64&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1731&quot;&gt;&lt;del&gt;CSHARP-1731&lt;/del&gt;&lt;/a&gt; was implemented because in most cases it is more important to preserve precision. Users rarely want to lose precision!&lt;/p&gt;

&lt;p&gt;When &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1858&quot; title=&quot;Add user configurable output converters to JsonWriter&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1858&quot;&gt;&lt;del&gt;CSHARP-1858&lt;/del&gt;&lt;/a&gt; is implemented (probably in version 2.5) you will be able to register your own DoubleJsonConverter that can use whatever output precision you want to have.&lt;/p&gt;</comment>
                            <comment id="1567589" author="luc@bekno.com" created="Tue, 9 May 2017 09:35:38 +0000"  >&lt;p&gt;Using MongoDB C# Driver 2.4.3 with a MongoDB 3.0 server fixes the problem temporarily. Somehow the value is stored in MongoDB server correctly, looking like 7.33 instead of 7.3300000000000001&lt;/p&gt;

&lt;p&gt;I&apos;ll update again when I upgrade the MongoDB server to 3.4&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="335885">CSHARP-1858</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hszb8v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>