diff options
author | Sverker Eriksson <[email protected]> | 2015-03-27 17:05:08 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2015-03-27 17:05:08 +0100 |
commit | cd80b9205944583ce5a2b7db3f5ec28e25a527a1 (patch) | |
tree | a59be55645ed8b7b1e8a050e03291203a56633e8 /erts/emulator/beam | |
parent | be89d435fbde795bcdc62b99529c5f77d42c6b62 (diff) | |
parent | cbceea683c9f718bc6f0140c2402a7f74455ea14 (diff) | |
download | otp-cd80b9205944583ce5a2b7db3f5ec28e25a527a1.tar.gz otp-cd80b9205944583ce5a2b7db3f5ec28e25a527a1.tar.bz2 otp-cd80b9205944583ce5a2b7db3f5ec28e25a527a1.zip |
Merge branch 'maint'
Conflicts:
lib/stdlib/src/stdlib.appup.src
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/bif.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c index cc20ec7440..022150da55 100644 --- a/erts/emulator/beam/bif.c +++ b/erts/emulator/beam/bif.c @@ -2930,7 +2930,7 @@ static int do_list_to_integer(Process *p, Eterm orig_list, Uint ui = 0; int skip = 0; int neg = 0; - int n = 0; + Sint n = 0; int m; int lg2; Eterm res; @@ -3010,7 +3010,9 @@ static int do_list_to_integer(Process *p, Eterm orig_list, else i = (Sint)ui; res = make_small(i); } else { - lg2 = (n+1)*230/69+1; + /* Convert from log10 to log2 by multiplying with 1/log10(2)=3.3219 + which we round up to (3 + 1/3) */ + lg2 = (n+1)*3 + (n+1)/3 + 1; m = (lg2+D_EXP-1)/D_EXP; /* number of digits */ m = BIG_NEED_SIZE(m); /* number of words + thing */ |