<< accsum_straight Accsum Support >>

Accsum >> Accsum > accsum_twosum

accsum_twosum

The twosum sum of a and b.

Calling Sequence

s = accsum_twosum ( a , b )
[s,t] = accsum_twosum ( a , b )

Parameters

a :

a 1-by-1 matrix of doubles

b :

a 1-by-1 matrix of doubles

s :

a 1-by-1 matrix of doubles, the highest significant digits of the sum

t :

a 1-by-1, matrix of doubles, the lowest significant digits of the sum

Description

Returns the sum of a and b so that a + b = s + t exactly. where s contains the highest significant digits and t the lowest significant digits. Algorithm 4.4 in HFCC Due to Knuth No assumption on a , b Assumes that Scilab uses round-to-nearest.

Examples

[s,t] = accsum_twosum ( 2 , 1 ) // 3
[s,t] = accsum_twosum ( 1 , 2 ) // 3
// is 1+(%eps/2) but is 1 without algo
[s,t] = accsum_twosum ( 1 , %eps/2 )
// is 1+(%eps/2) but is 1 without algo
[s,t] = accsum_twosum ( %eps/2 , 1 )

Authors

Bibliography

"Stability and numerical accuracy of algorithms", Nicolas Higham

"Handbook of Floating Point Computations", Muller et al


<< accsum_straight Accsum Support >>