Promotion rules ... why no float?
Sai via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 7 07:46:46 PDT 2016
I suspected the same, most of the CPUs support fast floating
point operations anyway (with FPUs), shouldn't take a lot more
time than doing integer arithmetic. Unless we are targeting 8bit
avr or something similar.
And precision argument doesn't seem strong either, since, which
is more precise 3/7 = 0 or 0.4285 ?
I am not suggesting we change the promotion rules now, most
likely never going to happen. But I am trying to find a good
rationale for the existing rules and unable to find a good one.
On Wednesday, 7 September 2016 at 05:31:08 UTC, Daniel Kozak
> Dne 6.9.2016 v 22:51 deadalnix via Digitalmars-d napsal(a):
>> On Tuesday, 6 September 2016 at 07:52:47 UTC, Daniel Kozak
>>> No, it is really important rule. If there will be automatic
>>> promotion to float for auto it will hurt performance
>>> in cases when you want int and it will break things.
>> The performance have nothing to do with it. In fact float
>> division is way faster than integer division, try it. It is
>> all about correctness. Integer and floating point division
>> have different semantic.
> You are right, on my pc speed is same, but I am remember that
> there has been some performance problems last time i checked
> (something about only one FPU on my bulldozer cpu)
More information about the Digitalmars-d