xref: /PHP-7.2/ext/standard/tests/math/log_basic.phpt (revision f1d7e3ca)
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--EXPECTF--
33 LOG tests...no base
34float(3.1354942159291)
35float(NAN)
36float(3.1548704948923)
37float(NAN)
38float(3.1354942159291)
39float(3.1354942159291)
40float(3.1354942159291)
41float(3.1548704948923)
42float(3.1548704948923)
43float(-INF)
44float(0)
45float(-INF)
46
47 LOG tests...base
48float(2.2617809780285)
49float(NAN)
50float(2.275758008814)
51float(NAN)
52float(2.2617809780285)
53float(2.2617809780285)
54float(2.2617809780285)
55float(2.275758008814)
56float(2.275758008814)
57float(-INF)
58float(0)
59float(-INF)
60