锟斤拷锟斤拷锟酵o拷也锟叫革拷锟斤拷锟斤拷 float锟斤拷双锟斤拷锟斤拷锟斤拷 double 锟斤拷实锟斤拷 real锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤法锟斤拷锟藉:
<?php
$a = 1.234;
$b = 1.2e3;
$c = 7E-10;
?>
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷式锟斤拷示锟斤拷
LNUM [0-9]+ DNUM ([0-9]*[\.]{LNUM}) | ({LNUM}[\.][0-9]*) EXPONENT_DNUM [+-]?(({LNUM} | {DNUM}) [eE][+-]? {LNUM})
锟斤拷锟斤拷锟斤拷锟斤拷锟街筹拷锟斤拷平台锟斤拷兀锟斤拷锟斤拷锟酵拷锟斤拷锟斤拷值锟斤拷 1.8e308 锟斤拷锟斤拷锟斤拷 14 位十锟斤拷锟斤拷锟斤拷锟街的撅拷锟饺o拷64 位 IEEE 锟斤拷式锟斤拷锟斤拷
锟斤拷锟斤拷锟斤拷锟侥撅拷锟斤拷锟斤拷锟睫★拷锟斤拷锟斤拷取锟斤拷锟斤拷系统锟斤拷PHP 通锟斤拷使锟斤拷 IEEE 754 双锟斤拷锟饺革拷式锟斤拷锟斤拷锟斤拷锟斤拷取锟斤拷锟斤拷锟斤拷锟铰碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿� 1.11e-16锟斤拷锟角伙拷锟斤拷锟斤拷学锟斤拷锟斤拷锟斤拷芑锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷睿拷锟斤拷锟揭拷锟斤拷堑锟斤拷锟斤拷懈锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷锟筋传锟捷★拷
锟斤拷锟解,锟斤拷十锟斤拷锟斤拷锟杰癸拷锟斤拷确锟斤拷示锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 0.1 锟斤拷 0.7锟斤拷锟斤拷锟斤拷锟叫讹拷锟斤拷尾锟斤拷锟斤拷锟斤拷锟杰憋拷锟节诧拷锟斤拷使锟矫的讹拷锟斤拷锟狡撅拷确锟斤拷示锟斤拷锟斤拷瞬锟斤拷锟斤拷诓锟斤拷锟绞б伙拷锟姐精锟饺碉拷锟斤拷锟斤拷锟阶拷锟轿拷锟斤拷锟斤拷频母锟绞斤拷锟斤拷锟酵伙拷锟斤拷苫锟斤拷业慕锟斤拷锟斤拷锟斤拷锟界,floor((0.1+0.7)*10) 通锟斤拷锟结返锟斤拷 7 锟斤拷锟斤拷锟斤拷预锟斤拷锟叫碉拷 8锟斤拷锟斤拷为锟矫斤拷锟斤拷诓锟斤拷谋锟绞撅拷锟绞碉拷锟斤拷锟斤拷锟� 7.9999999999999991118...锟斤拷
锟斤拷锟斤拷锟斤拷远锟斤拷要锟斤拷锟脚革拷锟斤拷锟斤拷锟斤拷锟斤拷锟饺凤拷锟斤拷锟斤拷锟斤拷一位锟斤拷也锟斤拷远锟斤拷要锟饺斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟角凤拷锟斤拷取锟斤拷锟斤拷确实锟斤拷要锟斤拷锟竭的撅拷锟饺o拷应锟斤拷使锟斤拷锟斤拷锟解精锟斤拷锟斤拷学锟斤拷锟斤拷锟斤拷锟斤拷 gmp 锟斤拷锟斤拷锟斤拷
锟轿硷拷» 锟斤拷锟斤拷锟斤拷指锟斤拷锟斤拷页锟侥简单斤拷锟酵★拷
锟斤拷锟较o拷锟斤拷私锟斤拷泄睾锟绞憋拷锟斤拷锟轿斤拷锟街凤拷锟斤拷转锟斤拷锟缴革拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷锟斤拷锟斤拷锟�"锟街凤拷锟斤拷转锟斤拷为锟斤拷值"一锟节★拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟酵碉拷值锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷冉锟街底拷锟斤拷锟斤拷锟斤拷停锟饺伙拷锟斤拷锟阶拷锟斤拷筛锟斤拷恪o拷锟斤拷锟斤拷"转锟斤拷为锟斤拷锟斤拷"一锟斤拷锟皆伙拷取锟斤拷锟斤拷锟斤拷息锟斤拷锟斤拷 PHP 5 锟斤拷锟斤拷锟斤拷锟酵硷拷锟斤拷锟斤拷锟阶拷锟轿拷锟斤拷锟斤拷锟斤拷锟斤拷岱拷锟揭伙拷锟� E_NOTICE 锟斤拷锟斤拷锟斤拷息锟斤拷
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷锟皆o拷锟斤拷锟斤拷锟节诧拷锟斤拷锓绞斤拷锟皆拷颍冉锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷欠锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷摹锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷鼗氐姆锟斤拷锟斤拷锟斤拷冉细锟斤拷锟斤拷锟街碉拷摹锟�
要锟斤拷锟皆革拷锟斤拷锟斤拷锟角凤拷锟斤拷龋锟揭癸拷锟揭伙拷锟斤拷锟斤拷雀锟斤拷锟街碉拷锟揭伙拷锟斤拷锟斤拷锟斤拷小锟斤拷锟街碉拷锟斤拷锟街狄诧拷锟斤拷锟轿拷锟斤拷锟斤拷锟叫≈碉拷锟絜psilon锟斤拷锟斤拷锟斤拷小锟斤拷元取锟斤拷锟斤拷锟斤拷锟角硷拷锟斤拷锟斤拷锟斤拷锟杰斤拷锟杰碉拷锟斤拷小锟侥诧拷锟街碉拷锟�
$a 锟斤拷 $b 锟斤拷小锟斤拷锟斤拷锟斤拷锟轿伙拷锟斤拷锟斤拷诙锟斤拷锟斤拷锟饺的★拷
<?php
$a = 1.23456789;
$b = 1.23456780;
$epsilon = 0.00001;
if(abs($a-$b) < $epsilon) {
echo "true";
}
?>
某些锟斤拷学锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟缴筹拷锟斤拷 NAN
锟斤拷锟斤拷锟斤拷慕锟斤拷锟斤拷锟剿斤拷锟斤拷锟斤拷锟斤拷锟揭伙拷锟斤拷诟锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟津不可憋拷锟斤拷锟斤拷值锟斤拷锟轿猴拷锟矫达拷值锟斤拷锟斤拷锟斤拷锟轿猴拷值锟斤拷锟斤拷锟斤拷 TRUE
锟斤拷锟斤拷锟叫碉拷锟斤拷散锟斤拷锟较革拷冉系慕锟斤拷锟斤拷锟斤拷
FALSE
锟斤拷
锟斤拷锟斤拷 NAN
锟斤拷锟斤拷锟斤拷锟轿何诧拷同值锟斤拷锟斤拷应锟斤拷
NAN
去锟斤拷锟斤拷锟斤拷值锟斤拷锟叫比较o拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷应锟斤拷锟斤拷
is_nan() 锟斤拷锟斤拷椤�