summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ruby/src/IceRuby/Types.cpp1
-rw-r--r--ruby/test/Ice/operations/Twoways.rb12
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