Accurate x - log(1+x)
|
05-06-2022, 02:03 PM
(This post was last modified: 05-12-2022 11:02 PM by Albert Chan.)
Post: #4
|
|||
|
|||
RE: Accurate x - log(1+x)
We can use x_sub_log1p(), to get accurate (e^x - 1 - x), for small x
y = x - log(1+x) e^y = e^x / (1+x) (e^y - 1) = (e^x - 1 - x) / (1+x) (e^x - 1 - x) = (e^y - 1) * (1+x) Code: function expm1_sub_x(x) lua> x = 1/1024 lua> expm1(x) - x -- error = 967 ULP 4.769924165351404e-007 lua> expm1_sub_x(x) -- error = -1 ULP 4.769924165352429e-007 Comment: next post expm1_sub(x) take care of big x too. It is also more consistent throughout, func_sub(x) = func(x) - x |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Accurate x - log(1+x) - Albert Chan - 05-05-2022, 07:52 PM
RE: Accurate x - log(1+x) - Albert Chan - 05-05-2022, 08:18 PM
RE: Accurate x - log(1+x) - Albert Chan - 05-05-2022, 08:57 PM
RE: Accurate x - log(1+x) - Albert Chan - 05-06-2022 02:03 PM
RE: Accurate x - log(1+x) - Albert Chan - 05-09-2022, 12:41 AM
RE: Accurate x - log(1+x) - Albert Chan - 04-04-2023, 11:05 PM
|
User(s) browsing this thread: 1 Guest(s)