Posted by larry on 02/02/08 03:53
On Feb 1, 8:12 am, The Natural Philosopher <a...@b.c> wrote:
>
> I put in some checks:
>
> echo $sale_price gives me 69.99
> Echo ($sale_price*100) gives me 6999
>
> But printf ("%d",$sale_price*100);
>
When dealing with financial data is usually good to either truncate or
round the values before doing much with them. Those hidden decimal
places will get you - though sometimes you have to work three digits
out (USPS mailing calculations go deeper).
Family data and accurate money are always two challenges for a
programmer.
[Back to original message]
|