检查我的数学! [英] Check my math!

查看:54
本文介绍了检查我的数学!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人请说明当我开始告诉我2不等于2时,我落入了这个替代宇宙这个下午
下午。


不确定关于你,但是当我运行它时,它告诉我59001.31并不是
等于59001.31。将等式的每一边改为一个或两个

并检查。改变它,它不会。


_What_在这里发生了什么?!


<?php

$ subtotal = 59001.31;

$ principal = 58605.33;

$ interest = 395.98;

$ check = $ principal + $ interest;

echo("< pre>");

echo(" Check:"。$ check。" \ n") ;

echo(" Subtotal:"。$ subtotal。" \ n");

if($ check!= $ subtotal){

echo(" Check("。$ check。")不等于小计("。

$ subtotal。")"); //检查不等于小计

}

else {

echo(" Check("。$ check。" )等于小计(。$ subtotal。

)"); //检查确实等于小计

}

echo("< / pre>");

?>


-

Craig Bailey,通讯协调员

佛蒙特州住房金融局(VHFA)

164 St. Paul St.,PO方框408

Burlington,Vt.05402-0408

电子邮件: cb *** **@vhfa.org |网址: www.vhfa.org

电话:(802) 652-3463 |传真:(802)864-5746

Someone please explain what alternate universe I fell into this
afternoon when PHP started telling me that 2 doesn''t equal 2.

Not sure about you, but when I run this, it tells me 59001.31 doesn''t
equal 59001.31. Change each side of the equation by a hundreth or two
and it checks. Change it a bit more, and it won''t.

_What_ is going on here?!

<?php
$subtotal=59001.31;
$principal=58605.33;
$interest=395.98;
$check=$principal+$interest;
echo("<pre>");
echo("Check: " . $check . "\n");
echo("Subtotal: " . $subtotal . "\n");
if($check!=$subtotal) {
echo("Check (" . $check . ") does not equal subtotal (" .
$subtotal . ")"); // Check doesn''t equal subtotal
}
else {
echo("Check (" . $check . ") equals subtotal (" . $subtotal .
")"); // Check does equal subtotal
}
echo("</pre>");
?>

--
Craig Bailey, Communications Coordinator
Vermont Housing Finance Agency (VHFA)
164 St. Paul St., P.O. Box 408
Burlington, Vt. 05402-0408
Email: cb*****@vhfa.org | Web: www.vhfa.org
Phone: (802) 652-3463 | Fax: (802) 864-5746

推荐答案

subtotal = 59001.31;
subtotal=59001.31;


principal = 58605.33;
principal=58605.33;


interest = 395.98;
interest=395.98;


这篇关于检查我的数学!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆