[Issue 8476] float comparison operand not truncated from real

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 31 02:13:01 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8476



--- Comment #6 from bearophile_hugs at eml.cc 2012-07-31 02:12:51 PDT ---
(In reply to comment #5)

> D made the decision early on that:
> 
>     more precision == better
> 
> and that any program that relied on results being less accurate was a faulty
> program.

You are right, of course, and such problems are common:
http://www.parashift.com/c++-faq-lite/floating-point-arith2.html

On the other hand I remember one of my D programs not being as efficient as a
very similar C++ program just because the C++ code used float-based operations
instead of double-based ones, despite me typing float every FP variable and
tagging with "f" every floating point literal. In some cases std.math return a
double even if all it's required is a float, and the useless computation of the
extra precision slows down the code compared to the C++ code that uses
functions that return only a float precision. I presume the float versions of
some functions perform less iterations to compute the smaller number of
precision digits, and this makes them faster. And in some way std.math was
unable to let me use the faster float version.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list