summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-04 18:10:41 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-14 19:23:25 +0900
commit5ccb625fbbd1e774636a9fdbe0bf1c3d38e085d5 (patch)
tree23a8d2af84fed1b1f080953a5a1eab0b73c3ea8e /numeric.c
parentee8bcbf40578c0c4e60063a3e0c86439a6891131 (diff)
downloadruby-5ccb625fbbd1e774636a9fdbe0bf1c3d38e085d5.tar.gz
Use `roomof` macro for rounding up divisions
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 4f927f00fb..8607d69794 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1055,7 +1055,7 @@ flo_to_s(VALUE flt)
{
enum {decimal_mant = DBL_MANT_DIG-DBL_DIG};
enum {float_dig = DBL_DIG+1};
- char buf[float_dig + (decimal_mant + CHAR_BIT - 1) / CHAR_BIT + 10];
+ char buf[float_dig + roomof(decimal_mant, CHAR_BIT) + 10];
double value = RFLOAT_VALUE(flt);
VALUE s;
char *p, *e;