#30494 [Opn->Bgs]: sin() seems to give a wrong output if you convert it to radius

From: Date: Wed, 20 Oct 2004 12:35:31 +0000
Subject: #30494 [Opn->Bgs]: sin() seems to give a wrong output if you convert it to radius
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67822@lists.php.net to get a copy of this message
ID: 30494 Updated by: derick@php.net Reported By: tom at neighbour dot nl -Status: Open +Status: Bogus Bug Type: Math related Operating System: Windows XP PHP Version: 4.3.9 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2004-10-20 14:24:54] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30494&edit=1

« previous php.bugs (#67822) next »