|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
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-2022 The PHP Group
All rights reserved.
Last updated: Tue Nov 29 14:04:16 2022 UTC