Always false float comparisons

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 09:30:45 PDT 2016


On Wednesday, 18 May 2016 at 15:42:56 UTC, Joakim wrote:
> I see, so the fact that both the C++ and D specs say the same 
> thing doesn't matter, and the fact that D also has the const 
> float in your example as single-precision at runtime, contrary 
> to your claims, none of that matters.

D doesn't even have a spec, so how can they possibly say the same 
thing?

However, quoting the Wikipedia page on IEEE floats:

«The IEEE 754-1985 allowed many variations in implementations 
(such as the encoding of some values and the detection of certain 
exceptions). IEEE 754-2008 has strengthened up many of these, but 
a few variations still remain (especially for binary formats). 
The reproducibility clause recommends that language standards 
should provide a means to write reproducible programs (i.e., 
programs that will produce the same result in all implementations 
of a language), and describes what needs to be done to achieve 
reproducible results.»

That's the map people who care about floating point follow.


> No sane DSP programmer would write that like you did.

What kind of insult is that?  I've read lots of DSP code written 
by others.  I know what kind of programming it entails.

In fact, what I have described here are techniques picked up from 
state-of-the-art DSP code written by top-the-of-line DSP 
programmers.


> Since the vast majority of tests will never use such 
> compile-test constants, your opinion is not only wrong but 
> irrelevant.

Oh... Not only am I wrong, but my opinion is irrelevant. Well, 
with this attitude D will remain irrelevant as well.

For good reasons.


> Then don't use differently defined constants in different places

I don't, and I didn't. DMD did it.



More information about the Digitalmars-d mailing list