Always false float comparisons
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 16 05:00:39 PDT 2016
On 5/16/2016 3:26 AM, Joseph Rushton Wakeling wrote:
> If I've understood people's arguments right, the point of concern is that there
> are use cases where the programmer wants to be able to guarantee _a specific
> precision of their choice_.
>
> That strikes me as a legitimate use-case that it would be worth trying to support.
Yes, and I've proposed roundToFloat() and roundToDouble() intrinsics in this
thread and the last two or three times this came up.
I also strongly feel that use of those intrinsics is a red flag that there's a
problem with the algorithm. At least the use of them will make it obvious in the
code that there's a bug :-) in the algorithm.
Floats are chosen for speed and storage. Insisting that lower accuracy is
desired as a default consequence just baffles me. It's like saying people choose
sugary snacks because they want dental cavities.
More information about the Digitalmars-d
mailing list