If you disable the compiler’s primitive optimization, then integer literals 
will be BigInteger.

From: Paul King <pa...@asert.com.au>
Sent: Monday, December 9, 2019 11:01 AM
To: Groovy_Developers <dev@groovy.apache.org>
Subject: Re: Groovy multiplication

Meta note: This thread is related to the usage of Groovy and best belongs on 
the users mailing list where it will gain more eyeballs and also more likely to 
be found in the future by other users in the same scenario. The dev list is for 
aspects relating to the development of the language itself.

But to answer the current question, Integer literals aren't made BigInteger by 
default but if either side of a multiplication is a BigInteger, the answer will 
be BigInteger, so you get the correct answer in the posed problem with e.g.: 
86400G*1000*30

Cheers, Paul.


On Tue, Dec 10, 2019 at 2:48 AM Angelo Schneider 
<angelo.schnei...@oomentor.de<mailto:angelo.schnei...@oomentor.de>> wrote:
Would that not be handled by BigInteger?

I assumed integer literals are treated as BigInter just like float/double 
literals are treated as BigDecimals.

Greetings
Angelo

Am 09.12.2019 um 00:51 schrieb Edmond Kemokai 
<ekemo...@gmail.com<mailto:ekemo...@gmail.com>>:


I'd read up on the MAX_VALUE doc but didn't see any mention of this behavior... 
Thanks guys!!


Reply via email to