Always false float comparisons

Manu via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 04:38:23 PDT 2016


On 18 May 2016 at 21:28, ixid via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Wednesday, 18 May 2016 at 08:55:03 UTC, Walter Bright wrote:
>>
>> On 5/18/2016 1:30 AM, Ethan Watson wrote:
>>>>
>>>> You're also asking for a mode where the compiler for one machine is
>>>> supposed
>>>> to behave like hand-coded assembler for another machine with a different
>>>> instruction set.
>>>
>>>
>>> Actually, I'm asking for something exactly like the arch option for
>>> MSVC/-mfmath
>>> option for GCC/etc, and have it respect that for CTFE.
>>
>>
>>
>> MSVC doesn't appear to have a switch that does what you ask for:
>>
>>   https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx
>
>
> Apologies if this has been addressed in the thread, it's a difficult
> structure to follow for technical discussion. You seem positive about
> software implementations of float. What are your thoughts on having the
> compile time implementation of a given type mirror the behaviour of the
> runtime version?
>
> Fundamentally whatever rules are chosen it would seem better to have fewer
> rules for people  to remember.

That's precisely the suggestion; that compile time execution of a
given type mirror the runtime, that is, matching precisions in this
case.
...within reason; as Walter has pointed out consistently, it's very
difficult to be PERFECT for all the reasons he's been repeating, but
there's still a massive difference between the runtime executing a
bunch of float code, and the compile time executing it all promoted to
80bits. Results will drift apart very quickly.


More information about the Digitalmars-d mailing list