summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-06 06:44:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-06 06:44:41 +0000
commited6b1829bad6c30c00b68d5efdf4c2f1af12cc80 (patch)
tree26fccea37e0ce2d8ceb8625bd67a0db29b6bb295 /sprintf.c
parent774aebb3ce3ef856789a7c60e0839f93a393fe6a (diff)
* sprintf.c (rb_str_format): casting double to long is undefined
if the interger part of double is out of the range of long. (fix previous commit). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sprintf.c b/sprintf.c
index 795af92373..63ac093f29 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -540,8 +540,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
bin_retry:
switch (TYPE(val)) {
case T_FLOAT:
- if (RFLOAT_VALUE(val) <= LONG_MAX &&
- RFLOAT_VALUE(val) >= LONG_MIN) {
+ if (FIXABLE(RFLOAT_VALUE(val))) {
val = LONG2FIX((long)RFLOAT_VALUE(val));
goto bin_retry;
}