note 34439 added to function.sqrt
| From: | Merve at rack1 dot php dot net | Date: | Sun, 27 Jul 2003 14:10:21 +0000 |
| Subject: | note 34439 added to function.sqrt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52744@lists.php.net to get a copy of this message | ||
Square roots of negative numbers exist, but they're imaginary numbers.
Here's what I mean:
<?php
if ($b<0) {
$c = sqrt($b*-1);
print (" The square root of $b = ±$c<i>i</i>");
} else {
$c = sqrt($b);
print (" The square root of $b = $c");
}
?>
So you can do square roots with negative numbers.
----
Manual Page -- http://www.php.net/manual/en/function.sqrt.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34439
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34439&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34439&report=yes