Commit 639b44f6 by Stephanie Gawroriski

### Make Integer.toString() just call Long.toString(); Correct and normalize...

```Make Integer.toString() just call Long.toString(); Correct and normalize values when printing Long.MIN_VALUE so
that it prints that value correctly.```
parent db4f11b0
 ... ... @@ -369,8 +369,21 @@ public final class Long if (__v == 0 && digit) break; // If our remainder is negative then this is likely the minimum // number, so this needs to be corrected and normalized else if (mod < 0) { // We can negate the number once we have removed the remainder // from it. For power of 2 radixes (2, 4, 8, 16, and 32) this // will be zero, but no other radix will have a value of zero. // By the next run our number will be smaller, so that it will // auto-normalize itself and print appropriately. __v = -(__v - mod); mod = -mod; } // Print character sb.append((char)(mod < 10 ? '0' + mod : 'a' + (mod - 10))); sb.append(Character.forDigit(mod, __r)); digit = true; // Stop printing characters ... ...
 ... ... @@ -42,9 +42,13 @@ public class TestIntegerParse this.secondary("lmax10", Long.parseLong("9223372036854775807", 10)); this.secondary("lmin10s", Long.toString(Long.MIN_VALUE, 10)); this.secondary("lmax10s", Long.toString(Long.MAX_VALUE, 10)); // Try to convert the minimum and maximum long values for every base for (int i = Character.MIN_RADIX; i <= Character.MAX_RADIX; i++) { this.secondary("lmin" + i + "s", Long.toString(Long.MIN_VALUE, i)); this.secondary("lmax" + i + "s", Long.toString(Long.MAX_VALUE, i)); } } }
 ... ... @@ -6,5 +6,74 @@ secondary-imin10s: string:-2147483648 secondary-imax10s: string:2147483647 secondary-lmin10: long:-9223372036854775808 secondary-lmax10: long:9223372036854775807 secondary-lmin2s: string:-1000000000000000000000000000000000000000000000000000000000000000 secondary-lmax2s: string:111111111111111111111111111111111111111111111111111111111111111 secondary-lmin3s: string:-2021110011022210012102010021220101220222 secondary-lmax3s: string:2021110011022210012102010021220101220221 secondary-lmin4s: string:-20000000000000000000000000000000 secondary-lmax4s: string:13333333333333333333333333333333 secondary-lmin5s: string:-1104332401304422434310311213 secondary-lmax5s: string:1104332401304422434310311212 secondary-lmin6s: string:-1540241003031030222122212 secondary-lmax6s: string:1540241003031030222122211 secondary-lmin7s: string:-22341010611245052052301 secondary-lmax7s: string:22341010611245052052300 secondary-lmin8s: string:-1000000000000000000000 secondary-lmax8s: string:777777777777777777777 secondary-lmin9s: string:-67404283172107811828 secondary-lmax9s: string:67404283172107811827 secondary-lmin10s: string:-9223372036854775808 secondary-lmax10s: string:9223372036854775807 secondary-lmin11s: string:-1728002635214590698 secondary-lmax11s: string:1728002635214590697 secondary-lmin12s: string:-41a792678515120368 secondary-lmax12s: string:41a792678515120367 secondary-lmin13s: string:-10b269549075433c38 secondary-lmax13s: string:10b269549075433c37 secondary-lmin14s: string:-4340724c6c71dc7a8 secondary-lmax14s: string:4340724c6c71dc7a7 secondary-lmin15s: string:-160e2ad3246366808 secondary-lmax15s: string:160e2ad3246366807 secondary-lmin16s: string:-8000000000000000 secondary-lmax16s: string:7fffffffffffffff secondary-lmin17s: string:-33d3d8307b214009 secondary-lmax17s: string:33d3d8307b214008 secondary-lmin18s: string:-16agh595df825fa8 secondary-lmax18s: string:16agh595df825fa7 secondary-lmin19s: string:-ba643dci0ffeehi secondary-lmax19s: string:ba643dci0ffeehh secondary-lmin20s: string:-5cbfjia3fh26ja8 secondary-lmax20s: string:5cbfjia3fh26ja7 secondary-lmin21s: string:-2heiciiie82dh98 secondary-lmax21s: string:2heiciiie82dh97 secondary-lmin22s: string:-1adaibb21dckfa8 secondary-lmax22s: string:1adaibb21dckfa7 secondary-lmin23s: string:-i6k448cf4192c3 secondary-lmax23s: string:i6k448cf4192c2 secondary-lmin24s: string:-acd772jnc9l0l8 secondary-lmax24s: string:acd772jnc9l0l7 secondary-lmin25s: string:-64ie1focnn5g78 secondary-lmax25s: string:64ie1focnn5g77 secondary-lmin26s: string:-3igoecjbmca688 secondary-lmax26s: string:3igoecjbmca687 secondary-lmin27s: string:-27c48l5b37oaoq secondary-lmax27s: string:27c48l5b37oaop secondary-lmin28s: string:-1bk39f3ah3dmq8 secondary-lmax28s: string:1bk39f3ah3dmq7 secondary-lmin29s: string:-q1se8f0m04isc secondary-lmax29s: string:q1se8f0m04isb secondary-lmin30s: string:-hajppbc1fc208 secondary-lmax30s: string:hajppbc1fc207 secondary-lmin31s: string:-bm03i95hia438 secondary-lmax31s: string:bm03i95hia437 secondary-lmin32s: string:-8000000000000 secondary-lmax32s: string:7vvvvvvvvvvvv secondary-lmin33s: string:-5hg4ck9jd4u38 secondary-lmax33s: string:5hg4ck9jd4u37 secondary-lmin34s: string:-3tdtk1v8j6tpq secondary-lmax34s: string:3tdtk1v8j6tpp secondary-lmin35s: string:-2pijmikexrxp8 secondary-lmax35s: string:2pijmikexrxp7 secondary-lmin36s: string:-1y2p0ij32e8e8 secondary-lmax36s: string:1y2p0ij32e8e7
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!