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

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 5 02:21:53 PDT 2016


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.


More information about the Digitalmars-d mailing list