velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Attila Szegedi" <szege...@freemail.hu>
Subject Re: comparing monetary value
Date Wed, 16 Oct 2002 13:25:55 GMT
----- Original Message -----
From: "Anders Lindback" <anders@igiro.se>
To: <velocity-user@jakarta.apache.org>
Sent: 2002. október 16. 15:04
Subject: Re: comparing monetary value


>
> For example you can get a situation where 2 + 2 != 4 when using
> with floating point numbers. (2+2 may becomes 3.9999999999999 instead. )
>

When it comes to monetary values, floating-point types are indeed
inappropriate. In Java, dealing with monetary values (and many other
real-world values that involve a fractional part) is *really* best done with
BigDecimals.

Attila.


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


Mime
View raw message