[
https://issues.apache.org/jira/browse/GROOVY-7129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15447186#comment-15447186
]
Paul King commented on GROOVY-7129:
-----------------------------------
Using Short types yields the same behavior as the Number cases above:
{code}
Short s = 2
assert [s ** 1, s ** 31, s ** 64]*.class == [Integer, Long, Double]
assert [2 ** 1, 2 ** 31, 2 ** 64]*.class == [Integer, BigInteger, BigInteger]
assert [2 ** 1.0, 2 ** 31.0, 2 ** 64.0]*.class == [Integer, Long, Double]
assert [2L ** 1, 2L ** 31, 2L ** 64]*.class == [Long, Long, BigInteger]
assert [2L ** 1.0, 2L ** 31.0, 2L ** 64.0]*.class == [Integer, Long, Double]
{code}
> Exponent integer classes differ
> -------------------------------
>
> Key: GROOVY-7129
> URL: https://issues.apache.org/jira/browse/GROOVY-7129
> Project: Groovy
> Issue Type: Bug
> Environment: Mac OSX 10.10, Groovy 2.3.7, JVM 1.8.0_20
> Reporter: Rick Briganti
> Priority: Minor
> Attachments: FooTest.groovy
>
>
> Exponent math returns a different class type for the value compared to using
> .getClass() on the normal number.
> This appears to occur when raising 2 to exponents between 31 and 62.
> {noformat}
> groovy:000> 2147483648.getClass()
> ===> class java.lang.Long
> groovy:000> (2 ** 31).getClass()
> ===> class java.math.BigInteger
> {noformat}
> Test case attached.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)