You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/05 02:14:10 UTC

(nuttx) branch master updated: libs/libm: fix epsilon relaxation in log and logf

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a2ed0ddd72 libs/libm: fix epsilon relaxation in log and logf
a2ed0ddd72 is described below

commit a2ed0ddd7262b1c33feb79414d9438d664df6a8f
Author: Petro Karashchenko <pe...@gmail.com>
AuthorDate: Wed Sep 4 17:59:23 2024 +0200

    libs/libm: fix epsilon relaxation in log and logf
    
    Signed-off-by: Petro Karashchenko <pe...@gmail.com>
---
 libs/libm/libm/lib_log.c  | 2 +-
 libs/libm/libm/lib_logf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/libm/libm/lib_log.c b/libs/libm/libm/lib_log.c
index 9b8e23b97d..5bf3c67948 100644
--- a/libs/libm/libm/lib_log.c
+++ b/libs/libm/libm/lib_log.c
@@ -98,7 +98,7 @@ double log(double x)
           iter = 0;
         }
 
-      if (relax_factor > 1.0)
+      if (iter == 0)
         {
           epsilon *= relax_factor;
         }
diff --git a/libs/libm/libm/lib_logf.c b/libs/libm/libm/lib_logf.c
index 35672915b4..3cf050bca0 100644
--- a/libs/libm/libm/lib_logf.c
+++ b/libs/libm/libm/lib_logf.c
@@ -94,7 +94,7 @@ float logf(float x)
           iter = 0;
         }
 
-      if (relax_factor > 1.0F)
+      if (iter == 0)
         {
           epsilon *= relax_factor;
         }