-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mistake in definition of flnp1 #155
Comments
Thanks! I found FLNP1 at: Line 303 in 8da2f09
Where are you seeing that? The defaults definitions use that standard libraries. |
Dear Sir, I am only an engineer, not a programmer. From my limited knowledge, I see references to math functions in 4 files namely, pf_float.h, pf_guts.h, pf_compfp.h, and pfinnrfp.h. I think the difficulty is in the last file pfinnrfo.h Here flnp1 is defined as lnx + 1. Moreover when I run the following in pforth: 1E-6 FLNP1 FS. I get the wrong answer. The correct answer is almost 1E-6 as can be verified on an Android phone using free42 calculator app which is an emulator of hp42s calculator. So I assumed that the program is calculating from the definitions given in pfinnr.h and not using glibc math functions. Pls correct me if I am wrong. |
Sorry, I accidentally closed the issue. In pfinnrfp.h are also the definitions of asinh etc in terms of glibc math function log (ln).
|
Dear Sir,
First, pls allow me to thank you for responding to my difficulty in pForth.
I shall be grateful if you would test it as follows:
1E-6 FLNP1 FS.
and see the answer.
…On 22 January 2024 10:46:37 PM IST, Phil Burk ***@***.***> wrote:
Thanks! I found FLNP1 at:
https://github.com/philburk/pforth/blob/8da2f097a6a4b856e659e08556ff938ac612d8ed/csrc/pfinnrfp.h#L303
> the definitions of of sinh, tanh, asinh, atanh, should not be constructed from log (or ln) or exp.
Where are you seeing that?
The defaults definitions use that standard libraries.
https://github.com/philburk/pforth/blob/master/csrc/pf_float.h#L29
--
Reply to this email directly or view it on GitHub:
#155 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
|
Was log(x)+1 Now log(x+1) Fixes #155
The standard for FLNP1 is at: https://forth-standard.org/standard/float/FLNPOne The C function ln1p is described at: https://man7.org/linux/man-pages/man3/log1p.3.html I do not see a problem with the definition of asinh, etc. If you still see a problem then open a new bug. Thanks for reporting this. |
Was log(x)+1 Now log(x+1) Fixes #155
defn given in csrc is flnp1 = lnx + 1, where as it should be flnp1= ln(1+x) and only the math lib function log1p should be used for it. Moreover, the math lib expm1 should also be defined in csrc. Both expm1 and lnp1 are given in x87 assembly instructions snd glibc math lib and dpan. Moreover, the definitions of of sinh, tanh, asinh, atanh, should not be constructed from log (or ln) or exp. Either should be left too user to define or only math lib functions sbould be taken. This is necessary so as not to lose precision when x<<1.
The text was updated successfully, but these errors were encountered: