Re: .98 cents instead of .99
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Mon, 30 Jan 2006 14:40:39 GMT
On 30 Jan 2006 05:42:42 -0800, "Googmeister" <googmeister@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
>
>Try (int) (Math.round(100 * (amountPaid - totalCost)))
>
>Or better use, store the amount as an int/long in pennies
>or use BigDecimal to avoid floating point precision issues.
for more discussion of the problem of currency calculation see
http://mindprod.com/jgloss/currency.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- .98 cents instead of .99
- From: joshdalrymple2000
- Re: .98 cents instead of .99
- From: Googmeister
- .98 cents instead of .99
- Prev by Date: Re: .98 cents instead of .99
- Next by Date: JWSDP 2.0...Install fails...
- Previous by thread: Re: .98 cents instead of .99
- Next by thread: sorry .09 instead of .08
- Index(es):
Relevant Pages
|