summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index f5b3e84..795af92 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -540,7 +540,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
bin_retry:
switch (TYPE(val)) {
case T_FLOAT:
- if (FIXABLE((long)RFLOAT_VALUE(val))) {
+ if (RFLOAT_VALUE(val) <= LONG_MAX &&
+ RFLOAT_VALUE(val) >= LONG_MIN) {
val = LONG2FIX((long)RFLOAT_VALUE(val));
goto bin_retry;
}