#30494 [NEW]: sin() seems to give a wrong output if you convert it to radius
| From: | tom at neighbour dot nl | Date: | Wed, 20 Oct 2004 12:25:21 +0000 |
| Subject: | #30494 [NEW]: sin() seems to give a wrong output if you convert it to radius | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-67821@lists.php.net to get a copy of this message | ||
From: tom at neighbour dot nl
Operating system: Windows XP
PHP version: 4.3.9
PHP Bug Type: Math related
Bug description: sin() seems to give a wrong output if you convert it to radius
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 bug report at http://bugs.php.net/?id=30494&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30494&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30494&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30494&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30494&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30494&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30494&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30494&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30494&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30494&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30494&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30494&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30494&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30494&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30494&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30494&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30494&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30494&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30494&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30494&r=mysqlcfg