1--TEST-- 2Test hypot() - basic function test hypot() 3--INI-- 4precision=14 5--FILE-- 6<?php 7 8/* Prototype : float hypot ( float $x , float $y ) 9 * Description: Calculate the length of the hypotenuse of a right-angle triangle. 10 * Source code: ext/standard/math.c 11 */ 12 13echo "*** Testing hypot() : basic functionality ***\n"; 14 15$valuesy = array(23, 16 -23, 17 2.345e1, 18 -2.345e1, 19 0x17, 20 027, 21 "23", 22 "23.45", 23 "2.345e1", 24 "23abc", 25 null, 26 true, 27 false); 28 29$valuesx = array(33, 30 -33, 31 3.345e1, 32 -3.345e1, 33 0x27, 34 037, 35 "33", 36 "43.45", 37 "1.345e1", 38 "33abc", 39 null, 40 true, 41 false); 42 43for ($i = 0; $i < count($valuesy); $i++) { 44 for ($j = 0; $j < count($valuesx); $j++) { 45 echo "\nY:$valuesy[$i] X:$valuesx[$j] "; 46 $res = hypot($valuesy[$i], $valuesx[$j]); 47 var_dump($res); 48 } 49} 50?> 51===Done=== 52--EXPECTF-- 53*** Testing hypot() : basic functionality *** 54 55Y:23 X:33 float(40.224370722238) 56 57Y:23 X:-33 float(40.224370722238) 58 59Y:23 X:33.45 float(40.594365372549) 60 61Y:23 X:-33.45 float(40.594365372549) 62 63Y:23 X:39 float(45.276925690687) 64 65Y:23 X:31 float(38.600518131238) 66 67Y:23 X:33 float(40.224370722238) 68 69Y:23 X:43.45 float(49.162002603637) 70 71Y:23 X:1.345e1 float(26.643995571235) 72 73Y:23 X:33abc 74Notice: A non well formed numeric value encountered in %s on line %d 75float(40.224370722238) 76 77Y:23 X: float(23) 78 79Y:23 X:1 float(23.021728866443) 80 81Y:23 X: float(23) 82 83Y:-23 X:33 float(40.224370722238) 84 85Y:-23 X:-33 float(40.224370722238) 86 87Y:-23 X:33.45 float(40.594365372549) 88 89Y:-23 X:-33.45 float(40.594365372549) 90 91Y:-23 X:39 float(45.276925690687) 92 93Y:-23 X:31 float(38.600518131238) 94 95Y:-23 X:33 float(40.224370722238) 96 97Y:-23 X:43.45 float(49.162002603637) 98 99Y:-23 X:1.345e1 float(26.643995571235) 100 101Y:-23 X:33abc 102Notice: A non well formed numeric value encountered in %s on line %d 103float(40.224370722238) 104 105Y:-23 X: float(23) 106 107Y:-23 X:1 float(23.021728866443) 108 109Y:-23 X: float(23) 110 111Y:23.45 X:33 float(40.483360779461) 112 113Y:23.45 X:-33 float(40.483360779461) 114 115Y:23.45 X:33.45 float(40.851009779441) 116 117Y:23.45 X:-33.45 float(40.851009779441) 118 119Y:23.45 X:39 float(45.507169764774) 120 121Y:23.45 X:31 float(38.870329301409) 122 123Y:23.45 X:33 float(40.483360779461) 124 125Y:23.45 X:43.45 float(49.374132903779) 126 127Y:23.45 X:1.345e1 float(27.033405260899) 128 129Y:23.45 X:33abc 130Notice: A non well formed numeric value encountered in %s on line %d 131float(40.483360779461) 132 133Y:23.45 X: float(23.45) 134 135Y:23.45 X:1 float(23.471312276905) 136 137Y:23.45 X: float(23.45) 138 139Y:-23.45 X:33 float(40.483360779461) 140 141Y:-23.45 X:-33 float(40.483360779461) 142 143Y:-23.45 X:33.45 float(40.851009779441) 144 145Y:-23.45 X:-33.45 float(40.851009779441) 146 147Y:-23.45 X:39 float(45.507169764774) 148 149Y:-23.45 X:31 float(38.870329301409) 150 151Y:-23.45 X:33 float(40.483360779461) 152 153Y:-23.45 X:43.45 float(49.374132903779) 154 155Y:-23.45 X:1.345e1 float(27.033405260899) 156 157Y:-23.45 X:33abc 158Notice: A non well formed numeric value encountered in %s on line %d 159float(40.483360779461) 160 161Y:-23.45 X: float(23.45) 162 163Y:-23.45 X:1 float(23.471312276905) 164 165Y:-23.45 X: float(23.45) 166 167Y:23 X:33 float(40.224370722238) 168 169Y:23 X:-33 float(40.224370722238) 170 171Y:23 X:33.45 float(40.594365372549) 172 173Y:23 X:-33.45 float(40.594365372549) 174 175Y:23 X:39 float(45.276925690687) 176 177Y:23 X:31 float(38.600518131238) 178 179Y:23 X:33 float(40.224370722238) 180 181Y:23 X:43.45 float(49.162002603637) 182 183Y:23 X:1.345e1 float(26.643995571235) 184 185Y:23 X:33abc 186Notice: A non well formed numeric value encountered in %s on line %d 187float(40.224370722238) 188 189Y:23 X: float(23) 190 191Y:23 X:1 float(23.021728866443) 192 193Y:23 X: float(23) 194 195Y:23 X:33 float(40.224370722238) 196 197Y:23 X:-33 float(40.224370722238) 198 199Y:23 X:33.45 float(40.594365372549) 200 201Y:23 X:-33.45 float(40.594365372549) 202 203Y:23 X:39 float(45.276925690687) 204 205Y:23 X:31 float(38.600518131238) 206 207Y:23 X:33 float(40.224370722238) 208 209Y:23 X:43.45 float(49.162002603637) 210 211Y:23 X:1.345e1 float(26.643995571235) 212 213Y:23 X:33abc 214Notice: A non well formed numeric value encountered in %s on line %d 215float(40.224370722238) 216 217Y:23 X: float(23) 218 219Y:23 X:1 float(23.021728866443) 220 221Y:23 X: float(23) 222 223Y:23 X:33 float(40.224370722238) 224 225Y:23 X:-33 float(40.224370722238) 226 227Y:23 X:33.45 float(40.594365372549) 228 229Y:23 X:-33.45 float(40.594365372549) 230 231Y:23 X:39 float(45.276925690687) 232 233Y:23 X:31 float(38.600518131238) 234 235Y:23 X:33 float(40.224370722238) 236 237Y:23 X:43.45 float(49.162002603637) 238 239Y:23 X:1.345e1 float(26.643995571235) 240 241Y:23 X:33abc 242Notice: A non well formed numeric value encountered in %s on line %d 243float(40.224370722238) 244 245Y:23 X: float(23) 246 247Y:23 X:1 float(23.021728866443) 248 249Y:23 X: float(23) 250 251Y:23.45 X:33 float(40.483360779461) 252 253Y:23.45 X:-33 float(40.483360779461) 254 255Y:23.45 X:33.45 float(40.851009779441) 256 257Y:23.45 X:-33.45 float(40.851009779441) 258 259Y:23.45 X:39 float(45.507169764774) 260 261Y:23.45 X:31 float(38.870329301409) 262 263Y:23.45 X:33 float(40.483360779461) 264 265Y:23.45 X:43.45 float(49.374132903779) 266 267Y:23.45 X:1.345e1 float(27.033405260899) 268 269Y:23.45 X:33abc 270Notice: A non well formed numeric value encountered in %s on line %d 271float(40.483360779461) 272 273Y:23.45 X: float(23.45) 274 275Y:23.45 X:1 float(23.471312276905) 276 277Y:23.45 X: float(23.45) 278 279Y:2.345e1 X:33 float(40.483360779461) 280 281Y:2.345e1 X:-33 float(40.483360779461) 282 283Y:2.345e1 X:33.45 float(40.851009779441) 284 285Y:2.345e1 X:-33.45 float(40.851009779441) 286 287Y:2.345e1 X:39 float(45.507169764774) 288 289Y:2.345e1 X:31 float(38.870329301409) 290 291Y:2.345e1 X:33 float(40.483360779461) 292 293Y:2.345e1 X:43.45 float(49.374132903779) 294 295Y:2.345e1 X:1.345e1 float(27.033405260899) 296 297Y:2.345e1 X:33abc 298Notice: A non well formed numeric value encountered in %s on line %d 299float(40.483360779461) 300 301Y:2.345e1 X: float(23.45) 302 303Y:2.345e1 X:1 float(23.471312276905) 304 305Y:2.345e1 X: float(23.45) 306 307Y:23abc X:33 308Notice: A non well formed numeric value encountered in %s on line %d 309float(40.224370722238) 310 311Y:23abc X:-33 312Notice: A non well formed numeric value encountered in %s on line %d 313float(40.224370722238) 314 315Y:23abc X:33.45 316Notice: A non well formed numeric value encountered in %s on line %d 317float(40.594365372549) 318 319Y:23abc X:-33.45 320Notice: A non well formed numeric value encountered in %s on line %d 321float(40.594365372549) 322 323Y:23abc X:39 324Notice: A non well formed numeric value encountered in %s on line %d 325float(45.276925690687) 326 327Y:23abc X:31 328Notice: A non well formed numeric value encountered in %s on line %d 329float(38.600518131238) 330 331Y:23abc X:33 332Notice: A non well formed numeric value encountered in %s on line %d 333float(40.224370722238) 334 335Y:23abc X:43.45 336Notice: A non well formed numeric value encountered in %s on line %d 337float(49.162002603637) 338 339Y:23abc X:1.345e1 340Notice: A non well formed numeric value encountered in %s on line %d 341float(26.643995571235) 342 343Y:23abc X:33abc 344Notice: A non well formed numeric value encountered in %s on line %d 345 346Notice: A non well formed numeric value encountered in %s on line %d 347float(40.224370722238) 348 349Y:23abc X: 350Notice: A non well formed numeric value encountered in %s on line %d 351float(23) 352 353Y:23abc X:1 354Notice: A non well formed numeric value encountered in %s on line %d 355float(23.021728866443) 356 357Y:23abc X: 358Notice: A non well formed numeric value encountered in %s on line %d 359float(23) 360 361Y: X:33 float(33) 362 363Y: X:-33 float(33) 364 365Y: X:33.45 float(33.45) 366 367Y: X:-33.45 float(33.45) 368 369Y: X:39 float(39) 370 371Y: X:31 float(31) 372 373Y: X:33 float(33) 374 375Y: X:43.45 float(43.45) 376 377Y: X:1.345e1 float(13.45) 378 379Y: X:33abc 380Notice: A non well formed numeric value encountered in %s on line %d 381float(33) 382 383Y: X: float(0) 384 385Y: X:1 float(1) 386 387Y: X: float(0) 388 389Y:1 X:33 float(33.015148038438) 390 391Y:1 X:-33 float(33.015148038438) 392 393Y:1 X:33.45 float(33.464944344792) 394 395Y:1 X:-33.45 float(33.464944344792) 396 397Y:1 X:39 float(39.012818406262) 398 399Y:1 X:31 float(31.016124838542) 400 401Y:1 X:33 float(33.015148038438) 402 403Y:1 X:43.45 float(43.461505956421) 404 405Y:1 X:1.345e1 float(13.487123488721) 406 407Y:1 X:33abc 408Notice: A non well formed numeric value encountered in %s on line %d 409float(33.015148038438) 410 411Y:1 X: float(1) 412 413Y:1 X:1 float(1.4142135623731) 414 415Y:1 X: float(1) 416 417Y: X:33 float(33) 418 419Y: X:-33 float(33) 420 421Y: X:33.45 float(33.45) 422 423Y: X:-33.45 float(33.45) 424 425Y: X:39 float(39) 426 427Y: X:31 float(31) 428 429Y: X:33 float(33) 430 431Y: X:43.45 float(43.45) 432 433Y: X:1.345e1 float(13.45) 434 435Y: X:33abc 436Notice: A non well formed numeric value encountered in %s on line %d 437float(33) 438 439Y: X: float(0) 440 441Y: X:1 float(1) 442 443Y: X: float(0) 444===Done=== 445