Small challenge
|
04-26-2023, 07:51 AM
(This post was last modified: 04-26-2023 01:02 PM by J-F Garnier.)
Post: #32
|
|||
|
|||
RE: Small challenge
Some more clarifications:
(04-25-2023 08:49 PM)J-F Garnier Wrote: -when subtracting two 15-digit BCD numbers, the larger mantissa is shifted left (moved to 16 digits) I would better say: subtraction is done on 16 digits, but in any case the result is normalized to 15 digits. An example of the benefit of the 16-digit subtraction: Do 1 - 1/3000 in extended precision, that is: 1.00000000000000 - 0.000333333333333333 Computing with 15 digits only, you would get, after alignement of the mantissa: 1.00000000000000 - 0.00033333333333 = 0.99966666666667 i.e. only 14 significant digits But doing the operation on 16 digits (by shifting both mantissa left 1 position): 1.000000000000000 - 0.000333333333333 = 0.999666666666667 i.e. now 15 significant digits Quote:-the multiplication of two 15-digit mantissa can provide a mantissa on 15 or 16 digits, for instance 3.000.. x 3.000.. --> 9.000.. (on 15 digits), but 3.000.. x 4.000.. --> 12.000.. (on 16 digits). The result is always normalized on 15 digits but the possible 16-digit mantissa is kept (in D) and sometimes used to improved the accuracy of internal calculations, and this is the case for y^x computed as exp(x*ln(y)). Note that in the 3^729 case, the term x*ln(y) = 729 x 1.098... doesn't generate a 16-digit mantissa, no extra accuracy here. Same for the 1e44^10.5 case, the term x*ln(y) is 10.5 x 101.31.. Here are the intermediate results in extended precision on both machines for 1e44^10.5: 75c (16 digits) 71b (15 digits) ln(1e44) = 101.3137440917379 101.313744091738 exact value = 101.3137440917380(10) 10.5*ln(1e44) = 1063.794312963247 1063.79431296324 exp(10.5*ln(1e44)) = 9.999999999977472e461 9.99999999990893e461 rounded to: 9.99999999998e461 9.99999999991e461 The difference comes from the result of the step 10.5*ln(1e44) and the missing 16th digit on the 71b. J-F |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)