xref: /PHP-8.0/ext/standard/tests/math/log_basic.phpt (revision a9398056)
1--TEST--
2Test log() - basic function test log()
3--INI--
4precision=14
5--FILE--
6<?php
7$values = array(23,
8                -23,
9                2.345e1,
10                -2.345e1,
11                0x17,
12                027,
13                "23",
14                "23.45",
15                "2.345e1",
16                null,
17                true,
18                false);
19
20echo "\n LOG tests...no base\n";
21for ($i = 0; $i < count($values); $i++) {
22    $res = log($values[$i]);
23    var_dump($res);
24}
25
26echo "\n LOG tests...base\n";
27for ($i = 0; $i < count($values); $i++) {
28    $res = log($values[$i], 4);
29    var_dump($res);
30}
31?>
32--EXPECT--
33LOG tests...no base
34float(3.1354942159291497)
35float(NAN)
36float(3.1548704948922883)
37float(NAN)
38float(3.1354942159291497)
39float(3.1354942159291497)
40float(3.1354942159291497)
41float(3.1548704948922883)
42float(3.1548704948922883)
43float(-INF)
44float(0)
45float(-INF)
46
47 LOG tests...base
48float(2.2617809780285065)
49float(NAN)
50float(2.275758008814007)
51float(NAN)
52float(2.2617809780285065)
53float(2.2617809780285065)
54float(2.2617809780285065)
55float(2.275758008814007)
56float(2.275758008814007)
57float(-INF)
58float(0)
59float(-INF)
60