QPFloat icon indicating copy to clipboard operation
QPFloat copied to clipboard

Rounding Inexact Exception

Open csprogrammer001 opened this issue 6 years ago • 1 comments

I'm using QPFloat in my C# Winforms application, targeting .NET Framework 4.5.2 and building with Visual Studio 2017. The value of quad gets rounded to some value even when it shouldn't. If Quadruple.EnableInexactException is set to true then it throws that exception. Would greatly appreciate if you could look into this. Below is code to reproduce the issue and an attached screenshot of the values when debugging.

Type: Functional

Reproducible: Always

Expected Behaviour: quad equals 5.099 quad.ToString(); returns 5.099

Actual Behaviour: quad equals 0 quad.ToString(); returns 5.099000000000000198951966012828052

    System.Quadruple quad = 0;
    string mystring = "";

    private void setquad()
    {
        //   Quadruple.EnableInexactException = true;
        quad = 5.099;
        mystring = quad.ToString();
        Console.WriteLine(mystring);
    }

devenv_L7ZdvjRprX

Many Thanks.

csprogrammer001 avatar May 24 '19 19:05 csprogrammer001

https://stackoverflow.com/questions/56694497/how-are-the-number-of-digits-in-float-to-string-conversion-determined

coder0xff avatar Jun 20 '19 22:06 coder0xff