summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-10 08:44:29 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-02-10 08:44:29 +0000
commit997ff23758884944f28a089eaa50ac7eb1c026c6 (patch)
treef99563ed31c2f6a8facc7160cccde602d39af79b /numeric.c
parentd148ffef297193fe5f6639a8bd8c9ee3d3374479 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c11
1 files changed, 8 insertions, 3 deletions
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 <math.h>
#include <stdio.h>
+#ifdef __FreeBSD__
+#include <floatingpoint.h>
+#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");