php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7953 Results from SIN, COS, TAN functions are not correct
Submitted: 2000-11-23 18:24 UTC Modified: 2000-11-23 18:31 UTC
From: vnovakov at f dot bg dot ac dot yu Assigned:
Status: Closed Package: Math related
PHP Version: 4.0.3pl1 OS: Windows 2000 Professional
Private report: No CVE-ID: None
 [2000-11-23 18:24 UTC] vnovakov at f dot bg dot ac dot 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-23 18:31 UTC] phildriscoll@php.net
The trig functions work with radians - you are using degrees.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 10:03:34 2021 UTC