summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/rational.c b/rational.c
index ccf214c32a..4deb54d6e2 100644
--- a/rational.c
+++ b/rational.c
@@ -1107,13 +1107,16 @@ nurat_to_f(VALUE self)
long nl, dl, ml, ne, de;
int e;
double f;
- get_dat1(self);
- if (f_zero_p(dat->num))
- return rb_float_new(0.0);
+ {
+ get_dat1(self);
+
+ if (f_zero_p(dat->num))
+ return rb_float_new(0.0);
- num = dat->num;
- den = dat->den;
+ num = dat->num;
+ den = dat->den;
+ }
if (f_negative_p(num)) {
num = f_negate(num);