1--TEST-- 2Test + operator : 64bit long tests 3--SKIPIF-- 4<?php 5if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); 6?> 7--FILE-- 8<?php 9 10define("MAX_64Bit", 9223372036854775807); 11define("MAX_32Bit", 2147483647); 12define("MIN_64Bit", -9223372036854775807 - 1); 13define("MIN_32Bit", -2147483647 - 1); 14 15$longVals = array( 16 MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit, 17 MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1, 18 MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1 19); 20 21$otherVals = array(0, 1, -1, 7, 9, 65, -44, MAX_32Bit, MAX_64Bit); 22 23error_reporting(E_ERROR); 24 25foreach ($longVals as $longVal) { 26 foreach($otherVals as $otherVal) { 27 echo "--- testing: $longVal + $otherVal ---\n"; 28 var_dump($longVal+$otherVal); 29 } 30} 31 32foreach ($otherVals as $otherVal) { 33 foreach($longVals as $longVal) { 34 echo "--- testing: $otherVal + $longVal ---\n"; 35 var_dump($otherVal+$longVal); 36 } 37} 38 39?> 40--EXPECT-- 41--- testing: 9223372036854775807 + 0 --- 42int(9223372036854775807) 43--- testing: 9223372036854775807 + 1 --- 44float(9.223372036854776E+18) 45--- testing: 9223372036854775807 + -1 --- 46int(9223372036854775806) 47--- testing: 9223372036854775807 + 7 --- 48float(9.223372036854776E+18) 49--- testing: 9223372036854775807 + 9 --- 50float(9.223372036854776E+18) 51--- testing: 9223372036854775807 + 65 --- 52float(9.223372036854776E+18) 53--- testing: 9223372036854775807 + -44 --- 54int(9223372036854775763) 55--- testing: 9223372036854775807 + 2147483647 --- 56float(9.22337203900226E+18) 57--- testing: 9223372036854775807 + 9223372036854775807 --- 58float(1.8446744073709552E+19) 59--- testing: -9223372036854775808 + 0 --- 60int(-9223372036854775808) 61--- testing: -9223372036854775808 + 1 --- 62int(-9223372036854775807) 63--- testing: -9223372036854775808 + -1 --- 64float(-9.223372036854776E+18) 65--- testing: -9223372036854775808 + 7 --- 66int(-9223372036854775801) 67--- testing: -9223372036854775808 + 9 --- 68int(-9223372036854775799) 69--- testing: -9223372036854775808 + 65 --- 70int(-9223372036854775743) 71--- testing: -9223372036854775808 + -44 --- 72float(-9.223372036854776E+18) 73--- testing: -9223372036854775808 + 2147483647 --- 74int(-9223372034707292161) 75--- testing: -9223372036854775808 + 9223372036854775807 --- 76int(-1) 77--- testing: 2147483647 + 0 --- 78int(2147483647) 79--- testing: 2147483647 + 1 --- 80int(2147483648) 81--- testing: 2147483647 + -1 --- 82int(2147483646) 83--- testing: 2147483647 + 7 --- 84int(2147483654) 85--- testing: 2147483647 + 9 --- 86int(2147483656) 87--- testing: 2147483647 + 65 --- 88int(2147483712) 89--- testing: 2147483647 + -44 --- 90int(2147483603) 91--- testing: 2147483647 + 2147483647 --- 92int(4294967294) 93--- testing: 2147483647 + 9223372036854775807 --- 94float(9.22337203900226E+18) 95--- testing: -2147483648 + 0 --- 96int(-2147483648) 97--- testing: -2147483648 + 1 --- 98int(-2147483647) 99--- testing: -2147483648 + -1 --- 100int(-2147483649) 101--- testing: -2147483648 + 7 --- 102int(-2147483641) 103--- testing: -2147483648 + 9 --- 104int(-2147483639) 105--- testing: -2147483648 + 65 --- 106int(-2147483583) 107--- testing: -2147483648 + -44 --- 108int(-2147483692) 109--- testing: -2147483648 + 2147483647 --- 110int(-1) 111--- testing: -2147483648 + 9223372036854775807 --- 112int(9223372034707292159) 113--- testing: 9223372034707292160 + 0 --- 114int(9223372034707292160) 115--- testing: 9223372034707292160 + 1 --- 116int(9223372034707292161) 117--- testing: 9223372034707292160 + -1 --- 118int(9223372034707292159) 119--- testing: 9223372034707292160 + 7 --- 120int(9223372034707292167) 121--- testing: 9223372034707292160 + 9 --- 122int(9223372034707292169) 123--- testing: 9223372034707292160 + 65 --- 124int(9223372034707292225) 125--- testing: 9223372034707292160 + -44 --- 126int(9223372034707292116) 127--- testing: 9223372034707292160 + 2147483647 --- 128int(9223372036854775807) 129--- testing: 9223372034707292160 + 9223372036854775807 --- 130float(1.8446744071562068E+19) 131--- testing: -9223372034707292160 + 0 --- 132int(-9223372034707292160) 133--- testing: -9223372034707292160 + 1 --- 134int(-9223372034707292159) 135--- testing: -9223372034707292160 + -1 --- 136int(-9223372034707292161) 137--- testing: -9223372034707292160 + 7 --- 138int(-9223372034707292153) 139--- testing: -9223372034707292160 + 9 --- 140int(-9223372034707292151) 141--- testing: -9223372034707292160 + 65 --- 142int(-9223372034707292095) 143--- testing: -9223372034707292160 + -44 --- 144int(-9223372034707292204) 145--- testing: -9223372034707292160 + 2147483647 --- 146int(-9223372032559808513) 147--- testing: -9223372034707292160 + 9223372036854775807 --- 148int(2147483647) 149--- testing: 2147483648 + 0 --- 150int(2147483648) 151--- testing: 2147483648 + 1 --- 152int(2147483649) 153--- testing: 2147483648 + -1 --- 154int(2147483647) 155--- testing: 2147483648 + 7 --- 156int(2147483655) 157--- testing: 2147483648 + 9 --- 158int(2147483657) 159--- testing: 2147483648 + 65 --- 160int(2147483713) 161--- testing: 2147483648 + -44 --- 162int(2147483604) 163--- testing: 2147483648 + 2147483647 --- 164int(4294967295) 165--- testing: 2147483648 + 9223372036854775807 --- 166float(9.22337203900226E+18) 167--- testing: -2147483649 + 0 --- 168int(-2147483649) 169--- testing: -2147483649 + 1 --- 170int(-2147483648) 171--- testing: -2147483649 + -1 --- 172int(-2147483650) 173--- testing: -2147483649 + 7 --- 174int(-2147483642) 175--- testing: -2147483649 + 9 --- 176int(-2147483640) 177--- testing: -2147483649 + 65 --- 178int(-2147483584) 179--- testing: -2147483649 + -44 --- 180int(-2147483693) 181--- testing: -2147483649 + 2147483647 --- 182int(-2) 183--- testing: -2147483649 + 9223372036854775807 --- 184int(9223372034707292158) 185--- testing: 4294967294 + 0 --- 186int(4294967294) 187--- testing: 4294967294 + 1 --- 188int(4294967295) 189--- testing: 4294967294 + -1 --- 190int(4294967293) 191--- testing: 4294967294 + 7 --- 192int(4294967301) 193--- testing: 4294967294 + 9 --- 194int(4294967303) 195--- testing: 4294967294 + 65 --- 196int(4294967359) 197--- testing: 4294967294 + -44 --- 198int(4294967250) 199--- testing: 4294967294 + 2147483647 --- 200int(6442450941) 201--- testing: 4294967294 + 9223372036854775807 --- 202float(9.223372041149743E+18) 203--- testing: 4294967295 + 0 --- 204int(4294967295) 205--- testing: 4294967295 + 1 --- 206int(4294967296) 207--- testing: 4294967295 + -1 --- 208int(4294967294) 209--- testing: 4294967295 + 7 --- 210int(4294967302) 211--- testing: 4294967295 + 9 --- 212int(4294967304) 213--- testing: 4294967295 + 65 --- 214int(4294967360) 215--- testing: 4294967295 + -44 --- 216int(4294967251) 217--- testing: 4294967295 + 2147483647 --- 218int(6442450942) 219--- testing: 4294967295 + 9223372036854775807 --- 220float(9.223372041149743E+18) 221--- testing: 4294967293 + 0 --- 222int(4294967293) 223--- testing: 4294967293 + 1 --- 224int(4294967294) 225--- testing: 4294967293 + -1 --- 226int(4294967292) 227--- testing: 4294967293 + 7 --- 228int(4294967300) 229--- testing: 4294967293 + 9 --- 230int(4294967302) 231--- testing: 4294967293 + 65 --- 232int(4294967358) 233--- testing: 4294967293 + -44 --- 234int(4294967249) 235--- testing: 4294967293 + 2147483647 --- 236int(6442450940) 237--- testing: 4294967293 + 9223372036854775807 --- 238float(9.223372041149743E+18) 239--- testing: 9223372036854775806 + 0 --- 240int(9223372036854775806) 241--- testing: 9223372036854775806 + 1 --- 242int(9223372036854775807) 243--- testing: 9223372036854775806 + -1 --- 244int(9223372036854775805) 245--- testing: 9223372036854775806 + 7 --- 246float(9.223372036854776E+18) 247--- testing: 9223372036854775806 + 9 --- 248float(9.223372036854776E+18) 249--- testing: 9223372036854775806 + 65 --- 250float(9.223372036854776E+18) 251--- testing: 9223372036854775806 + -44 --- 252int(9223372036854775762) 253--- testing: 9223372036854775806 + 2147483647 --- 254float(9.22337203900226E+18) 255--- testing: 9223372036854775806 + 9223372036854775807 --- 256float(1.8446744073709552E+19) 257--- testing: 9.2233720368548E+18 + 0 --- 258float(9.223372036854776E+18) 259--- testing: 9.2233720368548E+18 + 1 --- 260float(9.223372036854776E+18) 261--- testing: 9.2233720368548E+18 + -1 --- 262float(9.223372036854776E+18) 263--- testing: 9.2233720368548E+18 + 7 --- 264float(9.223372036854776E+18) 265--- testing: 9.2233720368548E+18 + 9 --- 266float(9.223372036854776E+18) 267--- testing: 9.2233720368548E+18 + 65 --- 268float(9.223372036854776E+18) 269--- testing: 9.2233720368548E+18 + -44 --- 270float(9.223372036854776E+18) 271--- testing: 9.2233720368548E+18 + 2147483647 --- 272float(9.22337203900226E+18) 273--- testing: 9.2233720368548E+18 + 9223372036854775807 --- 274float(1.8446744073709552E+19) 275--- testing: -9223372036854775807 + 0 --- 276int(-9223372036854775807) 277--- testing: -9223372036854775807 + 1 --- 278int(-9223372036854775806) 279--- testing: -9223372036854775807 + -1 --- 280int(-9223372036854775808) 281--- testing: -9223372036854775807 + 7 --- 282int(-9223372036854775800) 283--- testing: -9223372036854775807 + 9 --- 284int(-9223372036854775798) 285--- testing: -9223372036854775807 + 65 --- 286int(-9223372036854775742) 287--- testing: -9223372036854775807 + -44 --- 288float(-9.223372036854776E+18) 289--- testing: -9223372036854775807 + 2147483647 --- 290int(-9223372034707292160) 291--- testing: -9223372036854775807 + 9223372036854775807 --- 292int(0) 293--- testing: -9.2233720368548E+18 + 0 --- 294float(-9.223372036854776E+18) 295--- testing: -9.2233720368548E+18 + 1 --- 296float(-9.223372036854776E+18) 297--- testing: -9.2233720368548E+18 + -1 --- 298float(-9.223372036854776E+18) 299--- testing: -9.2233720368548E+18 + 7 --- 300float(-9.223372036854776E+18) 301--- testing: -9.2233720368548E+18 + 9 --- 302float(-9.223372036854776E+18) 303--- testing: -9.2233720368548E+18 + 65 --- 304float(-9.223372036854776E+18) 305--- testing: -9.2233720368548E+18 + -44 --- 306float(-9.223372036854776E+18) 307--- testing: -9.2233720368548E+18 + 2147483647 --- 308float(-9.223372034707292E+18) 309--- testing: -9.2233720368548E+18 + 9223372036854775807 --- 310float(0) 311--- testing: 0 + 9223372036854775807 --- 312int(9223372036854775807) 313--- testing: 0 + -9223372036854775808 --- 314int(-9223372036854775808) 315--- testing: 0 + 2147483647 --- 316int(2147483647) 317--- testing: 0 + -2147483648 --- 318int(-2147483648) 319--- testing: 0 + 9223372034707292160 --- 320int(9223372034707292160) 321--- testing: 0 + -9223372034707292160 --- 322int(-9223372034707292160) 323--- testing: 0 + 2147483648 --- 324int(2147483648) 325--- testing: 0 + -2147483649 --- 326int(-2147483649) 327--- testing: 0 + 4294967294 --- 328int(4294967294) 329--- testing: 0 + 4294967295 --- 330int(4294967295) 331--- testing: 0 + 4294967293 --- 332int(4294967293) 333--- testing: 0 + 9223372036854775806 --- 334int(9223372036854775806) 335--- testing: 0 + 9.2233720368548E+18 --- 336float(9.223372036854776E+18) 337--- testing: 0 + -9223372036854775807 --- 338int(-9223372036854775807) 339--- testing: 0 + -9.2233720368548E+18 --- 340float(-9.223372036854776E+18) 341--- testing: 1 + 9223372036854775807 --- 342float(9.223372036854776E+18) 343--- testing: 1 + -9223372036854775808 --- 344int(-9223372036854775807) 345--- testing: 1 + 2147483647 --- 346int(2147483648) 347--- testing: 1 + -2147483648 --- 348int(-2147483647) 349--- testing: 1 + 9223372034707292160 --- 350int(9223372034707292161) 351--- testing: 1 + -9223372034707292160 --- 352int(-9223372034707292159) 353--- testing: 1 + 2147483648 --- 354int(2147483649) 355--- testing: 1 + -2147483649 --- 356int(-2147483648) 357--- testing: 1 + 4294967294 --- 358int(4294967295) 359--- testing: 1 + 4294967295 --- 360int(4294967296) 361--- testing: 1 + 4294967293 --- 362int(4294967294) 363--- testing: 1 + 9223372036854775806 --- 364int(9223372036854775807) 365--- testing: 1 + 9.2233720368548E+18 --- 366float(9.223372036854776E+18) 367--- testing: 1 + -9223372036854775807 --- 368int(-9223372036854775806) 369--- testing: 1 + -9.2233720368548E+18 --- 370float(-9.223372036854776E+18) 371--- testing: -1 + 9223372036854775807 --- 372int(9223372036854775806) 373--- testing: -1 + -9223372036854775808 --- 374float(-9.223372036854776E+18) 375--- testing: -1 + 2147483647 --- 376int(2147483646) 377--- testing: -1 + -2147483648 --- 378int(-2147483649) 379--- testing: -1 + 9223372034707292160 --- 380int(9223372034707292159) 381--- testing: -1 + -9223372034707292160 --- 382int(-9223372034707292161) 383--- testing: -1 + 2147483648 --- 384int(2147483647) 385--- testing: -1 + -2147483649 --- 386int(-2147483650) 387--- testing: -1 + 4294967294 --- 388int(4294967293) 389--- testing: -1 + 4294967295 --- 390int(4294967294) 391--- testing: -1 + 4294967293 --- 392int(4294967292) 393--- testing: -1 + 9223372036854775806 --- 394int(9223372036854775805) 395--- testing: -1 + 9.2233720368548E+18 --- 396float(9.223372036854776E+18) 397--- testing: -1 + -9223372036854775807 --- 398int(-9223372036854775808) 399--- testing: -1 + -9.2233720368548E+18 --- 400float(-9.223372036854776E+18) 401--- testing: 7 + 9223372036854775807 --- 402float(9.223372036854776E+18) 403--- testing: 7 + -9223372036854775808 --- 404int(-9223372036854775801) 405--- testing: 7 + 2147483647 --- 406int(2147483654) 407--- testing: 7 + -2147483648 --- 408int(-2147483641) 409--- testing: 7 + 9223372034707292160 --- 410int(9223372034707292167) 411--- testing: 7 + -9223372034707292160 --- 412int(-9223372034707292153) 413--- testing: 7 + 2147483648 --- 414int(2147483655) 415--- testing: 7 + -2147483649 --- 416int(-2147483642) 417--- testing: 7 + 4294967294 --- 418int(4294967301) 419--- testing: 7 + 4294967295 --- 420int(4294967302) 421--- testing: 7 + 4294967293 --- 422int(4294967300) 423--- testing: 7 + 9223372036854775806 --- 424float(9.223372036854776E+18) 425--- testing: 7 + 9.2233720368548E+18 --- 426float(9.223372036854776E+18) 427--- testing: 7 + -9223372036854775807 --- 428int(-9223372036854775800) 429--- testing: 7 + -9.2233720368548E+18 --- 430float(-9.223372036854776E+18) 431--- testing: 9 + 9223372036854775807 --- 432float(9.223372036854776E+18) 433--- testing: 9 + -9223372036854775808 --- 434int(-9223372036854775799) 435--- testing: 9 + 2147483647 --- 436int(2147483656) 437--- testing: 9 + -2147483648 --- 438int(-2147483639) 439--- testing: 9 + 9223372034707292160 --- 440int(9223372034707292169) 441--- testing: 9 + -9223372034707292160 --- 442int(-9223372034707292151) 443--- testing: 9 + 2147483648 --- 444int(2147483657) 445--- testing: 9 + -2147483649 --- 446int(-2147483640) 447--- testing: 9 + 4294967294 --- 448int(4294967303) 449--- testing: 9 + 4294967295 --- 450int(4294967304) 451--- testing: 9 + 4294967293 --- 452int(4294967302) 453--- testing: 9 + 9223372036854775806 --- 454float(9.223372036854776E+18) 455--- testing: 9 + 9.2233720368548E+18 --- 456float(9.223372036854776E+18) 457--- testing: 9 + -9223372036854775807 --- 458int(-9223372036854775798) 459--- testing: 9 + -9.2233720368548E+18 --- 460float(-9.223372036854776E+18) 461--- testing: 65 + 9223372036854775807 --- 462float(9.223372036854776E+18) 463--- testing: 65 + -9223372036854775808 --- 464int(-9223372036854775743) 465--- testing: 65 + 2147483647 --- 466int(2147483712) 467--- testing: 65 + -2147483648 --- 468int(-2147483583) 469--- testing: 65 + 9223372034707292160 --- 470int(9223372034707292225) 471--- testing: 65 + -9223372034707292160 --- 472int(-9223372034707292095) 473--- testing: 65 + 2147483648 --- 474int(2147483713) 475--- testing: 65 + -2147483649 --- 476int(-2147483584) 477--- testing: 65 + 4294967294 --- 478int(4294967359) 479--- testing: 65 + 4294967295 --- 480int(4294967360) 481--- testing: 65 + 4294967293 --- 482int(4294967358) 483--- testing: 65 + 9223372036854775806 --- 484float(9.223372036854776E+18) 485--- testing: 65 + 9.2233720368548E+18 --- 486float(9.223372036854776E+18) 487--- testing: 65 + -9223372036854775807 --- 488int(-9223372036854775742) 489--- testing: 65 + -9.2233720368548E+18 --- 490float(-9.223372036854776E+18) 491--- testing: -44 + 9223372036854775807 --- 492int(9223372036854775763) 493--- testing: -44 + -9223372036854775808 --- 494float(-9.223372036854776E+18) 495--- testing: -44 + 2147483647 --- 496int(2147483603) 497--- testing: -44 + -2147483648 --- 498int(-2147483692) 499--- testing: -44 + 9223372034707292160 --- 500int(9223372034707292116) 501--- testing: -44 + -9223372034707292160 --- 502int(-9223372034707292204) 503--- testing: -44 + 2147483648 --- 504int(2147483604) 505--- testing: -44 + -2147483649 --- 506int(-2147483693) 507--- testing: -44 + 4294967294 --- 508int(4294967250) 509--- testing: -44 + 4294967295 --- 510int(4294967251) 511--- testing: -44 + 4294967293 --- 512int(4294967249) 513--- testing: -44 + 9223372036854775806 --- 514int(9223372036854775762) 515--- testing: -44 + 9.2233720368548E+18 --- 516float(9.223372036854776E+18) 517--- testing: -44 + -9223372036854775807 --- 518float(-9.223372036854776E+18) 519--- testing: -44 + -9.2233720368548E+18 --- 520float(-9.223372036854776E+18) 521--- testing: 2147483647 + 9223372036854775807 --- 522float(9.22337203900226E+18) 523--- testing: 2147483647 + -9223372036854775808 --- 524int(-9223372034707292161) 525--- testing: 2147483647 + 2147483647 --- 526int(4294967294) 527--- testing: 2147483647 + -2147483648 --- 528int(-1) 529--- testing: 2147483647 + 9223372034707292160 --- 530int(9223372036854775807) 531--- testing: 2147483647 + -9223372034707292160 --- 532int(-9223372032559808513) 533--- testing: 2147483647 + 2147483648 --- 534int(4294967295) 535--- testing: 2147483647 + -2147483649 --- 536int(-2) 537--- testing: 2147483647 + 4294967294 --- 538int(6442450941) 539--- testing: 2147483647 + 4294967295 --- 540int(6442450942) 541--- testing: 2147483647 + 4294967293 --- 542int(6442450940) 543--- testing: 2147483647 + 9223372036854775806 --- 544float(9.22337203900226E+18) 545--- testing: 2147483647 + 9.2233720368548E+18 --- 546float(9.22337203900226E+18) 547--- testing: 2147483647 + -9223372036854775807 --- 548int(-9223372034707292160) 549--- testing: 2147483647 + -9.2233720368548E+18 --- 550float(-9.223372034707292E+18) 551--- testing: 9223372036854775807 + 9223372036854775807 --- 552float(1.8446744073709552E+19) 553--- testing: 9223372036854775807 + -9223372036854775808 --- 554int(-1) 555--- testing: 9223372036854775807 + 2147483647 --- 556float(9.22337203900226E+18) 557--- testing: 9223372036854775807 + -2147483648 --- 558int(9223372034707292159) 559--- testing: 9223372036854775807 + 9223372034707292160 --- 560float(1.8446744071562068E+19) 561--- testing: 9223372036854775807 + -9223372034707292160 --- 562int(2147483647) 563--- testing: 9223372036854775807 + 2147483648 --- 564float(9.22337203900226E+18) 565--- testing: 9223372036854775807 + -2147483649 --- 566int(9223372034707292158) 567--- testing: 9223372036854775807 + 4294967294 --- 568float(9.223372041149743E+18) 569--- testing: 9223372036854775807 + 4294967295 --- 570float(9.223372041149743E+18) 571--- testing: 9223372036854775807 + 4294967293 --- 572float(9.223372041149743E+18) 573--- testing: 9223372036854775807 + 9223372036854775806 --- 574float(1.8446744073709552E+19) 575--- testing: 9223372036854775807 + 9.2233720368548E+18 --- 576float(1.8446744073709552E+19) 577--- testing: 9223372036854775807 + -9223372036854775807 --- 578int(0) 579--- testing: 9223372036854775807 + -9.2233720368548E+18 --- 580float(0) 581