note 99165 deleted from function.atan by danbrown
| From: | danbrown@php.net | Date: | Sun, 01 Aug 2010 14:05:37 +0000 |
| Subject: | note 99165 deleted from function.atan by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171313@lists.php.net to get a copy of this message | ||
Note Submitter: cofoto at yahoo dot com
----
function arctan($x) {
$result = 0;
$opr = "+";
$n = 0;
if($x >= 1) {
$result = pi() / 2 - tarc(1/$x);
} else {
for($i=3; $i < 100; $i++) {
if(($i % 2) != 0) {
if($opr == "-") {
$n -= pow($x, $i) / $i;
} else {
$n += pow($x, $i) / $i;
}
$opr = $opr == "-" ? "+" : "-";
}
}
$result = $x - $n;
}
return $result;
}
print "<br />".arctan(0.0005);
print "<br />".atan(0.0005);