Always false float comparisons

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 12 10:14:11 PDT 2016


On 5/12/16 12:00 PM, Walter Bright wrote:
> On 5/12/2016 6:03 AM, Steven Schveighoffer wrote:
>> Not taking one side or another on this, but due to D doing everything
>> with
>> reals, this is already the case.
>
> Actually, C allows that behavior if I understood the spec correctly. D
> just makes things more explicit.

This is the thread I was thinking about: 
https://forum.dlang.org/post/ugxmeiqsbitxxzoyakko@forum.dlang.org

Essentially, copy-pasted code from C results in different behavior in D 
because of the different floating point decisions made by the compilers.

Your quote was: "[The problem is] Code will do one thing in C, and the 
same code will do something unexpectedly different in D."

My response is that it already happens, so it may not be a convincing 
argument. I don't know the requirements or allowances of the C spec. All 
I know is the testable reality of the behavior on the same platform.

-Steve


More information about the Digitalmars-d mailing list