Re: Error in division
| From: | Joe Stump | Date: | Wed, 11 Oct 2000 18:31:36 +0000 |
| Subject: | Re: Error in division | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19662@lists.php.net to get a copy of this message | ||
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------