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 03:22:06 PDT 2016


On Friday, 5 August 2016 at 09:40:23 UTC, Walter Bright wrote:
> On 8/5/2016 12:43 AM, Ilya Yaroshenko wrote:
>> You are wrong that there are far fewer of those cases. This is 
>> naive point of
>> view. A lot of netlib math functions require exact IEEE 
>> arithmetic. Tinflex
>> requires it. Python C backend and Mir library require exact 
>> IEEE arithmetic.
>> Atmosphere package requires it, Atmosphere is used as 
>> reference code for my
>> publication in JMS, Springer. And the most important case: no 
>> one top scientific
>> laboratory will use a language without exact IEEE arithmetic 
>> by default.
>
> I'd appreciate it if you could provide links to where these 
> requirements are. I can't find anything on Tinflex, for example.

1. https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
mathmodule.c, math_fsum has comment:
    Depends on IEEE 754 arithmetic guarantees and half-even 
rounding.
The same algorithm also available in Mir. And it does not work 
with 32 bit DMD.

2. sum_kbn in 
https://github.com/JuliaLang/julia/blob/master/base/reduce.jl
requires ieee arithmetic. The same algorithm also available in 
Mir.

3. http://www.netlib.org/cephes/
See log2.c for example:
	z = x - 0.5;
	z -= 0.5;
	y = 0.5 * x  + 0.5;
This code requires IEEE. And you can found it in Phobos std.math

4. Mir has 5 types of summation, and 3 of them requires IEEE.

5. Tinflex requires IEEE arithmetic because extended precision 
may force algorithm to choose wrong computation branch. The most 
significant part of original code was written in R, and the 
scientists who create this algorithm did not care about non IEEE 
compilers at all.

6. Atmosphere requires IEEE for may functions such as 
https://github.com/9il/atmosphere/blob/master/source/atmosphere/math.d#L616
Without proper IEEE rounding the are not guarantee that this 
functions will stop.

7. The same true for real world implementations of algorithms 
presented in Numeric Recipes, which uses various series expansion 
such as for Modified Bessel Function.




More information about the Digitalmars-d mailing list