summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/log_basic.phpt
blob: 84e72bb14d7fc8768331eb0ddbf8d2615caec30c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
Test log() - basic function test log()
--INI--
precision=14
--FILE--
<?php
$values = array(23,
                -23,
                2.345e1,
                -2.345e1,
                0x17,
                027,
                "23",
                "23.45",
                "2.345e1",
                null,
                true,
                false);

echo "\n LOG tests...no base\n";
for ($i = 0; $i < count($values); $i++) {
    $res = log($values[$i]);
    var_dump($res);
}

echo "\n LOG tests...base\n";
for ($i = 0; $i < count($values); $i++) {
    $res = log($values[$i], 4);
    var_dump($res);
}
?>
--EXPECT--
LOG tests...no base
float(3.1354942159291497)
float(NAN)
float(3.1548704948922883)
float(NAN)
float(3.1354942159291497)
float(3.1354942159291497)
float(3.1354942159291497)
float(3.1548704948922883)
float(3.1548704948922883)
float(-INF)
float(0)
float(-INF)

 LOG tests...base
float(2.2617809780285065)
float(NAN)
float(2.275758008814007)
float(NAN)
float(2.2617809780285065)
float(2.2617809780285065)
float(2.2617809780285065)
float(2.275758008814007)
float(2.275758008814007)
float(-INF)
float(0)
float(-INF)