[phobos] Proposed changes to std.math + introduce std.mathspecial

Simen Kjaeraas simen.kjaras at gmail.com
Wed Nov 17 14:52:35 PST 2010


Don Clugston <dclugston at googlemail.com> wrote:

>>> (1) Add two necessary functions to std.math:
>>>
>>> // Rounds x to the nearest int or long using the currently selected
>>> rounding mode
>>> // (MUCH faster than cast(int)).
>>
>> Why isn't this the default, i.e. why doesn't cast(int) do this?
>
> Because C stuffed up in a major way, and we have to live with it.
> Intel has tried THREE TIMES to fix C's mistake, by making hardware
> changes and adding new instructions to their CPUs.

Sure, I can see the value in 'it's what C does'. Now, seeing as
(int)1.0f does not compile in D, is there really a problem defining
cast(int)1.0f to use this new, magical function? I'm not trying to
be obnoxious, I just am.

-- 
Simen


More information about the phobos mailing list