1--TEST-- 2Test log1p() - basic function test log1p() 3--INI-- 4precision=14 5--FILE-- 6<?php 7/* Prototype : float log1p ( float $arg ) 8 * Description: Returns log(1 + number), computed in a way that is accurate even 9 * when the value of number is close to zero 10 * Source code: ext/standard/math.c 11 */ 12 13echo "*** Testing log1p() : basic functionality ***\n"; 14 15$values = array(23, 16 -23, 17 2.345e1, 18 -2.345e1, 19 0x17, 20 027, 21 "23", 22 "23.45", 23 "2.345e1", 24 null, 25 true, 26 false); 27 28echo "\n LOG1p tests\n"; 29 30foreach($values as $value) { 31 echo "\n-- log1p $value --\n"; 32 var_dump(log1p($value)); 33}; 34 35 36?> 37===Done=== 38--EXPECTF-- 39*** Testing log1p() : basic functionality *** 40 41 LOG1p tests 42 43-- log1p 23 -- 44float(3.1780538303479) 45 46-- log1p -23 -- 47float(NAN) 48 49-- log1p 23.45 -- 50float(3.1966302159209) 51 52-- log1p -23.45 -- 53float(NAN) 54 55-- log1p 23 -- 56float(3.1780538303479) 57 58-- log1p 23 -- 59float(3.1780538303479) 60 61-- log1p 23 -- 62float(3.1780538303479) 63 64-- log1p 23.45 -- 65float(3.1966302159209) 66 67-- log1p 2.345e1 -- 68float(3.1966302159209) 69 70-- log1p -- 71float(0) 72 73-- log1p 1 -- 74float(0.69314718055995) 75 76-- log1p -- 77float(0) 78===Done=== 79