Why don't we switch to C like floating pointed arithmetic instead of automatic expansion to reals?

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 5 12:09:23 PDT 2016


On Friday, 5 August 2016 at 09:21:53 UTC, Ilya Yaroshenko wrote:
> On Friday, 5 August 2016 at 08:43:48 UTC, deadalnix wrote:
>> On Friday, 5 August 2016 at 08:17:00 UTC, Ilya Yaroshenko 
>> wrote:
>>> 1. Could you please provide an assembler example with clang 
>>> or recent gcc?
>>
>> I have better: compile your favorite project with 
>> -Wdouble-promotion and enjoy the rain of warnings.
>>
>> But try it yourself:
>>
>> float foo(float a, float b) {
>>   return 3.0 * a / b;
>> }
>
> Your example is just a speculation. 3.0 force compiler to 
> convert a and  b to double. This is obvious.

Ha you are right.

Testing more it seems that gcc and clang are not promoting on 64 
bit code, but still are on 32 bits.


More information about the Digitalmars-d mailing list