diff options
author | Serge Aleynikov <[email protected]> | 2013-01-25 15:58:41 -0500 |
---|---|---|
committer | Serge Aleynikov <[email protected]> | 2013-02-07 10:53:55 -0500 |
commit | ddf8881308b27f308aa456bef3e4833bc0383413 (patch) | |
tree | d56f01a86d5ef3b2c2751935df3d02b5bbcaafb6 /erts/emulator/beam | |
parent | 28dce0b9ea79f8635a3253da7f4d3c6e49cb48b8 (diff) | |
download | otp-ddf8881308b27f308aa456bef3e4833bc0383413.tar.gz otp-ddf8881308b27f308aa456bef3e4833bc0383413.tar.bz2 otp-ddf8881308b27f308aa456bef3e4833bc0383413.zip |
float_to_list/2 changed rounding and cosmetic cleanup
Changed rouding to round half-way up instead of down.
Cosmetic cleanup and error handling of additional edge cases.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/bif.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index 46f76624a5..df084e1185 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2963,15 +2963,14 @@ BIF_RETTYPE float_to_list_2(BIF_ALIST_2) Eterm* tp = tuple_val(arg); if (*tp == arity_two && is_small(tp[2])) { decimals = signed_val(tp[2]); - if (decimals > 0 && decimals < sizeof(fbuf) - 6 /* "X." ++ "e+YY" */) - switch (tp[1]) { - case am_decimals: - fmt_type = FMT_FIXED; - continue; - case am_scientific: - fmt_type = FMT_SCIENTIFIC; - continue; - } + switch (tp[1]) { + case am_decimals: + fmt_type = FMT_FIXED; + continue; + case am_scientific: + fmt_type = FMT_SCIENTIFIC; + continue; + } } } goto badarg; |