diff options
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rational.c b/rational.c index 0617fd7327..c1c1081446 100644 --- a/rational.c +++ b/rational.c @@ -1072,7 +1072,12 @@ nurat_expt(VALUE self, VALUE other) den = ONE; } if (RB_FLOAT_TYPE_P(num)) { /* infinity due to overflow */ - if (RB_FLOAT_TYPE_P(den)) return DBL2NUM(NAN); + if (RB_FLOAT_TYPE_P(den)) +#ifdef HAVE_NANF + return DBL2NUM(nan("")); +#else + return DBL2NUM((double)NAN); +#endif return num; } if (RB_FLOAT_TYPE_P(den)) { /* infinity due to overflow */ |