velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Harrison <peter.harri...@nothingbutnet.co.nz>
Subject Re: How to compare float number
Date Tue, 03 May 2005 20:52:43 GMT
On Wednesday 04 May 2005 03:47, jill han wrote:
> I tried to compare a  float number to a certain value like:
> #set($afloat=$floatObject.float)
> #set($count = 0)
> #if ($afloat >= 4)
> 	#set($count = $count + 1)
> #end
>
> But it was always evaluated as false, $count is always 0.

Velocity doesn't deal with floats. I think velocity tools might have a class 
for float math which you can add to the context for doing math.

We developed our own math class along with date, comparitor and other classes 
for dealing with these types of thing. I can probably post a link tot he code 
at some point.


-- 
Peter Harrison
Managing Director
Nothing But Net Limited

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message