xref: /PHP-8.3/ext/standard/tests/math/log_basic.phpt (revision b10416a6)
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                true,
17                false);
18
19echo "\n LOG tests...no base\n";
20for ($i = 0; $i < count($values); $i++) {
21    $res = log($values[$i]);
22    var_dump($res);
23}
24
25echo "\n LOG tests...base\n";
26for ($i = 0; $i < count($values); $i++) {
27    $res = log($values[$i], 4);
28    var_dump($res);
29}
30?>
31--EXPECT--
32LOG tests...no base
33float(3.1354942159291497)
34float(NAN)
35float(3.1548704948922883)
36float(NAN)
37float(3.1354942159291497)
38float(3.1354942159291497)
39float(3.1354942159291497)
40float(3.1548704948922883)
41float(3.1548704948922883)
42float(0)
43float(-INF)
44
45 LOG tests...base
46float(2.2617809780285065)
47float(NAN)
48float(2.275758008814007)
49float(NAN)
50float(2.2617809780285065)
51float(2.2617809780285065)
52float(2.2617809780285065)
53float(2.275758008814007)
54float(2.275758008814007)
55float(0)
56float(-INF)
57