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

ruby-changes:69644

From: Nobuyoshi <ko1@a...>
Date: Mon, 8 Nov 2021 18:53:00 +0900 (JST)
Subject: [ruby-changes:69644] 7cc4e147fc (master): Get rid of implicit expansion to `long double` on ix86

https://git.ruby-lang.org/ruby.git/commit/?id=7cc4e147fc

From 7cc4e147fc2fba1ef9e06cf50f1916acdb886a24 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 8 Nov 2021 16:05:04 +0900
Subject: Get rid of implicit expansion to `long double` on ix86

---
 numeric.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/numeric.c b/numeric.c
index da6595085db..7a28e32b275 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2546,7 +2546,7 @@ double https://github.com/ruby/ruby/blob/trunk/numeric.c#L2546
 ruby_float_step_size(double beg, double end, double unit, int excl)
 {
     const double epsilon = DBL_EPSILON;
-    double n, err;
+    double d, n, err;
 
     if (unit == 0) {
         return HUGE_VAL;
@@ -2563,24 +2563,26 @@ ruby_float_step_size(double beg, double end, double unit, int excl) https://github.com/ruby/ruby/blob/trunk/numeric.c#L2563
 	    n = 0;
 	else
 	    n = floor(n - err);
+        d = +((n + 1) * unit) + beg;
         if (beg < end) {
-            if ((n+1)*unit+beg < end)
+            if (d < end)
                 n++;
         }
         else if (beg > end) {
-            if ((n+1)*unit+beg > end)
+            if (d > end)
                 n++;
         }
     }
     else {
 	if (n<0) return 0;
 	n = floor(n + err);
+        d = +((n + 1) * unit) + beg;
         if (beg < end) {
-            if ((n+1)*unit+beg <= end)
+            if (d <= end)
                 n++;
         }
         else if (beg > end) {
-            if ((n+1)*unit+beg >= end)
+            if (d >= end)
                n++;
         }
     }
-- 
cgit v1.2.1


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

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