From 461231f022bdb3ee392622d31dc475034adceeb2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 24 Oct 2008 22:52:22 -0700 Subject: seq: revert Solaris 8 work-around that caused x86 regression * src/seq.c: Don't include , . (abs_rel_diff): Remove. (print_numbers): Test for equality, not for an epsilonish value. This reverts 4827dd27b0c655a685947aaa01426a5ecba179f3, aka v6.10-185-g4827dd2, which broke 'seq' on the x86; for example, it causes "seq 9223372036854775807 9223372036854775808" to incorrectly output 3 numbers instead of 2. It's better to punish obsolescent hosts that have incorrectly-working floating-point than to punish correctly-working hosts. * tests/misc/seq: Use 0.9000000000000, rather than 0.90000000000000000000, to avoid tickling a bug in Solaris 8 strtold, which converts "0.9" and "0.9000000000000" correctly, but incorrectly converts "0.90000000000000000000" to a smaller value. --- src/seq.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/seq.c') diff --git a/src/seq.c b/src/seq.c index b41aab6bc..3ae158b08 100644 --- a/src/seq.c +++ b/src/seq.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include "system.h" #include "c-strtod.h" @@ -258,14 +256,6 @@ long_double_format (char const *fmt, struct layout *layout) return NULL; } -/* Return the absolute relative difference from x to y. */ -static double -abs_rel_diff (double x, double y) -{ - double s = (y == 0.0 ? 1 : y); - return fabs ((y - x) / s); -} - /* Actually print the sequence of numbers in the specified range, with the given or default stepping and format. */ @@ -310,7 +300,7 @@ print_numbers (char const *fmt, struct layout layout, x_str[x_strlen - layout.suffix_len] = '\0'; if (xstrtold (x_str + layout.prefix_len, NULL, &x_val, c_strtold) - && abs_rel_diff (x_val, last) < DBL_EPSILON) + && x_val == last) { char *x0_str = NULL; if (asprintf (&x0_str, fmt, x0) < 0) -- cgit v1.2.3-54-g00ecf