PHP 4.0 Bug #7953 Updated: Results from SIN, COS, TAN functions are not correct

From: Date: Thu, 23 Nov 2000 23:31:54 +0000
Subject: PHP 4.0 Bug #7953 Updated: Results from SIN, COS, TAN functions are not correct
Groups: php.dev 
Request: Send a blank email to php-dev+get-39048@lists.php.net to get a copy of this message
ID: 7953 Updated by: phildriscoll Reported By: vnovakov@f.bg.ac.yu Status: Closed Bug Type: Math related Assigned To: Comments: The trig functions work with radians - you are using degrees. Previous Comments: --------------------------------------------------------------------------- [2000-11-23 18:24:52] vnovakov@f.bg.ac.yu Using PHP 4.0.3pl1 under Windows NT, I found bugs in SIN, COS and TAN math. functions: <? echo "<html>"; $a = 26.736944444444; $s = sin($a); $c = cos($a); $t = tan($a); echo "SIN $a= "; echo $s; echo "<p>; echo "COS $a= "; echo $c; echo "<p>; echo "TAN $a= "; echo $t; echo "<p>; echo "</html>"; ?> Results are: SIN $a = 0.99944204177993 COS $a = -0.033400675483516 TAN $a = -29.922809263938 SIN and COS functions are not correct. As TAN $a is using SIN $a /COS $a. TAN function is not correct too. Calulate manualy or using any calculator you will see that real values are: SIN $a = 0.4498... COS $a = 0.8930... TAN a$ = 0.5037... regards, Vladimir --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=7953

« previous php.dev (#39048) next »