It's my old friend:

https://issues.apache.org/jira/browse/GROOVY-7385

assert 100000000000000010G > Long.MAX_VALUE

-- Sean


On 9/10/15 1:15 PM, Sean Gilligan wrote:
> A one line assert which PASSES and shouldn't:
>
> assert 100000000000000016 == (({ BigDecimal it -> it})(100000000000000010))
>
>
> More detail (all asserts pass):
>
> def val = 100000000000000010
> assert val.class == Long
> def closure = { BigDecimal it -> it}
> def bdVal = closure(val)
> assert bdVal.class == BigDecimal
> assert bdVal == 100000000000000016
> def bdCastVal = (BigDecimal) val
> assert bdCastVal.class == BigDecimal
> assert bdCastVal == 100000000000000010
>
> So, converting to BigDecimal with a cast or with an `as` seems to work.
> But having Groovy do it automatically for a function or closure
> parameter fails.
>
> Am I missing something? Is this a known issue?
>
> Thanks,
>
> Sean
>
>

Reply via email to