RV: [PHP] Error in division
| From: | jgomez | Date: | Wed, 11 Oct 2000 18:34:47 +0000 |
| Subject: | RV: [PHP] Error in division | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-19667@lists.php.net to get a copy of this message | ||
Thank you Joe but i think taht this is not the problem.
If do the echo without any format the result is different too (wtih more
decimals).
Thanks.
----- Original Message -----
From: Joe Stump <joe@earth.care2.com>
To: jgomez <jgomez@autocity.com>
Cc: <php-general@lists.php.net>
Sent: Wednesday, October 11, 2000 8:31 PM
Subject: Re: [PHP] Error in division
> try number_format(($precio/$euro),2);
>
> --Joe
>
> On Wed, Oct 11, 2000 at 08:21:15PM +0200, jgomez wrote:
> > I have a problem with a division.The result are diferent when i reload
my page.
> > Here is the code:
> >
> > function convierte_euro($precio)
> > {
> > $euro=166.386;
> > $aux=number_format($precio/$euro,2,",",".");
> > return $aux;
> > }
> >
> > <?echo convierte_euro($saca_oferta->f("precio"))?>
> >
> >
> > Sometimes the result is 30,12 and others 30,05 for a $precio=5000.00
> >
> > Thank you.
> /*****************************\
> * Joe Stump *
> * www.Care2.com *
> * Office: 650.328.0198 *
> * Extension: 122 *
> \*****************************/
> http://www.miester.org/Joe/Stump/Joe_Stump_resume.html
>
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.12
> GB/E/IT d- s++:++ a? C++++ UL++$ P+ L+++$ E----! W+++$
> N+@ o? K? w---! O-@ M+@ V-! P(++) PE(+) Y+@ PGP+++@ t+@
> 5? R-! tv@ b+ DI++@ D(++++) G++@ e+@ h@ r+! z(+++++**)!
> ------END GEEK CODE BLOCK------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>