ID: 31803 Updated by: [EMAIL PROTECTED] Reported By: thiago_mata at yahoo dot com dot br -Status: Open +Status: Bogus Bug Type: Safe Mode/open_basedir Operating System: Windows XP PHP Version: 4.3.10 New Comment:
Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2005-02-02 04:16:33] thiago_mata at yahoo dot com dot br Description: ------------ The funcion cos it is not return the espected result. While the sin it is ok. Reproduce code: --------------- $Angulo = Pi()/2; print "cos(Angulo) = ".cos($Angulo)."<BR>\n"; print "cos(Pi/2) = ".cos(Pi()/2)."<BR>\n"; print "Angulo = $Angulo <br>\n"; $cos = sqrt(1 - sin($Angulo)*sin($Angulo)); print "Coseno = ".cos($Angulo)."<br>\n Cos = ".$cos."<BR>\n"; print "Seno = ".sin($Angulo)."<BR>\n"; Expected result: ---------------- cos(Angulo) = 0 cos(Pi/2) = 0 Angulo = 1.5707963267949 Coseno = 0 Cos = 0 Seno = 1 Actual result: -------------- cos(Angulo) = 6.1230317691119E-017 cos(Pi/2) = 6.1230317691119E-017 Angulo = 1.5707963267949 Coseno = 6.1230317691119E-017 Cos = 0 Seno = 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31803&edit=1