Re: additional questions regarding implementation and test cases | was: Aw: Re: simple? c-coding / gnumeric coding style question ...

in the meantime i found another - better? - solution with using 'rint' in the process of rounding, and now 
have (complex) calculations producing better results for e.g. '=0.1 + 0.2' or '=1234.12 - 1234' and still 
correct results for other values. :-)

I'll be blunt here: no, you don't.  The solution you are looking for
does not exist.

The input and output to "+" and "-" are doubles, i.e., IEEE854
numbers.  "+" and "-" currently perform the round-to-nearest operation
on the sum or difference.  The maximum error thus is 0.5ulp.

If you change this -- any change whatsoever -- you will create larger errors.

What you seem to be doing is to take the base-2 inputs and reinterpret
them as base-10 numbers, then perform the addition or subtraction, and
finally reinterpret the numbers back to base-2.  Each reinterpretation
(you might call it "rounding") adds some kind of error.

If you want base-10 arithmetic you need to change the compiler and
libraries to use a "double" type that uses something like BCD instead
of base-2.  This would be a fantastic amount of work -- many man


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]