digitalmars.D.bugs - float -> ulong conversion bug
- Nick (17/17) Aug 06 2004 In a nutshell:
- Walter (1/1) Aug 09 2004 It works when I try it. -Walter
- Nick (4/5) Aug 10 2004 Hmm, that's strange, because it still doesn't work for me. I'm using dmd...
- Ben Hinkle (2/11) Aug 10 2004 I'm on linux, too, and it reproduces for me.
- Walter (1/1) Aug 10 2004 Ah, on linux. I'll check it out.
- Russ Lewis (5/45) Jan 18 2005 I am on Linux (Fedora Core 1, DMD 0.110), and have found this problem
In a nutshell: Output: 12 12 12 0 And I was wondering why the square root of every number was zero ;-) Nick
Aug 06 2004
In article <cf8hie$t9e$1 digitaldaemon.com>, Walter says...It works when I try it. -WalterHmm, that's strange, because it still doesn't work for me. I'm using dmd 0.98 on linux. Can anyone else comfirm? Nick
Aug 10 2004
Nick wrote:In article <cf8hie$t9e$1 digitaldaemon.com>, Walter says...I'm on linux, too, and it reproduces for me.It works when I try it. -WalterHmm, that's strange, because it still doesn't work for me. I'm using dmd 0.98 on linux. Can anyone else comfirm? Nick
Aug 10 2004
Walter wrote:Ah, on linux. I'll check it out.I am on Linux (Fedora Core 1, DMD 0.110), and have found this problem with casting float->ulong, double->ulong, and real->ulong. It works when converting to long, however.import std.stdio; void main() { double d = 1.0; writefln("double: ",d); writefln("double->float: ", cast(float)d); writefln("double->real: ", cast(real)d); writefln("double->ulong: ", cast(ulong)d); writefln("double->long: ", cast(long)d); float f = 2.0; writefln("float: ",f); writefln("float->double: ", cast(double)f); writefln("float->real: ", cast(real)f); writefln("float->ulong: ", cast(ulong)f); writefln("float->long: ", cast(long)f); real r = 3.0; writefln("real: ",r); writefln("real->float: ", cast(float)r); writefln("real->double: ", cast(double)r); writefln("real->ulong: ", cast(ulong)r); writefln("real->long: ", cast(long)r); }This currently prints:double: 1 double->float: 1 double->real: 1 double->ulong: 0 double->long: 1 float: 2 float->double: 2 float->real: 2 float->ulong: 0 float->long: 2 real: 3 real->float: 3 real->double: 3 real->ulong: 0 real->long: 3
Jan 18 2005