From 0fdbdfbbda2e3d223d299b9df819402c3de82ecf Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 25 Jan 2010 02:51:16 +0000 Subject: [PATCH] * math.c (domain_check): ignore errno if y is inf. r26335 is because NetBSD 5.0's asin and acos returns 0.0 with errno EDOM. But it breaks Linux whose gamma returns inf with errno ERANGE on. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ math.c | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5953d17e4f..197aa98a17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Jan 25 11:45:47 2010 NARUSE, Yui + + * math.c (domain_check): ignore errno if y is inf. + r26335 is because NetBSD 5.0's asin and acos returns + 0.0 with errno EDOM. But it breaks Linux whose gamma returns inf + with errno ERANGE on. + Sun Jan 24 22:48:05 2010 Koichi Sasada * eval.c, vm.c, vm_eval.c, vm_insnhelper.c: fix issues about @@ -228,6 +235,7 @@ Sun Jan 17 22:48:44 2010 Akinori MUSHA Sun Jan 17 19:24:25 2010 Nobuyoshi Nakada * math.c (domain_check): check errno first. + NetBSD 5.0's asin and acos returns 0.0 with errno EDOM. Sun Jan 17 14:24:35 2010 Nobuyoshi Nakada diff --git a/math.c b/math.c index bc6b7eb333..1d7d5e4188 100644 --- a/math.c +++ b/math.c @@ -27,7 +27,10 @@ extern VALUE rb_to_float(VALUE val); static void domain_check(double x, double y, const char *msg) { - if (!errno) { + if (errno) { + if (isinf(y)) return; + } + else { if (!isnan(y)) return; else if (isnan(x)) return; else {