summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-05-25 13:31:41 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-05-25 13:31:41 +0900
commitafbc199ed3b0820f156681548bf91290a2be48f4 (patch)
tree66841af116e50d1dc97bb2d54c198c89c7dbb631 /src
parent5ed3a3475e5cf115cb65c8c0b1b8e37aa303996b (diff)
downloadmruby-afbc199ed3b0820f156681548bf91290a2be48f4.tar.gz
mruby-afbc199ed3b0820f156681548bf91290a2be48f4.zip
fmt_fp.c: use constant that depends on `mrb_float` size.
Diffstat (limited to 'src')
-rw-r--r--src/fmt_fp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fmt_fp.c b/src/fmt_fp.c
index 2bd5dd1c4..807debe11 100644
--- a/src/fmt_fp.c
+++ b/src/fmt_fp.c
@@ -201,8 +201,8 @@ mrb_format_float(mrb_float f, char *buf, size_t buf_size, char fmt, int prec, ch
e_sign = e_sign_char;
dec = 0;
- if (prec > (buf_remaining - 6)) {
- prec = buf_remaining - 6;
+ if (prec > (buf_remaining - FLT_MIN_BUF_SIZE)) {
+ prec = buf_remaining - FLT_MIN_BUF_SIZE;
if (fmt == 'g') {
prec++;
}