zveroboy (1) [Avatar] Offline
I haven't found this particular errata on the forums, so I apologize in advance if someone had posted it already, or it is not an errata at all:
anyway in the table 3.10 on page 89 it says that 2**31 produces an Integer. However, since integer is a signed 32 bit number the maximum integer is 2^31-1, which is (0x7FFF FFFF). Since the power operator promotes type as necessary, it should promote 2**31 to Long

I ran the following code:
result = 2**31
println "2**31 = " + result
println " result's class is: " + result.getClass()

and this is the result I got (with groovy 1.5.6):

2**31 = 2147483648
result's class is: class java.lang.Long

Message was edited by: