diff options
-rw-r--r-- | erts/emulator/sys/common/erl_sys_common_misc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/erts/emulator/sys/common/erl_sys_common_misc.c b/erts/emulator/sys/common/erl_sys_common_misc.c index 826307c077..41a6fcb7e1 100644 --- a/erts/emulator/sys/common/erl_sys_common_misc.c +++ b/erts/emulator/sys/common/erl_sys_common_misc.c @@ -217,14 +217,16 @@ sys_double_to_chars_fast(double f, char *buffer, int buffer_size, int decimals, } do { + Uint64 n; if (!frac_part) { do { *p++ = '0'; } while (--decimals); break; } - *p++ = (char)((frac_part % 10) + '0'); - frac_part /= 10; + n = frac_part / 10; + *p++ = (char)((frac_part - n*10) + '0'); + frac_part = n; } while (--decimals); *p++ = '.'; @@ -236,9 +238,10 @@ sys_double_to_chars_fast(double f, char *buffer, int buffer_size, int decimals, *p++ = '0'; } else { do { - *p++ = (char)((int_part % 10) + '0'); - int_part /= 10; - }while (int_part); + Uint64 n = int_part / 10; + *p++ = (char)((int_part - n*10) + '0'); + int_part = n; + } while (int_part); } if (neg) *p++ = '-'; |