[前][次][番号順一覧][スレッド一覧]

ruby-changes:45706

From: nobu <ko1@a...>
Date: Sun, 5 Mar 2017 10:46:24 +0900 (JST)
Subject: [ruby-changes:45706] nobu:r57779 (trunk): math.c: more accuracy

nobu	2017-03-05 10:46:20 +0900 (Sun, 05 Mar 2017)

  New Revision: 57779

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57779

  Log:
    math.c: more accuracy
    
    * math.c (math_log10): calculate log10(2) for more accuracy.
      [ruby-core:79907] [Bug #13279]

  Modified files:
    trunk/math.c
Index: math.c
===================================================================
--- math.c	(revision 57778)
+++ math.c	(revision 57779)
@@ -563,7 +563,7 @@ math_log10(VALUE unused_obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L563
     /* check for pole error */
     if (d == 0.0) return DBL2NUM(-INFINITY);
 
-    return DBL2NUM(log10(d) + numbits * M_LN2/M_LN10); /* log10(d * 2 ** numbits) */
+    return DBL2NUM(log10(d) + numbits * log10(2)); /* log10(d * 2 ** numbits) */
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]