A quick precision test
|
06-04-2014, 10:09 PM
Post: #38
|
|||
|
|||
RE: A quick precision test
(06-04-2014 02:17 PM)Claudio L. Wrote: The power function is guaranteed to give you an accurate result with 34 good digits, for any 2 parameters (in this case, your guess that it's less precise is incorrect). I very very much doubt this. Perhaps results with one ULP error but even then I doubt it is that good. The power function is a very difficult one to get right. The GNU C library implementation for 64 bit doubles, in bad cases, falls back to multiple precision calculations carrying over 1600 guard bits. I expect someone rather clever spent a lot of time and effort determining that number as an upper bound to guarantee correctness for the 53 mantissa bits in the result. Quote:I don't know how decNumber does it in particular, but in general powers with small integer exponents are handled by a sequence of multiplications, while powers of real numbers or large numbers are usually done through logarithms: Two points here:
A good rule of thumb to follow is to assume correct rounding for the four arithmetic operations and square root -- these are mandated by the IEEE floating point standards these days. Everything else is close. - Pauli |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 9 Guest(s)