Skip to content

Commit

Permalink
Fix FLNP1 calculation (#160)
Browse files Browse the repository at this point in the history
Was log(x)+1
Now log(x+1)

Fixes #155
  • Loading branch information
philburk authored Mar 28, 2024
1 parent 8da2f09 commit ce91977
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions csrc/pf_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ typedef double PF_FLOAT;
#define fp_floor floor
#define fp_log log
#define fp_log10 log10
#define fp_log1p log1p
#define fp_pow pow
#define fp_sin sin
#define fp_sinh sinh
Expand Down
2 changes: 1 addition & 1 deletion csrc/pfinnrfp.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
break;

case ID_FP_FLNP1: /* ( -- ) ( F: r1 -- r2 ) */
FP_TOS = (PF_FLOAT) (fp_log(FP_TOS) + 1.0);
FP_TOS = (PF_FLOAT) fp_log1p(FP_TOS); /* log(x+1) */
break;

case ID_FP_FLOG: /* ( -- ) ( F: r1 -- r2 ) */
Expand Down

0 comments on commit ce91977

Please sign in to comment.