Always false float comparisons

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 02:13:35 PDT 2016


On 18 May 2016 at 07:49, Ola Fosheim Grøstad via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Wednesday, 18 May 2016 at 03:01:14 UTC, Joakim wrote:
>>
>> There is nothing "random" about increasing precision till the end, it
>> follows a well-defined rule.
>
>
> Can you please quote that well-defined rule?
>
> It is indeed random, or arbitrary (which is the same thing):
>
> if(x<0){
>   // DMD choose 64 bit mantissa
>   const float y = ...
>   ...
>
> } else {
>   // DMD choose 24 bit mantissa
>   float y = ...
>   ...
> }
>
> How is this not arbitrary?
>

Can you back that up statistically?  Try running this same operation
600 million times plot a graph for the result from each run for it so
we can get an idea of just how random or arbitrary it really is.

If you get the same result back each time, maybe it isn't as arbitrary
or random as you would have some believe.



More information about the Digitalmars-d mailing list