BigIntegerand any other integral type result in
BigInteger".If I understand the table correctly it show that int and BigInteger result in BigInteger.
Iíve been struggling with types in math operations in Groovy. I think there is an error in the documentation?
It says that int and BigDecimal result in double, but it doesnít, it results in BigDecimal instead. It appears this holds for byte, char, short, and long as well.
assert (15.0 + 1).class == BigDecimal
Are there other errors in that table? It seems soÖ because byte + short is a byte and not an int as mentioned in that table:
assert ((byte)1 + (short)1).class == Byte
I would put in a PR to fix up that doc but Iím not sure I understand how it all works. Normally when I do maths I try to stick all to primitive types or all to BigDecimal types. Today Iím trying to make sure I donít accidentally go from BigDecimals to float/double.
Software Engineer III Contractor - IT Software Development | Windstream
600 Willowbrook Office Park, Rochester, NY 14450
This email message and any attachments are for the sole use of the intended recipient(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message and any attachments.