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(0) 43--- testing: 9223372036854775807 * 1 --- 44int(9223372036854775807) 45--- testing: 9223372036854775807 * -1 --- 46int(-9223372036854775807) 47--- testing: 9223372036854775807 * 7 --- 48float(6.456360425798343E+19) 49--- testing: 9223372036854775807 * 9 --- 50float(8.301034833169298E+19) 51--- testing: 9223372036854775807 * 65 --- 52float(5.995191823955604E+20) 53--- testing: 9223372036854775807 * -44 --- 54float(-4.0582836962161014E+20) 55--- testing: 9223372036854775807 * 2147483647 --- 56float(1.9807040619342712E+28) 57--- testing: 9223372036854775807 * 9223372036854775807 --- 58float(8.507059173023462E+37) 59--- testing: -9223372036854775808 * 0 --- 60int(0) 61--- testing: -9223372036854775808 * 1 --- 62int(-9223372036854775808) 63--- testing: -9223372036854775808 * -1 --- 64float(9.223372036854776E+18) 65--- testing: -9223372036854775808 * 7 --- 66float(-6.456360425798343E+19) 67--- testing: -9223372036854775808 * 9 --- 68float(-8.301034833169298E+19) 69--- testing: -9223372036854775808 * 65 --- 70float(-5.995191823955604E+20) 71--- testing: -9223372036854775808 * -44 --- 72float(4.0582836962161014E+20) 73--- testing: -9223372036854775808 * 2147483647 --- 74float(-1.9807040619342712E+28) 75--- testing: -9223372036854775808 * 9223372036854775807 --- 76float(-8.507059173023462E+37) 77--- testing: 2147483647 * 0 --- 78int(0) 79--- testing: 2147483647 * 1 --- 80int(2147483647) 81--- testing: 2147483647 * -1 --- 82int(-2147483647) 83--- testing: 2147483647 * 7 --- 84int(15032385529) 85--- testing: 2147483647 * 9 --- 86int(19327352823) 87--- testing: 2147483647 * 65 --- 88int(139586437055) 89--- testing: 2147483647 * -44 --- 90int(-94489280468) 91--- testing: 2147483647 * 2147483647 --- 92int(4611686014132420609) 93--- testing: 2147483647 * 9223372036854775807 --- 94float(1.9807040619342712E+28) 95--- testing: -2147483648 * 0 --- 96int(0) 97--- testing: -2147483648 * 1 --- 98int(-2147483648) 99--- testing: -2147483648 * -1 --- 100int(2147483648) 101--- testing: -2147483648 * 7 --- 102int(-15032385536) 103--- testing: -2147483648 * 9 --- 104int(-19327352832) 105--- testing: -2147483648 * 65 --- 106int(-139586437120) 107--- testing: -2147483648 * -44 --- 108int(94489280512) 109--- testing: -2147483648 * 2147483647 --- 110int(-4611686016279904256) 111--- testing: -2147483648 * 9223372036854775807 --- 112float(-1.9807040628566084E+28) 113--- testing: 9223372034707292160 * 0 --- 114int(0) 115--- testing: 9223372034707292160 * 1 --- 116int(9223372034707292160) 117--- testing: 9223372034707292160 * -1 --- 118int(-9223372034707292160) 119--- testing: 9223372034707292160 * 7 --- 120float(6.4563604242951045E+19) 121--- testing: 9223372034707292160 * 9 --- 122float(8.301034831236563E+19) 123--- testing: 9223372034707292160 * 65 --- 124float(5.99519182255974E+20) 125--- testing: 9223372034707292160 * -44 --- 126float(-4.0582836952712086E+20) 127--- testing: 9223372034707292160 * 2147483647 --- 128float(1.9807040614731026E+28) 129--- testing: 9223372034707292160 * 9223372036854775807 --- 130float(8.5070591710427575E+37) 131--- testing: -9223372034707292160 * 0 --- 132int(0) 133--- testing: -9223372034707292160 * 1 --- 134int(-9223372034707292160) 135--- testing: -9223372034707292160 * -1 --- 136int(9223372034707292160) 137--- testing: -9223372034707292160 * 7 --- 138float(-6.4563604242951045E+19) 139--- testing: -9223372034707292160 * 9 --- 140float(-8.301034831236563E+19) 141--- testing: -9223372034707292160 * 65 --- 142float(-5.99519182255974E+20) 143--- testing: -9223372034707292160 * -44 --- 144float(4.0582836952712086E+20) 145--- testing: -9223372034707292160 * 2147483647 --- 146float(-1.9807040614731026E+28) 147--- testing: -9223372034707292160 * 9223372036854775807 --- 148float(-8.5070591710427575E+37) 149--- testing: 2147483648 * 0 --- 150int(0) 151--- testing: 2147483648 * 1 --- 152int(2147483648) 153--- testing: 2147483648 * -1 --- 154int(-2147483648) 155--- testing: 2147483648 * 7 --- 156int(15032385536) 157--- testing: 2147483648 * 9 --- 158int(19327352832) 159--- testing: 2147483648 * 65 --- 160int(139586437120) 161--- testing: 2147483648 * -44 --- 162int(-94489280512) 163--- testing: 2147483648 * 2147483647 --- 164int(4611686016279904256) 165--- testing: 2147483648 * 9223372036854775807 --- 166float(1.9807040628566084E+28) 167--- testing: -2147483649 * 0 --- 168int(0) 169--- testing: -2147483649 * 1 --- 170int(-2147483649) 171--- testing: -2147483649 * -1 --- 172int(2147483649) 173--- testing: -2147483649 * 7 --- 174int(-15032385543) 175--- testing: -2147483649 * 9 --- 176int(-19327352841) 177--- testing: -2147483649 * 65 --- 178int(-139586437185) 179--- testing: -2147483649 * -44 --- 180int(94489280556) 181--- testing: -2147483649 * 2147483647 --- 182int(-4611686018427387903) 183--- testing: -2147483649 * 9223372036854775807 --- 184float(-1.9807040637789456E+28) 185--- testing: 4294967294 * 0 --- 186int(0) 187--- testing: 4294967294 * 1 --- 188int(4294967294) 189--- testing: 4294967294 * -1 --- 190int(-4294967294) 191--- testing: 4294967294 * 7 --- 192int(30064771058) 193--- testing: 4294967294 * 9 --- 194int(38654705646) 195--- testing: 4294967294 * 65 --- 196int(279172874110) 197--- testing: 4294967294 * -44 --- 198int(-188978560936) 199--- testing: 4294967294 * 2147483647 --- 200int(9223372028264841218) 201--- testing: 4294967294 * 9223372036854775807 --- 202float(3.9614081238685425E+28) 203--- testing: 4294967295 * 0 --- 204int(0) 205--- testing: 4294967295 * 1 --- 206int(4294967295) 207--- testing: 4294967295 * -1 --- 208int(-4294967295) 209--- testing: 4294967295 * 7 --- 210int(30064771065) 211--- testing: 4294967295 * 9 --- 212int(38654705655) 213--- testing: 4294967295 * 65 --- 214int(279172874175) 215--- testing: 4294967295 * -44 --- 216int(-188978560980) 217--- testing: 4294967295 * 2147483647 --- 218int(9223372030412324865) 219--- testing: 4294967295 * 9223372036854775807 --- 220float(3.9614081247908797E+28) 221--- testing: 4294967293 * 0 --- 222int(0) 223--- testing: 4294967293 * 1 --- 224int(4294967293) 225--- testing: 4294967293 * -1 --- 226int(-4294967293) 227--- testing: 4294967293 * 7 --- 228int(30064771051) 229--- testing: 4294967293 * 9 --- 230int(38654705637) 231--- testing: 4294967293 * 65 --- 232int(279172874045) 233--- testing: 4294967293 * -44 --- 234int(-188978560892) 235--- testing: 4294967293 * 2147483647 --- 236int(9223372026117357571) 237--- testing: 4294967293 * 9223372036854775807 --- 238float(3.9614081229462053E+28) 239--- testing: 9223372036854775806 * 0 --- 240int(0) 241--- testing: 9223372036854775806 * 1 --- 242int(9223372036854775806) 243--- testing: 9223372036854775806 * -1 --- 244int(-9223372036854775806) 245--- testing: 9223372036854775806 * 7 --- 246float(6.456360425798343E+19) 247--- testing: 9223372036854775806 * 9 --- 248float(8.301034833169298E+19) 249--- testing: 9223372036854775806 * 65 --- 250float(5.995191823955604E+20) 251--- testing: 9223372036854775806 * -44 --- 252float(-4.0582836962161014E+20) 253--- testing: 9223372036854775806 * 2147483647 --- 254float(1.9807040619342712E+28) 255--- testing: 9223372036854775806 * 9223372036854775807 --- 256float(8.507059173023462E+37) 257--- testing: 9.2233720368548E+18 * 0 --- 258float(0) 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(6.456360425798343E+19) 265--- testing: 9.2233720368548E+18 * 9 --- 266float(8.301034833169298E+19) 267--- testing: 9.2233720368548E+18 * 65 --- 268float(5.995191823955604E+20) 269--- testing: 9.2233720368548E+18 * -44 --- 270float(-4.0582836962161014E+20) 271--- testing: 9.2233720368548E+18 * 2147483647 --- 272float(1.9807040619342712E+28) 273--- testing: 9.2233720368548E+18 * 9223372036854775807 --- 274float(8.507059173023462E+37) 275--- testing: -9223372036854775807 * 0 --- 276int(0) 277--- testing: -9223372036854775807 * 1 --- 278int(-9223372036854775807) 279--- testing: -9223372036854775807 * -1 --- 280int(9223372036854775807) 281--- testing: -9223372036854775807 * 7 --- 282float(-6.456360425798343E+19) 283--- testing: -9223372036854775807 * 9 --- 284float(-8.301034833169298E+19) 285--- testing: -9223372036854775807 * 65 --- 286float(-5.995191823955604E+20) 287--- testing: -9223372036854775807 * -44 --- 288float(4.0582836962161014E+20) 289--- testing: -9223372036854775807 * 2147483647 --- 290float(-1.9807040619342712E+28) 291--- testing: -9223372036854775807 * 9223372036854775807 --- 292float(-8.507059173023462E+37) 293--- testing: -9.2233720368548E+18 * 0 --- 294float(-0) 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(-6.456360425798343E+19) 301--- testing: -9.2233720368548E+18 * 9 --- 302float(-8.301034833169298E+19) 303--- testing: -9.2233720368548E+18 * 65 --- 304float(-5.995191823955604E+20) 305--- testing: -9.2233720368548E+18 * -44 --- 306float(4.0582836962161014E+20) 307--- testing: -9.2233720368548E+18 * 2147483647 --- 308float(-1.9807040619342712E+28) 309--- testing: -9.2233720368548E+18 * 9223372036854775807 --- 310float(-8.507059173023462E+37) 311--- testing: 0 * 9223372036854775807 --- 312int(0) 313--- testing: 0 * -9223372036854775808 --- 314int(0) 315--- testing: 0 * 2147483647 --- 316int(0) 317--- testing: 0 * -2147483648 --- 318int(0) 319--- testing: 0 * 9223372034707292160 --- 320int(0) 321--- testing: 0 * -9223372034707292160 --- 322int(0) 323--- testing: 0 * 2147483648 --- 324int(0) 325--- testing: 0 * -2147483649 --- 326int(0) 327--- testing: 0 * 4294967294 --- 328int(0) 329--- testing: 0 * 4294967295 --- 330int(0) 331--- testing: 0 * 4294967293 --- 332int(0) 333--- testing: 0 * 9223372036854775806 --- 334int(0) 335--- testing: 0 * 9.2233720368548E+18 --- 336float(0) 337--- testing: 0 * -9223372036854775807 --- 338int(0) 339--- testing: 0 * -9.2233720368548E+18 --- 340float(-0) 341--- testing: 1 * 9223372036854775807 --- 342int(9223372036854775807) 343--- testing: 1 * -9223372036854775808 --- 344int(-9223372036854775808) 345--- testing: 1 * 2147483647 --- 346int(2147483647) 347--- testing: 1 * -2147483648 --- 348int(-2147483648) 349--- testing: 1 * 9223372034707292160 --- 350int(9223372034707292160) 351--- testing: 1 * -9223372034707292160 --- 352int(-9223372034707292160) 353--- testing: 1 * 2147483648 --- 354int(2147483648) 355--- testing: 1 * -2147483649 --- 356int(-2147483649) 357--- testing: 1 * 4294967294 --- 358int(4294967294) 359--- testing: 1 * 4294967295 --- 360int(4294967295) 361--- testing: 1 * 4294967293 --- 362int(4294967293) 363--- testing: 1 * 9223372036854775806 --- 364int(9223372036854775806) 365--- testing: 1 * 9.2233720368548E+18 --- 366float(9.223372036854776E+18) 367--- testing: 1 * -9223372036854775807 --- 368int(-9223372036854775807) 369--- testing: 1 * -9.2233720368548E+18 --- 370float(-9.223372036854776E+18) 371--- testing: -1 * 9223372036854775807 --- 372int(-9223372036854775807) 373--- testing: -1 * -9223372036854775808 --- 374float(9.223372036854776E+18) 375--- testing: -1 * 2147483647 --- 376int(-2147483647) 377--- testing: -1 * -2147483648 --- 378int(2147483648) 379--- testing: -1 * 9223372034707292160 --- 380int(-9223372034707292160) 381--- testing: -1 * -9223372034707292160 --- 382int(9223372034707292160) 383--- testing: -1 * 2147483648 --- 384int(-2147483648) 385--- testing: -1 * -2147483649 --- 386int(2147483649) 387--- testing: -1 * 4294967294 --- 388int(-4294967294) 389--- testing: -1 * 4294967295 --- 390int(-4294967295) 391--- testing: -1 * 4294967293 --- 392int(-4294967293) 393--- testing: -1 * 9223372036854775806 --- 394int(-9223372036854775806) 395--- testing: -1 * 9.2233720368548E+18 --- 396float(-9.223372036854776E+18) 397--- testing: -1 * -9223372036854775807 --- 398int(9223372036854775807) 399--- testing: -1 * -9.2233720368548E+18 --- 400float(9.223372036854776E+18) 401--- testing: 7 * 9223372036854775807 --- 402float(6.456360425798343E+19) 403--- testing: 7 * -9223372036854775808 --- 404float(-6.456360425798343E+19) 405--- testing: 7 * 2147483647 --- 406int(15032385529) 407--- testing: 7 * -2147483648 --- 408int(-15032385536) 409--- testing: 7 * 9223372034707292160 --- 410float(6.4563604242951045E+19) 411--- testing: 7 * -9223372034707292160 --- 412float(-6.4563604242951045E+19) 413--- testing: 7 * 2147483648 --- 414int(15032385536) 415--- testing: 7 * -2147483649 --- 416int(-15032385543) 417--- testing: 7 * 4294967294 --- 418int(30064771058) 419--- testing: 7 * 4294967295 --- 420int(30064771065) 421--- testing: 7 * 4294967293 --- 422int(30064771051) 423--- testing: 7 * 9223372036854775806 --- 424float(6.456360425798343E+19) 425--- testing: 7 * 9.2233720368548E+18 --- 426float(6.456360425798343E+19) 427--- testing: 7 * -9223372036854775807 --- 428float(-6.456360425798343E+19) 429--- testing: 7 * -9.2233720368548E+18 --- 430float(-6.456360425798343E+19) 431--- testing: 9 * 9223372036854775807 --- 432float(8.301034833169298E+19) 433--- testing: 9 * -9223372036854775808 --- 434float(-8.301034833169298E+19) 435--- testing: 9 * 2147483647 --- 436int(19327352823) 437--- testing: 9 * -2147483648 --- 438int(-19327352832) 439--- testing: 9 * 9223372034707292160 --- 440float(8.301034831236563E+19) 441--- testing: 9 * -9223372034707292160 --- 442float(-8.301034831236563E+19) 443--- testing: 9 * 2147483648 --- 444int(19327352832) 445--- testing: 9 * -2147483649 --- 446int(-19327352841) 447--- testing: 9 * 4294967294 --- 448int(38654705646) 449--- testing: 9 * 4294967295 --- 450int(38654705655) 451--- testing: 9 * 4294967293 --- 452int(38654705637) 453--- testing: 9 * 9223372036854775806 --- 454float(8.301034833169298E+19) 455--- testing: 9 * 9.2233720368548E+18 --- 456float(8.301034833169298E+19) 457--- testing: 9 * -9223372036854775807 --- 458float(-8.301034833169298E+19) 459--- testing: 9 * -9.2233720368548E+18 --- 460float(-8.301034833169298E+19) 461--- testing: 65 * 9223372036854775807 --- 462float(5.995191823955604E+20) 463--- testing: 65 * -9223372036854775808 --- 464float(-5.995191823955604E+20) 465--- testing: 65 * 2147483647 --- 466int(139586437055) 467--- testing: 65 * -2147483648 --- 468int(-139586437120) 469--- testing: 65 * 9223372034707292160 --- 470float(5.99519182255974E+20) 471--- testing: 65 * -9223372034707292160 --- 472float(-5.99519182255974E+20) 473--- testing: 65 * 2147483648 --- 474int(139586437120) 475--- testing: 65 * -2147483649 --- 476int(-139586437185) 477--- testing: 65 * 4294967294 --- 478int(279172874110) 479--- testing: 65 * 4294967295 --- 480int(279172874175) 481--- testing: 65 * 4294967293 --- 482int(279172874045) 483--- testing: 65 * 9223372036854775806 --- 484float(5.995191823955604E+20) 485--- testing: 65 * 9.2233720368548E+18 --- 486float(5.995191823955604E+20) 487--- testing: 65 * -9223372036854775807 --- 488float(-5.995191823955604E+20) 489--- testing: 65 * -9.2233720368548E+18 --- 490float(-5.995191823955604E+20) 491--- testing: -44 * 9223372036854775807 --- 492float(-4.0582836962161014E+20) 493--- testing: -44 * -9223372036854775808 --- 494float(4.0582836962161014E+20) 495--- testing: -44 * 2147483647 --- 496int(-94489280468) 497--- testing: -44 * -2147483648 --- 498int(94489280512) 499--- testing: -44 * 9223372034707292160 --- 500float(-4.0582836952712086E+20) 501--- testing: -44 * -9223372034707292160 --- 502float(4.0582836952712086E+20) 503--- testing: -44 * 2147483648 --- 504int(-94489280512) 505--- testing: -44 * -2147483649 --- 506int(94489280556) 507--- testing: -44 * 4294967294 --- 508int(-188978560936) 509--- testing: -44 * 4294967295 --- 510int(-188978560980) 511--- testing: -44 * 4294967293 --- 512int(-188978560892) 513--- testing: -44 * 9223372036854775806 --- 514float(-4.0582836962161014E+20) 515--- testing: -44 * 9.2233720368548E+18 --- 516float(-4.0582836962161014E+20) 517--- testing: -44 * -9223372036854775807 --- 518float(4.0582836962161014E+20) 519--- testing: -44 * -9.2233720368548E+18 --- 520float(4.0582836962161014E+20) 521--- testing: 2147483647 * 9223372036854775807 --- 522float(1.9807040619342712E+28) 523--- testing: 2147483647 * -9223372036854775808 --- 524float(-1.9807040619342712E+28) 525--- testing: 2147483647 * 2147483647 --- 526int(4611686014132420609) 527--- testing: 2147483647 * -2147483648 --- 528int(-4611686016279904256) 529--- testing: 2147483647 * 9223372034707292160 --- 530float(1.9807040614731026E+28) 531--- testing: 2147483647 * -9223372034707292160 --- 532float(-1.9807040614731026E+28) 533--- testing: 2147483647 * 2147483648 --- 534int(4611686016279904256) 535--- testing: 2147483647 * -2147483649 --- 536int(-4611686018427387903) 537--- testing: 2147483647 * 4294967294 --- 538int(9223372028264841218) 539--- testing: 2147483647 * 4294967295 --- 540int(9223372030412324865) 541--- testing: 2147483647 * 4294967293 --- 542int(9223372026117357571) 543--- testing: 2147483647 * 9223372036854775806 --- 544float(1.9807040619342712E+28) 545--- testing: 2147483647 * 9.2233720368548E+18 --- 546float(1.9807040619342712E+28) 547--- testing: 2147483647 * -9223372036854775807 --- 548float(-1.9807040619342712E+28) 549--- testing: 2147483647 * -9.2233720368548E+18 --- 550float(-1.9807040619342712E+28) 551--- testing: 9223372036854775807 * 9223372036854775807 --- 552float(8.507059173023462E+37) 553--- testing: 9223372036854775807 * -9223372036854775808 --- 554float(-8.507059173023462E+37) 555--- testing: 9223372036854775807 * 2147483647 --- 556float(1.9807040619342712E+28) 557--- testing: 9223372036854775807 * -2147483648 --- 558float(-1.9807040628566084E+28) 559--- testing: 9223372036854775807 * 9223372034707292160 --- 560float(8.5070591710427575E+37) 561--- testing: 9223372036854775807 * -9223372034707292160 --- 562float(-8.5070591710427575E+37) 563--- testing: 9223372036854775807 * 2147483648 --- 564float(1.9807040628566084E+28) 565--- testing: 9223372036854775807 * -2147483649 --- 566float(-1.9807040637789456E+28) 567--- testing: 9223372036854775807 * 4294967294 --- 568float(3.9614081238685425E+28) 569--- testing: 9223372036854775807 * 4294967295 --- 570float(3.9614081247908797E+28) 571--- testing: 9223372036854775807 * 4294967293 --- 572float(3.9614081229462053E+28) 573--- testing: 9223372036854775807 * 9223372036854775806 --- 574float(8.507059173023462E+37) 575--- testing: 9223372036854775807 * 9.2233720368548E+18 --- 576float(8.507059173023462E+37) 577--- testing: 9223372036854775807 * -9223372036854775807 --- 578float(-8.507059173023462E+37) 579--- testing: 9223372036854775807 * -9.2233720368548E+18 --- 580float(-8.507059173023462E+37) 581