sin(x) & cos(x) for x = 10²² in radians
|
10-02-2023, 06:34 PM
(This post was last modified: 10-02-2023 06:44 PM by brouhaha.)
Post: #9
|
|||
|
|||
RE: sin(x) & cos(x) for x = 10²² in radians
quote='dm319' pid='177906' dateline='1696263025']
Any ideas why this is is difficult to answer? [/quote] When asked to evaluate a trig function with an argument of 10^22, the first question is whether you mean EXACTLY 10^22, or (on a calculator) 10^22 within the limited floating point resolution of the calculator. In calculators with 10-digit mantissa precision, a display of 1.000000000E22 could be anywhere from 0.999999995x10^22 to 1.0000000004999...x10^22. Obviously the sine or cosine could then be any real value in [-1.0, 1.0]. That's the motivation for giving an error. Even if you can do perfectly accurate range reduction on an EXACT 10^22, a normal calculator has no way to know that the argument is exact. If we did somehow know that the argument is exact, to do correct argument range reduction, we need an approximation of pi good to more than 22 digits for this case, and more than 99 digits for an exponent range to 99. In comparison, if we ask a 10-digit calculator for sin(999999999.0), it still doesn't know that the argument is exact, but the maximum argument error is 0.05 which will result in inaccuracy of the result, but because sin and cos are well-behaved, we can still get three digits of accuracy in the result, vs zero digits for 10^10 or more. In general, for any real world problem, if you need sin(10^22), you're doing something very wrong. For a good background on issues with argument range reduction, see Elementary Functions: Algorithms and Implementation by Muller. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)