[ 
https://issues.apache.org/jira/browse/GROOVY-10800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17715500#comment-17715500
 ] 

Eric Milles commented on GROOVY-10800:
--------------------------------------

[~paulk] Is there a way to rework this change to leave the AST token type as 
MOD and MOD_EQUAL?  It is the change of token type that is causing the most 
backwards compatibility issues for me wrt eclipse integration.  And any code 
that builds an AST for binary operators (that includes modulus/remainder) will 
be broken by this as well.

> The % operator returns unexpected results for negative numbers for BigIntegers
> ------------------------------------------------------------------------------
>
>                 Key: GROOVY-10800
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10800
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: breaking
>             Fix For: 5.0.0-alpha-1
>
>
> As a follow-up toĀ GROOVY-10786, the behavior of the % operator for BigInteger 
> is a little strange for negative numbers.
> {code}
> def nums = [-10, -10L, -10f, -10d, -10G, -10.0G]
> assert nums.collect{ it % 3 } == [-1, -1, -1f, -1d, 2G, -1.0G]
> {code}
> In our documentation, we call "%" the remainder operator as does Java, though 
> also like Java, the operator is often informally referred to as the "mod" 
> operator. 
> I suggest we change the BigInteger "%" operator to be the same as the other 
> numeric types, i.e. use remainder not mod.
> This has some ramifications which I'll bring up on the mailing list.



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

Reply via email to