summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Greene <jason@php.net>2002-11-11 03:45:04 +0000
committerJason Greene <jason@php.net>2002-11-11 03:45:04 +0000
commit9e2a312f2e5ef9619245bdf42f920c406cbf7d65 (patch)
tree54375806512422939258db31392b362cd64df7d5
parent67e6c356f6eacbdc082b60d8ec30e7a8369b4bad (diff)
downloadphp-git-9e2a312f2e5ef9619245bdf42f920c406cbf7d65.tar.gz
add test function for log()
# It is difficult to test an approximation of an approximation, but I # believe this test should be close enough to verify the function is working # correctly.
-rw-r--r--ext/standard/tests/math/log.phpt21
1 files changed, 21 insertions, 0 deletions
diff --git a/ext/standard/tests/math/log.phpt b/ext/standard/tests/math/log.phpt
new file mode 100644
index 0000000000..344c72fa0d
--- /dev/null
+++ b/ext/standard/tests/math/log.phpt
@@ -0,0 +1,21 @@
+--TEST--
+log() tests
+--POST--
+--GET--
+--FILE--
+<?php // $Id$
+echo "On failure, please mail result to php-dev@lists.php.net\n";
+for ($x=0, $count=0; $x < 200; $x++) {
+ $x2 = (int) exp(log($x));
+ // e ^ log(x) should be close in range to x
+ if (($x2 < ($x + 2)) && ($x2 > ($x - 2))) {
+ $count++;
+ }
+ else {
+ print "$x : $x2\n";
+ }
+}
+print $count . "\n";
+--EXPECT--
+On failure, please mail result to php-dev@lists.php.net
+200