diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 06:11:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-06 06:11:43 +0000 |
commit | 591503c0ab7a4d6bf9f90b8bdf317ee5cfa13d03 (patch) | |
tree | 0fc9701b470d9c1a4d68f011fc6204b5f43035cc /sprintf.c | |
parent | 6aac0579d1920fe3be0a12cd2a0775036d576220 (diff) | |
download | bundler-591503c0ab7a4d6bf9f90b8bdf317ee5cfa13d03.tar.gz |
* sprintf.c (rb_str_format): ignore 0 flag for NaN and Inf.
[ruby-dev:33994]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r-- | sprintf.c | 21 |
1 files changed, 1 insertions, 20 deletions
@@ -766,7 +766,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt) if (isnan(fval) || isinf(fval)) { const char *expr; - if (isnan(fval)) { + if (isnan(fval)) { expr = "NaN"; } else { @@ -789,25 +789,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt) blen++; strncpy(&buf[blen], expr, strlen(expr)); } - else if (flags & FZERO) { - if (!isnan(fval) && fval < 0.0) { - buf[blen++] = '-'; - need--; - } - else if (flags & FPLUS) { - buf[blen++] = '+'; - need--; - } - else if (flags & FSPACE) { - blen++; - need--; - } - if ((need -= strlen(expr)) > 0) { - memset(buf+blen, '0', need); - blen += need; - } - strncpy(&buf[blen], expr, strlen(expr)); - } else { if (!isnan(fval) && fval < 0.0) buf[blen + need - strlen(expr) - 1] = '-'; |