[Issue 4765] New: std.math.modf always returns 0

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 29 19:31:27 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4765

           Summary: std.math.modf always returns 0
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: etherous at gmail.com


--- Comment #0 from Brandon Lyon <etherous at gmail.com> 2010-08-29 19:31:16 PDT ---
The following code should output "3" but instead outputs "0". This is because,
regardless of the values sent to std.math.modf, the returned value is always 0.
I've used many combinations of values, but the result is always the same: 0. At
first I believed I was misusing the function and I noticed that the second
parameter was taken as a ref, so I performed the function call and checked 'b',
but it always stored the beginning value unchanged.

import std.stdio;
import std.math;

void main ()
{
    real a = 9.,
         b = 5.;
    writeln(modf(a,b));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list