complex log
|
02-10-2024, 09:55 PM
(This post was last modified: 02-11-2024 02:56 PM by Albert Chan.)
Post: #6
|
|||
|
|||
RE: complex log
Here is updated OP version 1, fixed its subnormal accuracy issue.
Instead of LN2 shift for overflowed h, (DBL_MANT_DIG*M_LN2) for subnormal, I combined them. relative error = (exact - approx) / exact relerr(ln(2)) ≈ 3.346E-17 relerr(ln(2)*53) ≈ 1.835E-17 relerr(ln(2)*61) ≈ -6.781E-19 Last constant has 59 bits accuracy (~ 18 digits), the most accurate for our domain. float(ln(2)*61) = 0x1.52417db067f38p+5 = 42.28197801415666390... Clog Version 1b Code: static Complex Clog(Complex z) { (02-08-2024 09:04 PM)Albert Chan Wrote: lua> t = 0x1p-1074 We get exactly the same answer for version 1b Update: previously, I used shift of (M_LN2*732) to avoid hypot() function. With ULP of log part different than final result, answer is always double rounded. Double rounding is acceptable if log part ULP is much smaller, but it isn't. Also, for big |log(x)|, error caused by hypot() inside log may be ignored. log(x*(1-ε)) ≈ log(x) + (-xε) / x = log(x) - ε if relerr(x) is ε, then relerr(log(x)) is ε/log(x), much smaller than ε |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
complex log - Albert Chan - 02-07-2024, 12:47 AM
RE: complex log - Albert Chan - 02-07-2024, 12:49 AM
RE: complex log - Albert Chan - 02-07-2024, 11:24 PM
RE: complex log - Albert Chan - 02-07-2024, 11:03 AM
RE: complex log - Albert Chan - 02-08-2024, 09:04 PM
RE: complex log - Albert Chan - 02-10-2024 09:55 PM
RE: complex log - Albert Chan - 02-11-2024, 06:32 PM
|
User(s) browsing this thread: 1 Guest(s)