php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30494 sin() seems to give a wrong output if you convert it to radius
Submitted: 2004-10-20 14:24 UTC Modified: 2004-10-20 14:35 UTC
From: tom at neighbour dot nl Assigned:
Status: Not a bug Package: Math related
PHP Version: 4.3.9 OS: Windows XP
Private report: No CVE-ID: None
 [2004-10-20 14:24 UTC] tom at neighbour dot nl
Description:
------------
I have used this function to get the angle of B in a triangle.

$B = rad2deg(  asin(10/14)   );

The output seems to be correct giving me around 45 degrees when i use the asin() function.

But when i use the sin() function to get the length of side b in a different triangle:

rad2deg(  SIN(45)  );

it should be giving me around 0.7 back but it gives me 48.

When i remove the rad2deg() function and use normal radius sin(45) then it gives me the corect answer which is 0.85

Reproduce code:
---------------
$B = rad2deg(  asin(10/14)   );


rad2deg(  SIN(45)  );

Expected result:
----------------
I expect to see the proper answer which is 0.7 instead of getting 48

Actual result:
--------------
As stated above my actual result is 48

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-20 14:35 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to convert to radials before using the sin function.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC