Re: [PHP] =.='' what wrong ? just simple code, however error.
- From: ad@xxxxxxxx ("LKSunny")
- Date: Thu, 1 Jan 2009 00:15:47 +0800
i need accuracy, how to ?
Thank You.
"Per Jessen" <per@xxxxxxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:gjg4fk$58p$1@xxxxxxxxxxxxxxxxxxx
LKSunny wrote:
<?
$credithold = 100;
for($i=1;$i<=1000;$i++){
$credithold -= 0.1;
echo "$credithold<br />";
}
//i don't know why, when run this code, on 91.3 after expect is 91.2,
however......91.200000000001
//who can help me ? and tell me why ?
It's a floating point rounding error. If you don't need the accuracy,
just round it to what you need.
/Per Jessen, Zurich
.
- Follow-Ups:
- Re: [PHP] =.='' what wrong ? just simple code, however error.
- From: "Daniel Brown"
- Re: [PHP] =.='' what wrong ? just simple code, however error.
- From: Micah Gersten
- Re: [PHP] =.='' what wrong ? just simple code, however error.
- References:
- =.='' what wrong ? just simple code, however error.
- From: "LKSunny"
- Re: [PHP] =.='' what wrong ? just simple code, however error.
- From: Per Jessen
- =.='' what wrong ? just simple code, however error.
- Prev by Date: Re: [PHP] Re: Webhotel structure
- Next by Date: Re: [PHP] Encryption/decryption of PHP data
- Previous by thread: Re: [PHP] =.='' what wrong ? just simple code, however error.
- Next by thread: Re: [PHP] =.='' what wrong ? just simple code, however error.
- Index(es):
Relevant Pages
|