[Bug #1073] test_to_s(Complex_Test) fails on Solaris

Bug #1073: test_to_s(Complex_Test) fails on Solaris
http://redmine.ruby-lang.org/issues/show/1073

e$B5/I<<Te(B: Shugo M.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Low
ruby -v: ruby 1.9.1p5000 (2009-01-29 trunk 21875) [i386-solaris2.10]

Solarise$B$Ge(Btest_to_s(Complex_Test)e$B$,<:GT$9$k$h$&$G$9!#e(B

$ make test-all TESTS=test/ruby/test_complex.rb

  1. Failure:
    test_to_s(Complex_Test)
    [/export/home/shugo/src/ruby_1_9_1/test/ruby/test_complex.rb:591]:
    <“NaN+NaNi"> expected but was
    <"NaN-NaN
    i”>.

2289 tests, 2637768 assertions, 1 failures, 0 errors, 0 skips

r20473e$B$G!“e(Bsignbit()e$B$,$”$k;~$O!"e(Bisnan()[email protected]$C$?$i>o$Ke(BQfalsee$B$rJV$9$h$&$Ke(Bf_signbit()e$B$,[email protected]$5$l$F$$$^$9$,!"e(B
signbit()e$B$,$J$$;~$bF1$8$h$&$Ke(Bisnan()e$B$r8+$k$h$&$K$9$k$Y$-$J$s$8$c$J$$$G$7$g$&$+!#e(B

Index: complex.c

— complex.c (revision 21875)
+++ complex.c (working copy)
@@ -894,8 +894,10 @@
#else
{
char s[2];

  • double f = RFLOAT_VALUE(x);
  • (void)snprintf(s, sizeof s, “%.0f”, RFLOAT_VALUE(x));
  • if (isnan(f)) return Qfalse;
  • (void)snprintf(s, sizeof s, “%.0f”, f);
    return f_boolcast(s[0] == ‘-’);
    }
    #endif

r20473e$B$G!“e(Bsignbit()e$B$,$”$k;~$O!"e(Bisnan()[email protected]$C$?$i>o$Ke(BQfalsee$B$rJV$9$h$&$Ke(Bf_signbit()e$B$,[email protected]$5$l$F$$$^$9$,!"e(B
signbit()e$B$,$J$$;~$bF1$8$h$&$Ke(Bisnan()e$B$r8+$k$h$&$K$9$k$Y$-$J$s$8$c$J$$$G$7$g$&$+!#e(B

e$B3N$+$K!#e(B
e$BD>$7$F$*$$$F$b$i$($^$9$+!#e(B

e$B%A%1%C%He(B #1073 e$B$,99?7$5$l$^$7$?!#e(B (by Shugo M.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

Applied in changeset r21945.

http://redmine.ruby-lang.org/issues/show/1073