Printing shortest decimal form of floating point number with Mir

Guillaume Piolat first.last at gmail.com
Wed Jan 6 12:12:31 UTC 2021


On Wednesday, 6 January 2021 at 02:27:25 UTC, Walter Bright wrote:
> On 1/5/2021 5:30 AM, Guillaume Piolat wrote:
>> It would be nice if no excess precision was ever used. It can 
>> sometimes gives a false sense of correctness. It has no upside 
>> except accidental correctness that can break when compiled for 
>> a different platform.
>
> That same argument could be use to always use float instead of 
> double. I hope you see it's fallacious <g>

If I use float, and the compiler use real instead, it might mask 
precision problems that will be seen when using SSE instead of 
FPU.

Happened to me once 21 oct 2015 according to my log.
2-pole IIR filters had a different sound in 32-bit and 64-bit 
Windows with DMD.
The biquad delayline was float and should have been double. But 
the 32-bit DMD was using real for intermediate values, masking 
the fact I should have been using double. Going double lowered 
that quantization noise.

It's really not a problem anymore since using LDC that uses SSE 
in 32-bit too. So the benefits of accidental precision haven't 
really materialized.

I understand that the issue really is minor nowadays.


More information about the Digitalmars-d-announce mailing list