summaryrefslogtreecommitdiffhomepage
path: root/src/fmt_fp.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-07-26 10:57:42 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-07-26 10:57:42 +0900
commit642497fe1950f28b3d769b0750ef59a73e4ed700 (patch)
treee8a075e4d96749f72b910023f180124f5b096db4 /src/fmt_fp.c
parent966aa476d1c3ee03617d6acbce8ba1ebe327ddd4 (diff)
downloadmruby-642497fe1950f28b3d769b0750ef59a73e4ed700.tar.gz
mruby-642497fe1950f28b3d769b0750ef59a73e4ed700.zip
fmt_fp.c: add implicit cast from `mrb_float` to `int8_t`.
Diffstat (limited to 'src/fmt_fp.c')
-rw-r--r--src/fmt_fp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fmt_fp.c b/src/fmt_fp.c
index bac62b88a..bcb9ccc24 100644
--- a/src/fmt_fp.c
+++ b/src/fmt_fp.c
@@ -276,7 +276,7 @@ mrb_format_float(mrb_float f, char *buf, size_t buf_size, char fmt, int prec, ch
// Print the digits of the mantissa
for (int i = 0; i < num_digits; ++i, --dec) {
- int8_t d = f;
+ int8_t d = (int8_t)((int)f)%10;
*s++ = '0' + d;
if (dec == 0 && (prec > 0 || alt_form)) {
*s++ = '.';