do this all with sprintf or do I then need to convert it to a
> string
> > and chop off what I don't want?
> >
> > -Original Message-
> > From: Gerry Danen [mailto:[EMAIL PROTECTED]
> > Sent: Monday, January 09, 2006 3:35 PM
> > To: php-general@lists.p
et
> Subject: Re: [PHP] Floating numbers truncating to two digits without
> rounding
>
> Mark,
>
> Why not use sprintf() with an arbitrary large number of decimals and then
> discard all but the 2 you want. I.e., format with 10 decimals and then drop
> the last 8.
&
Thanks for the info
-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Monday, January 09, 2006 3:26 PM
To: php-general@lists.php.net; Mark Steudel
Subject: Re: [PHP] Floating numbers truncating to two digits without
rounding
>I am calculating things like tax and want
Try something like:
floor($value * 100)/100;
--
Anas Mughal
On 1/9/06, Mark Steudel <[EMAIL PROTECTED]> wrote:
>
> I am calculating things like tax and want to format them so they only have
> 2
> digits past the decimal point. I've been using sprintf but just noticed
> that
> it tends to rou
Mark,
Why not use sprintf() with an arbitrary large number of decimals and then
discard all but the 2 you want. I.e., format with 10 decimals and then drop
the last 8.
On 1/9/06, Mark Steudel <[EMAIL PROTECTED]> wrote:
>
> I am calculating things like tax and want to format them so they only have
I am calculating things like tax and want to format them so they only have 2
digits past the decimal point. I've been using sprintf but just noticed that
it tends to round up. I want the same functionlity without rounding.
Mark:
Rounding?
You can try round(), such as:
But, as you can see, t
On Monday 09 January 2006 03:20 pm, Mark Steudel wrote:
> I am calculating things like tax and want to format them so they only have
> 2 digits past the decimal point. I've been using sprintf but just noticed
> that it tends to round up. I want the same functionlity without rounding.
>
> Thanks
Yo
7 matches
Mail list logo