You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by sri dhar <sr...@rediffmail.com> on 2004/11/22 11:33:44 UTC

How to Round of Double or float Value to 2 Decimal place

Hi ,
 Can anybody tell me that how to round off a decimal value into two decimal places in velocity.
 For example var x=7.77777888;
 i want to have a round off value of 7.78.

Thanks in Advance
Sridhar

Re: How to Round of Double or float Value to 2 Decimal place

Posted by Simon Christian <si...@stoutstick.com>.
This is for the users list really.

That said, you can easily do this using the MathTool from Velocity 
Tools, see:

http://jakarta.apache.org/velocity/tools/generic/MathTool.html#roundTo()

- simon

sri dhar wrote:
> Hi ,
>  Can anybody tell me that how to round off a decimal value into two decimal places in velocity.
>  For example var x=7.77777888;
>  i want to have a round off value of 7.78.
> 
> Thanks in Advance
> Sridhar


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


Re: How to Round of Double or float Value to 2 Decimal place

Posted by Simon Christian <si...@stoutstick.com>.
This is for the users list really.

That said, you can easily do this using the MathTool from Velocity 
Tools, see:

http://jakarta.apache.org/velocity/tools/generic/MathTool.html#roundTo()

- simon

sri dhar wrote:
> Hi ,
>  Can anybody tell me that how to round off a decimal value into two decimal places in velocity.
>  For example var x=7.77777888;
>  i want to have a round off value of 7.78.
> 
> Thanks in Advance
> Sridhar


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