Question/request/bug(?) re. floating-point in dmd

Walter Bright newshound2 at digitalmars.com
Wed Oct 23 09:50:56 PDT 2013


On 10/23/2013 9:22 AM, David Nadlinger wrote:
> On Wednesday, 23 October 2013 at 16:15:56 UTC, Walter Bright wrote:
>> A D compiler is allowed to compute floating point results at arbitrarily large
>> precision - the storage size (float, double, real) only specify the minimum
>> precision.
>>
>> This behavior is fairly deeply embedded into the front end, optimizer, and
>> various back ends.
>
> I know we've had this topic before, but just for the record, I'm still not sold
> on the idea of allowing CTFE to yield different results than runtime execution.

Java initially tried to enforce a maximum precision, and it was a major disaster 
for them. If I have been unable to convince you, I suggest reviewing that case 
history.

Back when I designed and built digital electronics boards, it was beaten into my 
skull that chips always get faster, never slower, and the slower parts routinely 
became unavailable. This means that the circuits got designed with maximum 
propagation delays in mind, and with a minimum delay of 0. Then, when they work 
with a slow part, they'll still work if you swap in a faster one.

FP precision is the same concept. Swap in more precision, and your correctly 
designed algorithm will still work.



More information about the Digitalmars-d mailing list