Hi,
I have sample code listed below
<?php
echo sin(45);
echo "<br/>";
echo cos(45);
?>
When i run the code, I get the following results:
0.85090352453412
0.52532198881773
Here is the problem, I know that Sin(45)=Cos(45)
So what I'm doing wrong here?
Many Thanks
Math function questtion.
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Math function questtion.
Sin(45) NOT EQUAL Cos(45)alm2009 wrote:Hi,
I have sample code listed below
<?php
echo sin(45);
echo "<br/>";
echo cos(45);
?>
When i run the code, I get the following results:
0.85090352453412
0.52532198881773
Here is the problem, I know that Sin(45)=Cos(45)
So what I'm doing wrong here?
Many Thanks
Sin(45 deg) EQUAL Cos(45 deg)
And the PHP functions expect radian.
Code: Select all
echo sin(deg2rad(45));
echo cos(deg2rad(45));mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Math function questtion.
Thanks a lot, I just realized that the trigonometrical function might not use degrees as a default.
cheers
cheers