|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: vnovakov at f dot bg dot ac dot yu
New email:
PHP Version: OS:


 [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...



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-23 18:31 UTC]
The trig functions work with radians - you are using degrees.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Dec 07 11:01:27 2023 UTC