PHP Floating point precision
Floating point precision
It is typical that simple decimal fractions like 0.1
or
0.7
cannot be converted into their internal binary
counterparts without a small loss of precision. This can lead to
confusing
results: for example, floor((0.1+0.7)*10)
will usually
return 7
instead of the expected 8
,
since the internal representation will be something like
7.9
.
This is due to the fact that it is impossible to express some
fractions in decimal notation with a finite number of digits. For
instance,
1/3
in decimal form becomes
0.3
.
So never trust floating number results to the last digit, and never
compare
floating point numbers for equality. If higher precision is
necessary,
the arbitrary
precision math functions
and
gmp
functions are available.
Ïà¹ØÎĵµ£º
ͨѶ¼ÒѾ´óÖÂÍê³ÉÁË£¬µ«Èç¹û¼Ç¼Êý¶àʱ£¬²éÕÒÆðÀ´ºÜ²»·½±ã£¬Èç¹û¼ÓÒ»¸öËÑË÷¹¦ÄܾͺÃÁË¡£½ñÌìÎÒÃǾÍÀ´ÖÆ×÷Ò»¸öËÑË÷¹¦ÄÜ
ÔÚIndex.phpºÏÊʵĵط½¼ÓÈëËÑË÷¿ò
<!---ËÑË÷¿ò--->
<!--ÕâÀïµÄËùÓÐÖµÇ°Ãæ¼Óǰ׺“S_”ÒÔÇø·Ö-->
<form id="form1" name="form1" method="post" action="Search.php ......
×î½üÓÐÈËÔÚÕбêÒª×ö¸öÏñ£ºwww.webjianzhi.com ÕâÑùµÄÈ˲ÅÕ¾£¬³õ¿´£¬Õâ¸öÍøÂç¼æÖ°Íø£¬½çÃæ»¹ÊDZȽÏÇåÎúµÄ¡£
ÕûÌå·ÖÎöÁËһϣ¬Ò»¸öÐÂÎÅÎÄÕ·¢²¼ÏµÍ³£¬Õâ¸ö²»ÊǺÜÄÑ£¬ÁíÒ»¸ö¾ÍÊÇ×ֶε÷ÓÃϵͳ£¬¾ÍÊÇÊ×Ò³µÄÖ°Òµ½éÉÜ£¬¼æÖ°ÈËÆø£¬µÄÕâЩµ÷Óá£
ÁíÒ»¸ö¾ÍÊÇ»áÔ±·¢²¼ÏµÍ³¡£
Õû¸öÓñí¸ñ²¼¾Ö£¬ÃÀ¹¤Éϲ»´æÔ ......
ת×Ô http://wiki.kuaizhanbao.com/2009/1210/245.html
basename — ·µ»ØÂ·¾¶ÖеÄÎļþÃû²¿·Ö
chgrp — ¸Ä±äÎļþËùÊôµÄ×é
chmod — ¸Ä±äÎļþģʽ
chown — ¸Ä±äÎļþµÄËùÓÐÕß
clearstatcache — Çå³ýÎļþ״̬»º´æ
copy — ¿½±´Îļþ
delete — ²Î¼û unlink() »ò unset()
di ......
phpÖж¨½ç·û<<<µÄ×÷Óà - [phpÓï
ÑÔ
]
[Time:2009-08-18]
°æÈ¨ÉùÃ÷
£º×ªÔØÊ±ÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
ת×Ô:http://star210.blogbus.com/logs/44486135.html
ÒòΪPHPÊÇÒ»¸öWeb±à³ÌÓïÑÔ£¬ÔÚ±à³Ì¹ý³ÌÖÐÄÑÃâ»áÓöµ½ÓÃechoÀ´Êä³ö´ó¶ÎµÄhtmlºÍjavascript
½Å
±¾µÄÇé¿ö£¬Èç¹ûÓô«Í³µÄÊ ......
×òÌìÎÒÃÇʵÏÖÁËÒ»¸ö¼òµ¥µÄËÑË÷¹¦ÄÜ£¬½ñÌìÎÒÏëÁËһϣ¬Æäʵ»¹ÓпÉÒԸĽøµÄµØÖ·£¬ÈçÖ±½ÓÓÃIndex.php´úÌæSearch.php¡£
ÐÞ¸ÄIndex.phpÎļþ£¬ÐÞ¸ÄÒ»ÏÂËÑË÷±íµ¥
<!---ËÑË÷¿ò--->
<!--ÕâÀïµÄËùÓÐÖµÇ°Ãæ¼Óǰ׺“S_”ÒÔÇø·Ö-->
<form id="form1" name="form1" method="get" action="Index.php">
&n ......