Home > Cannot Use > Cannot Use Mod On This Number Type Java.math.bigdecimal

Cannot Use Mod On This Number Type Java.math.bigdecimal

Why do the cars die after removing jumper cables How to remove text field value after comma using apex code? Time to be one myself ;) bye blackdrag -- Jochen "blackdrag" Theodorou Groovy Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/--------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email Simon Chappell Reply | Join Now I want to fix my crash I want to help others java.lang.UnsupportedOperationException: Cannot use mod() on this number type: java.math.BigDecimal with value: 5 Stack Overflow | Neill | 2 Automated exception search integrated into your IDE Test Samebug Integration for IntelliJ IDEA Root Cause Analysis java.lang.UnsupportedOperationException Cannot use mod() on this number type: java.math.BigDecimal with value: 5 at Script1.hailstone() Unknown http://homeshareware.com/cannot-use/cannot-use-mod-on-this-number-type-java-lang-integer.html

Hide Permalink Paul King added a comment - 23/Jun/15 05:41 closing as a duplicate of GROOVY-5185. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed we did not see the issues listed above). My reading is the same (actually that prefix unary operators are all the same and higher than the binaries - postfix unaries are highest). http://stackoverflow.com/questions/29158399/groovy-error-with-method-mod-or

Show Jochen Theodorou added a comment - 18/Mar/11 15:59 I guess that is actually a bug in our grammar and the ANTLR AST build from the rules. Java - Groovy tags/keywords bigdecimal, bigdecimal, biginteger, biginteger, cannot, double, float, integer, math, number, number, numbermath, shift, unsupportedoperationexception, unsupportedoperationexception The Groovy NumberMath.java source code /* * Copyright 2003-2007 the original author And, I'm on the list to review GinA as well. you expected value /= 10 to do integer maths?

Automated exception search integrated into your IDE Test Samebug Integration for IntelliJ IDEA Root Cause Analysis java.lang.UnsupportedOperationException Cannot use mod() on this number type: java.math.BigDecimal with value: 5 at Script1.hailstone() Unknown Tired of useless tips? There this was done: expression[int lc_stmt] : + (LPAREN typeSpec[true] RPAREN expression[lc_stmt])=> + lp:LPAREN^ {#lp.setType(TYPECAST);} typeSpec[true] RPAREN! + expression[lc_stmt] + | (LPAREN nls IDENT (COMMA nls IDENT)* RPAREN ASSIGN) => m:multipleAssignment[lc_stmt] We actually noticed the problem when upgrading a Grails application from 1.2.0 to 1.3.7 (i.e.

Otherwise, * the result is BigDecimal */ public static NumberMath getMath(Number left, Number right) { if (isFloatingPoint(left) || isFloatingPoint(right)) { return FloatingPointMath.INSTANCE; } if (isBigDecimal(left) || isBigDecimal(right)) { return BigDecimalMath.INSTANCE; } Jim Jeff Adamson wrote: Is there supposed to be a difference in operation precedence in groovy from java? http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#4990 I don't know if there is a JIRA for this yet or not, but clearly one is needed.  An example that is valid as both Java and Groovy would help Free forum by Nabble Edit this page Groovy › Groovy Users Search everywhere only in this topic Advanced Search Groovy operation precedence different from java? ‹ Previous Topic Next Topic ›

current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. On 1/6/09, Fred Janon <[hidden email]> wrote: > I am using GroovyConsole 1.5.6 > > Is there a way to get the div on Integer or Long instead of BigDecimal? > For the left operand (shift value) also require an integral * type, but do NOT promote from Integer to Long. Need to change cash to cashier's check without bank account (Just arrived to the US) Query for highest version more hot questions question feed default about us tour help blog chat

I will try and recreate the bug, but I don't have > it now. http://groovy.329449.n5.nabble.com/Integer-Long-div-td363649.html How do you expect people to adopt Groovy if fundamental mathematical expressions don't work?!? The error message was also a bit confusing to me... Log in with Facebook fork download copy esc to close def l = []def sum = 0G1.upto(10){ sum += it l << sum println "$sum : ${getPrimeFactors(sum)}"}ArrayList getPrimeFactors(def num){ def x

asked 1 year ago viewed 1439 times active 1 year ago Upcoming Events 2016 Community Moderator Election ends Nov 22 Related 676Scala vs. navigate here Browse other questions tagged groovy sequence or ask your own question. gmail ! This site uses cookies, as explained in our cookie policy.

This is a bit funny, since that part should originate from the original java grammar we used and that means that it was probably wrong in there already. I am using GroovyConsole 1.5.6Is there a way to get the div on Integer or Long instead of BigDecimal?15 % (15/3)results inException thrown: java.lang.UnsupportedOperationException: Cannot use mod() on this number type: Ballpark salary equivalent today of "healthcare benefits" in the US? http://homeshareware.com/cannot-use/cannot-use-the-connection-type.html There this was done: expression[ int lc_stmt] : + (LPAREN typeSpec[ true ] RPAREN expression[lc_stmt])=> + lp:LPAREN^ {#lp.setType(TYPECAST);} typeSpec[ true ] RPAREN! + expression[lc_stmt] + | (LPAREN nls IDENT (COMMA nls

for (X)1+1 this means 1+1 is the expression and the cast will be then done on the result of the cast. a bit more research reveals a bug fix for GROOVY-2605 that may have caused the problem. Clojure154Groovy String to int1grails 1.3.1 Error executing script GenerateViews:28What is Inject Method in Groovy?1I need Subsequence of a particular length, in Groovy0groovy Command Expression howto do nested expression?0Groovy dynamic method invocation

Sign up Sign in Can't sign in?

public class TestFoo { @org.junit.Test public void testCastWithMod() { long result = (long)10.7 % 3L; System.out.println(result); org.junit.Assert.assertEquals(result, 1L); } } --Jeff On Wed, Sep 15, 2010 at 12:22 PM, Jim White Throw an exception if the right operand * (shift distance) is not an integral type. Unfortunately no-one on > this list is likely to buy a copy :-) congratulations... Jim Jeff Adamson wrote: > Is there supposed to be a difference in operation precedence in groovy > from java? > > Given the expression `(long)(107L / 10L) % 3L` groovy

How to make my logo color look the same in Web & Print? Show Jonathan Pearlin added a comment - 18/Mar/11 22:31 I should add that we also tested the behavior in 1.6.x and we got the expected results (i.e. Is there supposed to be a difference in operation precedence in groovy from java?Given the expression `(long)(107L / 10L) % 3L` groovy throws "Cannot use mod() on this number type: java.math.BigDecimal with this contact form Here is a test case which passes when compiled+run as java.  But fails with an exception when pasted into groovyConsole.

Now the big question is of course how to enable both Hide Permalink Jochen Theodorou added a comment - 19/Mar/11 06:06 the revision is 14727 Show Jochen Theodorou added a comment Now the big question is of course how to enable both Show Jochen Theodorou added a comment - 19/Mar/11 06:04 ok, this is interesting...

Back to Top