Time to move std.experimental.checkedint to std.checkedint ?

Max Haughton maxhaton at gmail.com
Tue Mar 30 08:48:04 UTC 2021


On Tuesday, 30 March 2021 at 06:43:04 UTC, Walter Bright wrote:
> On 3/29/2021 10:53 PM, Max Samukha wrote:
>> On Tuesday, 30 March 2021 at 00:02:54 UTC, H. S. Teoh wrote:
>> 
>>> Just as when you use `float` or `double` you already signed 
>>> up for IEEE semantics, like it or not. (I don't, but I also 
>>> recognize that it's unrealistic to expect the hardware type 
>>> to match up 100% with the mathematical ideal.) If you don't 
>>> like that, use one of the real arithmetic libraries out there 
>>> that let you work with "true" mathematical reals that aren't 
>>> subject to the quirks of IEEE floating-point numbers. Just 
>>> don't expect anything that will be competitive 
>>> performance-wise.
>>>
>> 
>> I seems you are arguing against the way D broke compile time 
>> floats and doubles. )
>
> Compile-time isn't a run-time performance issue.

On the subject of run-time performance, checkedint can also do 
things like Saturation arithmetic, which can be accelerated using 
increasingly common native instructions (e.g. AVX on Intel, AMD, 
and presumably Via also). I have done some tests and found that 
these are not currently used. ARM also has saturating 
instructions but I haven't done any tests.

Due to AVX being a SIMD instruction set there is a tradeoff to 
using them for scalar operations, however for loops the 
proposition seems attractive. The calculus to do this seems 
non-trivial for the backend however.

(AVX instructions are also quite big so there is a the usual I$ 
hit here too).


More information about the Digitalmars-d mailing list