aboutsummaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-09 02:31:23 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-09 02:31:23 +0000
commita08df05021a3513d0382b95197e020e44da45a4d (patch)
tree13bb3e499ace099af85fe5679e763f5fba3a16de /sprintf.c
parented598ead0ed450df9b2ab428f9330e5ea31d2287 (diff)
downloadruby-a08df05021a3513d0382b95197e020e44da45a4d.tar.gz
revert RB_FIXABLE related changesets [Bug #13288][Bug #13293][Bug #13294]
This commit is auto-generated using following command: svn diff -r57807:57788 include internal.h bignum.c numeric.c compile.c insns.def object.c sprintf.c | patch -p0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sprintf.c b/sprintf.c
index 72ac664e0e..40872c0c16 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -832,7 +832,11 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
bin_retry:
switch (TYPE(val)) {
case T_FLOAT:
- val = rb_dbl2ival(RFLOAT_VALUE(val));
+ if (FIXABLE(RFLOAT_VALUE(val))) {
+ val = LONG2FIX((long)RFLOAT_VALUE(val));
+ goto bin_retry;
+ }
+ val = rb_dbl2big(RFLOAT_VALUE(val));
if (FIXNUM_P(val)) goto bin_retry;
bignum = 1;
break;