[Mono-bugs] [Bug 478438] New: Storing float32 doesn't imply precision loss

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Feb 21 03:39:26 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=478438


           Summary: Storing float32 doesn't imply precision loss
    Classification: Mono
           Product: Mono: Runtime
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: kornelpal at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Also see http://lists.ximian.com/pipermail/mono-list/2009-February/041358.html

The following two code snippets have different results on MS.NET but have the
same on Mono:

float f1=200;
float f2=162.980057f;
float f3 = (1 - (f2 / f1));
float f4 = f3*f3;
Console.WriteLine(f4.ToString("R", CultureInfo.InvariantCulture));

float f1=200;
float f2=162.980057f;
float f3 = (float)(1 - (f2 / f1));
float f4 = f3*f3;
Console.WriteLine(f4.ToString("R", CultureInfo.InvariantCulture));

Note that ECMA specs explicitly permit to avoid inplicit conversion when
storing and subsequently loading floating point values for later use. The
second code snippet on the other hand is using an explicit conversion that has
to be preserved.

While this is not required we could gain performance as well as provide MS.NET
compatibility.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list