From 6ea34efab04f08c4bb772af8406e09021a403bc0 Mon Sep 17 00:00:00 2001 From: mrkn Date: Thu, 8 Nov 2012 00:34:55 +0000 Subject: * numeric.c: Add description of that the results of the comparing operations of two NaNs are undefined. [#1720] [ruby-dev:38725] [ruby-core:36966] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index aab049490d..278d27f489 100644 --- a/numeric.c +++ b/numeric.c @@ -1042,6 +1042,8 @@ num_equal(VALUE x, VALUE y) * Returns true only if obj has the same value * as flt. Contrast this with Float#eql?, which * requires obj to be a Float. + * The result of NaN == NaN is undefined, so the + * implementation-dependent value is returned. * * 1.0 == 1 #=> true * @@ -1109,6 +1111,8 @@ rb_dbl_cmp(double a, double b) * Returns -1, 0, +1 or nil depending on whether flt is less * than, equal to, or greater than real. This is the basis for * the tests in Comparable. + * The result of NaN <=> NaN is undefined, so the + * implementation-dependent value is returned. */ static VALUE @@ -1153,6 +1157,8 @@ flo_cmp(VALUE x, VALUE y) * flt > real -> true or false * * true if flt is greater than real. + * The result of NaN > NaN is undefined, so the + * implementation-dependent value is returned. */ static VALUE @@ -1193,6 +1199,8 @@ flo_gt(VALUE x, VALUE y) * * true if flt is greater than * or equal to real. + * The result of NaN >= NaN is undefined, so the + * implementation-dependent value is returned. */ static VALUE @@ -1232,6 +1240,8 @@ flo_ge(VALUE x, VALUE y) * flt < real -> true or false * * true if flt is less than real. + * The result of NaN < NaN is undefined, so the + * implementation-dependent value is returned. */ static VALUE @@ -1272,6 +1282,8 @@ flo_lt(VALUE x, VALUE y) * * true if flt is less than * or equal to real. + * The result of NaN <= NaN is undefined, so the + * implementation-dependent value is returned. */ static VALUE @@ -1313,6 +1325,8 @@ flo_le(VALUE x, VALUE y) * Returns true only if obj is a * Float with the same value as flt. Contrast this * with Float#==, which performs type conversions. + * The result of NaN.eql?(NaN) is undefined, so the + * implementation-dependent value is returned. * * 1.0.eql?(1) #=> false */ -- cgit v1.2.3