Closed sanjayjain159 closed 8 months ago
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
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).
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.
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: https://github.com/philburk/pforth/issues/155#issuecomment-1904454559 You are receiving this because you authored the thread.
Message ID: @.***>
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.
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.