velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai <>
Subject Re: Problem with decimal in most recent snapshot
Date Tue, 12 Apr 2005 00:48:37 GMT
Hi JohnE,

> Basically I am getting a decimal when I should be getting an int with the following code
I use in production already:
> #set ($colSize = ($jpPop.size() / 3) - 1)
> when colSize is printed out it gives a number like 6.3333333 when all values in this
calculation are integer.   I should get 6 as an int according to the documentation.

The User Guide says:
"When a division operation is performed between two integers, the
result will be an integer."

The MathUtils#divide javadoc says:
"Integer-types will be returned as Integer-type if and only if the
modulo of the two numbers is 0."

They can't both be right.  If you consider backward compatibility, the
user guide should be correct.  But my mind says the javadoc is more
convenient...  Will?

> From what I can see there is no way to make a float an integer either.  This too I would
imagine could be a problem.

For now, you can use the MathTool.

> I was hoping to push this into production tonight but it will have to wait till I can
figure out what to do with the potential affects this could have to the whole system
gets resolved.

Which, I guess, makes a good reason for the user guide to be right.

Best regards,
-- Shinobu

Shinobu Kawai <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message