dbremner / mili

Automatically exported from code.google.com/p/mili
Boost Software License 1.0
0 stars 0 forks source link

addable/summable functions #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please add the following predicates:
   bool is_lossless_sum(x,y)
that returns true iif x+y != x && x+y != y, or in a more generic form,
    x+y > max(x,y)

You might want to implement it by either doing that, or (maybe) in a more
performant way by calling the nextafter function. Please consider both data
types (float and double).

Please confirm with a small experiment what the most performant method is
(by calling this function millions of times, double and float).

To be added to arith_utils.

Original issue reported on code.google.com by danielgutson@gmail.com on 28 Feb 2010 at 3:53

GoogleCodeExporter commented 9 years ago
Maybe more tricks can be obtained with
http://en.wikipedia.org/wiki/Math.h
see nextafter, logb, etc, and look for ulp.

Original comment by danielgutson@gmail.com on 28 Feb 2010 at 4:22

GoogleCodeExporter commented 9 years ago
You now have is_lossless_sum (non optimized) and is_lossless_sum_bigsmall, 
which 
assumes the first parameter is larger than the second and that the second is 
not zero.

See for example:

http://code.google.com/p/mili/source/detail?r=116

Original comment by billybiset on 15 Mar 2010 at 7:29

GoogleCodeExporter commented 9 years ago

Original comment by billybiset on 4 Jul 2010 at 6:13