Thread overview | |||||
---|---|---|---|---|---|
|
February 11, 2004 floating point bug | ||||
---|---|---|---|---|
| ||||
the following code does not run as expected, it should print out "-1" twice, but it prints out -1 followed by 0. Its probably a bug with toString import std.c.stdio; import std.string; void test(float f) { printf("%f\n", f); printf("%s\n", toStringz(toString(f))); } void main() { test(-1); } |
February 11, 2004 Re: floating point bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | doesn't toString only take an uint (and thus casts it?) could be manfred hit a much bigger issue. namely floating point conversions in general. dunno.. it's late again:D "imr1984" <imr1984_member@pathlink.com> schrieb im Newsbeitrag news:c0e19a$j8u$1@digitaldaemon.com... > the following code does not run as expected, it should print out "-1" twice, but > it prints out -1 followed by 0. Its probably a bug with toString > > > > import std.c.stdio; > import std.string; > > void test(float f) > { > printf("%f\n", f); > printf("%s\n", toStringz(toString(f))); > } > > void main() > { > test(-1); > } > > |
February 11, 2004 Re: floating point bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to davepermen | davepermen wrote:
>
> doesn't toString only take an uint (and thus casts it?)
>
> could be manfred hit a much bigger issue. namely floating point conversions
> in general.
AFAIK there are no floating point conversions in Phobos yet, unless you count streams. I assume they're on the to-do list.
Sean
|
Copyright © 1999-2021 by the D Language Foundation