Hello Withers:

Small correction and I think it is obvious.

#set ($pc = ($part * $maxwidth) / $total) 

Should be replaced by 

#set ($nw = ($part * $maxwidth) / $total)

Regards,
Mathi.

-----Original Message-----
From: Withers John Z [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 03, 2006 6:45 PM
To: Velocity Users List
Subject: RE: Double-Calculations in Velocity

Hmmm.  Could this be something as simple as integer arithmetic?  Have
you tried:

#set ($pc = ($part * $maxwidth) / $total)

-----Original Message-----
From: Dominik Bruhn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 03, 2006 8:07 AM
To: velocity-user@jakarta.apache.org
Subject: Double-Calculations in Velocity

Hy,
I wrote this macro:
=====
#macro ( pollbar $total $part $maxwidth $color )
        #set($pc=$part/$total)
        #set ($nw=$pc*$maxwidth)
        <img src="/images/poll/color${color}.gif" width="$nw" height="5"
xxx="$pc" />
#end
=====

For some values this works but for the most $nw is 0 afterwards because
$pc is 
0. Is this my mistake or is velocity unable to calc in double or float?

Thanks
TO

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to