RPN83P: RPN calculator for TI-83+ TI-84+ inspired by HP-42S
|
11-22-2023, 06:11 PM
(This post was last modified: 11-22-2023 06:21 PM by bxparks.)
Post: #24
|
|||
|
|||
RE: RPN83P: RPN calculator for TI-83+ TI-84+ inspired by HP-42S
(11-22-2023 03:53 PM)Thomas Klemm Wrote: I noticed the link while reading the source code of lnOnePlus in float.asm. The "faster than above" is a slight typo, it should be "faster than below". I had flipped the order of the 2 implementations without updating the comments. The LOG1P_USING_LOG macro is now undefined by default, so the code selects the asinh() version. Hopefully that was clear from the context. I have updated the comments, and added this new comment at the top of the function: Quote:; Description: Calculate ln(1+x) such that it is less susceptible from So I think the x*ln(x)/((1+x)-1) *did* work for the TI calculators. But since I did not understand the explanation given in the math.stackexchange.com link about *why* it worked, I could not be sure that it worked for *all* ranges of numbers. The comment about not working on certain computers came from another source that has this formula, but I cannot remember what that other source was. (Maybe it was one of the old HP-15C or HP-34C solutions book.) Instead, I decided to use the asinh() version because I actually understand it. It's a mathematical identity, which I was able to re-derive. And as long as I used the expression which was less susceptible to numerical errors for x->0, that is log(1+x)=asinh((x/2)(1+1/(1+x))), I could depend on it. [Edit: Also added a stronger comment that the identity holds only for (1+x)>0, and this condition must be checked in the code. Because for (1+x)<0, the asinh() expression returns a value, but log(1+x) must throw an exception.] |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 28 Guest(s)