Frits van Bommel fvbommel at
Wed Mar 19 15:19:07 PDT 2008

Spacen Jasset wrote:
>  From the documentation:
> real modf(real x, ref real y);
> why is y a ref parameter?

Apparently it doesn't do what it says it does. The implementation simply 
calls std.c.math.modfl(x, &y), which is documented at 

Apparently, std.math.modf(x,y), which is documented to return the 
remainder of (x / y), actually returns the fractional part of x, storing 
the integral part in y (so it never even *reads* y).

Now, I can't remember ever using anything in std.math that takes > 1 
parameter (mostly abs, sqrt, etc.) and haven't even executed modf(), but 
this seems to be a bug in either the documentation or the implementation 
of this function.
Cross-posted to d.D.bugs & follow-up set.

More information about the Digitalmars-d-learn mailing list