From 997ff23758884944f28a089eaa50ac7eb1c026c6 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 10 Feb 1999 08:44:29 +0000 Subject: *** empty log message *** git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index a6ab555991..804356d99a 100644 --- a/numeric.c +++ b/numeric.c @@ -13,6 +13,9 @@ #include "ruby.h" #include #include +#ifdef __FreeBSD__ +#include +#endif static ID coerce; static ID to_i; @@ -985,15 +988,13 @@ fix_pow(x, y) b = FIX2LONG(y); if (b == 0) return INT2FIX(1); + if (b == 1) return x; a = FIX2LONG(x); if (b > 0) { return rb_big_pow(rb_int2big(a), y); } return rb_float_new(pow((double)a, (double)b)); } - else if (NIL_P(y)) { - return INT2FIX(1); - } return rb_num_coerce_bin(x, y); } @@ -1402,6 +1403,10 @@ fix_zero_p(num) void Init_Numeric() { +#ifdef __FreeBSD__ + /* allow divide by zero -- Inf */ + fpsetmask(fpgetmask() & ~(FP_X_DZ|FP_X_INV)); +#endif coerce = rb_intern("coerce"); to_i = rb_intern("to_i"); -- cgit v1.2.3