std.math.modf
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
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?
>
> http://www.digitalmars.com/d/1.0/phobos/std_math.html
Apparently it doesn't do what it says it does. The implementation simply
calls std.c.math.modfl(x, &y), which is documented at
<http://www.opengroup.org/onlinepubs/000095399/functions/modf.html>.
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