[ 
https://issues.apache.org/jira/browse/GROOVY-10786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Val E updated GROOVY-10786:
---------------------------
    Description: 
 

It looks like _org.codehaus.groovy.runtime.typehandling.BigDecimalMath_ does 
not override the default mod() method from the abstract 
_org.codehaus.groovy.runtime.typehandling.NumberMath_
{code:java}
new BigInteger(5)%2 //ERROR
new BigDecimal(5.5)%2 //ERROR
5.5%2 //ERROR
new Double(5.5)%2 //OK
new Integer(5)%2 //OK
5%2 //OK
{code}
 

_Caused by: java.lang.UnsupportedOperationException: Cannot use mod() on this 
number type: java.math.BigDecimal with value: 5.5_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.createUnsupportedException(NumberMath.java:316)_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.modImpl(NumberMath.java:296)_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.mod(NumberMath.java:88)_
    _at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.mod(DefaultGroovyMethods.java:16201)_

 

  was:
 

It looks like _org.codehaus.groovy.runtime.typehandling.BigDecimalMath_ does 
not override the default mod() method from the abstract 
_org.codehaus.groovy.runtime.typehandling.NumberMath_
{code:java}
new BigInteger(5)%2 //ERROR
new BigDecimal(5.5)%2 //ERROR
5.5%2 //ERROR
new Double(5.5)%2 //OK
new Integer(5)%2 //OK
5%2 //OK
{code}
 

_Caused by: java.lang.UnsupportedOperationException: Cannot use mod() on this 
number type: java.math.BigDecimal with value: 2.0_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.createUnsupportedException(NumberMath.java:316)_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.modImpl(NumberMath.java:296)_
    _at 
org.codehaus.groovy.runtime.typehandling.NumberMath.mod(NumberMath.java:88)_
    _at 
org.codehaus.groovy.runtime.DefaultGroovyMethods.mod(DefaultGroovyMethods.java:16201)_

 


> Cannot call modulo operator (%) on BigDecimal/BigInteger types
> --------------------------------------------------------------
>
>                 Key: GROOVY-10786
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10786
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Val E
>            Priority: Minor
>
>  
> It looks like _org.codehaus.groovy.runtime.typehandling.BigDecimalMath_ does 
> not override the default mod() method from the abstract 
> _org.codehaus.groovy.runtime.typehandling.NumberMath_
> {code:java}
> new BigInteger(5)%2 //ERROR
> new BigDecimal(5.5)%2 //ERROR
> 5.5%2 //ERROR
> new Double(5.5)%2 //OK
> new Integer(5)%2 //OK
> 5%2 //OK
> {code}
>  
> _Caused by: java.lang.UnsupportedOperationException: Cannot use mod() on this 
> number type: java.math.BigDecimal with value: 5.5_
>     _at 
> org.codehaus.groovy.runtime.typehandling.NumberMath.createUnsupportedException(NumberMath.java:316)_
>     _at 
> org.codehaus.groovy.runtime.typehandling.NumberMath.modImpl(NumberMath.java:296)_
>     _at 
> org.codehaus.groovy.runtime.typehandling.NumberMath.mod(NumberMath.java:88)_
>     _at 
> org.codehaus.groovy.runtime.DefaultGroovyMethods.mod(DefaultGroovyMethods.java:16201)_
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to