summaryrefslogtreecommitdiff
path: root/sprintf.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:37:42 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-09-03 05:37:42 +0000
commit0f35b58a2fbae58a20979de77a3a642c42f41899 (patch)
treecab4099dba0fde8650c94226a1f9ce94549561c9 /sprintf.c
parentc9d1be6327640aa5bc01f8c6c8846e4e3fb31337 (diff)
* ruby.c (proc_options): should not alter origargv[].
* ruby.c (set_arg0): long strings for $0 dumped core. * ruby.c (set_arg0): use setprogtitle() if it's available. * io.c (rb_io_popen): accept integer flags as mode. * file.c (rb_find_file_ext): extension table can be supplied from outside. renamed. * eval.c (rb_f_require): replace rb_find_file_noext by rb_find_file_ext. * eval.c (rb_provided): should also check feature without extension. * numeric.c (flo_to_s): do not rely on decimal point to be '.' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c19
1 files changed, 1 insertions, 18 deletions
diff --git a/sprintf.c b/sprintf.c
index 5552bef..d3acb56 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -589,24 +589,7 @@ rb_f_sprintf(argc, argv)
int i, need = 6;
char fbuf[32];
- switch (TYPE(val)) {
- case T_FIXNUM:
- fval = (double)FIX2LONG(val);
- break;
- case T_FLOAT:
- fval = RFLOAT(val)->value;
- break;
- case T_BIGNUM:
- fval = rb_big2dbl(val);
- break;
- case T_STRING:
- fval = strtod(RSTRING(val)->ptr, 0);
- break;
- default:
- fval = NUM2DBL(val);
- break;
- }
-
+ fval = RFLOAT(rb_Float(val))->value;
fmt_setup(fbuf, *p, flags, width, prec);
need = 0;
if (*p != 'e' && *p != 'E') {