I do not know of a single command that will do that, though the
http://uk.php.net/round command will work round($number, 2);
On 02/08/06, Gordon Stewart <[EMAIL PROTECTED]> wrote:
>
> Hi there, I've come accross a situation, where I am subracting amounts
> from each other - it SHOULD come to whole cents, but im getting
> strange results :-
>
> CODE :-
>
> echo "MIN MAX '$min'$max'<BR>\n";
> if($max-$min<0.02){
> echo ($max-$min)."<BR>\n";
>
> (Basically i want to know if its less than 2 cents difference)
>
> What I get on the screen is :-
>
> MIN MAX '5864.51'5864.53'
> 0.0199999999995
>
> Now - according tomy maths - 5864.51 subtract 5864.53 should be two cents..
> not 1.999999995 cents..
>
> Is there a single command at the top of my script to 'round' the
> figures to the nearest two decimal places / cent? (or after each
> calculation ?)
>
> --
> G
> NZ community groups - [EMAIL PROTECTED]
> NZ-Website space offered.
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/