File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
standard /
tests /
math /
cos_variation.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Test variations in usage of cos()
--INI--
precision = 10
--FILE--
<?php
/*
* proto float cos(float number)
* Function is implemented in ext/standard/math.c
*/
//Test cos with a different input values
$values = array(23,
-23,
2.345e1,
-2.345e1,
0x17,
027,
"23",
"23.45",
"2.345e1",
"nonsense",
"1000",
"1000ABC",
null,
true,
false);
for ($i = 0; $i < count($values); $i++) {
$res = cos($values[$i]);
var_dump($res);
}
?>
--EXPECTF--
float(-0.5328330203)
float(-0.5328330203)
float(-0.1117112391)
float(-0.1117112391)
float(-0.5328330203)
float(-0.5328330203)
float(-0.5328330203)
float(-0.1117112391)
float(-0.1117112391)
Warning: cos() expects parameter 1 to be double, string given in %s on line %d
NULL
float(0.5623790763)
Notice: A non well formed numeric value encountered in %s on line %d
float(0.5623790763)
float(1)
float(0.5403023059)
float(1)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>