diff options
author | Mark Spruiell <mes@zeroc.com> | 2015-12-02 12:42:12 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2015-12-02 12:42:12 -0800 |
commit | 73f4e5936a12c3ab79479e96e5e2eb45fbb72139 (patch) | |
tree | 9cc30b15f7c034f189ae1e5e9398f695a8bc22a5 /ruby | |
parent | Fixes for ICE-6905 - support NaN/Infinity in scripting languages (diff) | |
download | ice-73f4e5936a12c3ab79479e96e5e2eb45fbb72139.tar.bz2 ice-73f4e5936a12c3ab79479e96e5e2eb45fbb72139.tar.xz ice-73f4e5936a12c3ab79479e96e5e2eb45fbb72139.zip |
Ruby portability fix for ICE-6905
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/src/IceRuby/Types.cpp | 1 | ||||
-rw-r--r-- | ruby/test/Ice/operations/Twoways.rb | 12 |
2 files changed, 11 insertions, 2 deletions
diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 228a202a349..2168e9daaf8 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -17,6 +17,7 @@ #include <Ice/SlicedData.h> #include <list> #include <limits> +#include <math.h> // // Required for RHASH_SIZE to work properly with Ruby 1.8.x. diff --git a/ruby/test/Ice/operations/Twoways.rb b/ruby/test/Ice/operations/Twoways.rb index 453a048b219..2ac21be3874 100644 --- a/ruby/test/Ice/operations/Twoways.rb +++ b/ruby/test/Ice/operations/Twoways.rb @@ -135,11 +135,19 @@ def twoways(communicator, p) r, f, d = p.opFloatDouble(3.402823466E38, 0.0) r, f, d = p.opFloatDouble(-3.402823466E38, 0.0) - for val in [Float::NAN, -Float::NAN] + # + # For portability, don't use Float::NAN here. + # + nan = 0.0 / 0.0 + for val in [nan, -nan] r, f, d = p.opFloatDouble(val, val) test(r.nan? && f.nan? && d.nan?) end - for val in [Float::INFINITY, -Float::INFINITY] + # + # For portability, don't use Float::INFINITY here. + # + inf = 1.0 / 0.0 + for val in [inf, -inf] r, f, d = p.opFloatDouble(val, val) test(r.infinite? != 0 && f.infinite? != 0 && d.infinite? != 0) end |