www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - return value of std.math.ldexp is illegal.

Hi.

If number literals are passed by the discussion about std.math.ldexp,
the return value seems to become abnormal.
Is it because ldexp is a built-in function ?


source code
-----
import std.math;
import std.stdio;

int main(char[][] argv)
{
// If you pass number literals.
writefln("%f", ldexp(3.0, 3));
writefln("%f", ldexp(cast(real) 3.0, cast(int) 3));
writef("\n");

// If you pass the variable.
real n = 3.0;
int exp = 3;
writefln("%f", ldexp(n, exp));
return 0;
}
----
result

3.000000
3.000000

24.000000
----

This bug was written in Japanese D language Wiki by the Karasu (crow). 
http://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F15

thanks, Hiroshi Sakurai
Jun 05 2005