Always false float comparisons

Max Samukha via Digitalmars-d digitalmars-d at puremagic.com
Fri May 20 23:44:40 PDT 2016


On Friday, 20 May 2016 at 06:12:44 UTC, Walter Bright wrote:

>> If you say so. I would like to see an example that 
>> demonstrates that the first
>> roundToDouble is required.
>
> That's beside the point. If there are spots in the program that 
> require rounding, what is wrong with having to specify it?

Because the programmer has already specified it with a type that 
requires rounding!

> Why compromise speed & accuracy in the rest of the code that 
> does not require it? (And yes, rounding in certain spots can 
> and does compromise both speed and accuracy.)
>

Accuracy and speed won't be compromised if the programmer chooses 
an appropriate type - 'real' for the highest precision supported 
by the implementation.

BTW, you need to remove 'hardware' from the definition of 'real' 
in the spec.


More information about the Digitalmars-d mailing list