Jump to content


Photo

PHP Funcrtions: Inverse sine


  • Please log in to reply
No replies to this topic

#1 Tjk

Tjk
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 06 July 2006 - 05:00 PM

I can't seem to find true inverse sine. I have tried asin and asinh and both give weird answers. Here's the code:

$opposite= 295;
$hyp= 375.298547826;

$sinx= $opposite/ $hyp;
$x= asin($sinx);

This gives me an answer of 1.10573218834 when it should give me an answer of ~51.813

Is there a setting in php.ini i need to change? The script is being run on a linux server and running the latest version of PHP.

Any help is appreciated.
-Tjk

P.S: How do I use the php tags which colour the code. I haven't been able to find them. :)

EDIT: I managed to solve my own problem. (For anyone with a similiar problem) the answer is that asin always returns in radians therefore you need to use rad2deg() to convert the angle into degrees.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users