complex log
|
02-07-2024, 11:24 PM
(This post was last modified: 02-11-2024 04:33 PM by Albert Chan.)
Post: #4
|
|||
|
|||
RE: complex log
(02-07-2024 12:49 AM)Albert Chan Wrote: .5 < h < 3 We can always scale z to z', with its h = |z'|^2 within this range. Clog can be coded using only log1p formula, without other branches. ln(z) = ln(z') + b*ln2 , where z' = z/2^b ln2 = ln2_hi + ln2_lo b = binary exponent of z parts = -1074 .. 1023 +1 (*) if ln2_hi at most 53-11 = 42 bits, then b*ln2_h is exact. Update: I use constants from https://www.netlib.org/fdlibm/e_log.c ln2_hi has only 32 bits, which is ok (we have ln2 of 32+53 = 85 bits) This give more room for future use, say, with fractional b's. Code: static const double Clog, version 2 Code: static Complex Clog(Complex z) { Which versions are best depends on usage pattern. It also depends on speed/accuracy of built-in log1p vs log. (*) b might be +1 higher, to reduce h down to below e Code doesn't use h=x²+y², but h = [1,8) → [e/4,e) → x ≈ [.5829, 1.649) Why e, not 3 Wrote:Let r = ln(|z'|) = ln(h)/2 |
|||
« 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)