Re: Floating numbers truncating to two digits without rounding

From: Date: Tue, 10 Jan 2006 04:01:51 +0000
Subject: Re: Floating numbers truncating to two digits without rounding
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228389@lists.php.net to get a copy of this message
Try something like: floor($value * 100)/100; -- Anas Mughal On 1/9/06, Mark Steudel <mark@netriver.net> 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 > > -- Anas Mughal

« previous php.general (#228389) next »