You are here: Re: why does 69.99*100=6998? « PHP Programming Language « IT news, forums, messages
Re: why does 69.99*100=6998?

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация