1--TEST-- 2Test fmod function : 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, MIN_32Bit, MAX_64Bit, MIN_64Bit); 22 23 24foreach ($longVals as $longVal) { 25 foreach($otherVals as $otherVal) { 26 echo "--- testing: $longVal, $otherVal ---\n"; 27 var_dump(fmod($longVal, $otherVal)); 28 } 29} 30 31?> 32--EXPECT-- 33--- testing: 9223372036854775807, 0 --- 34float(NAN) 35--- testing: 9223372036854775807, 1 --- 36float(0) 37--- testing: 9223372036854775807, -1 --- 38float(0) 39--- testing: 9223372036854775807, 7 --- 40float(1) 41--- testing: 9223372036854775807, 9 --- 42float(8) 43--- testing: 9223372036854775807, 65 --- 44float(8) 45--- testing: 9223372036854775807, -44 --- 46float(8) 47--- testing: 9223372036854775807, 2147483647 --- 48float(2) 49--- testing: 9223372036854775807, -2147483648 --- 50float(0) 51--- testing: 9223372036854775807, 9223372036854775807 --- 52float(0) 53--- testing: 9223372036854775807, -9223372036854775808 --- 54float(0) 55--- testing: -9223372036854775808, 0 --- 56float(NAN) 57--- testing: -9223372036854775808, 1 --- 58float(-0) 59--- testing: -9223372036854775808, -1 --- 60float(-0) 61--- testing: -9223372036854775808, 7 --- 62float(-1) 63--- testing: -9223372036854775808, 9 --- 64float(-8) 65--- testing: -9223372036854775808, 65 --- 66float(-8) 67--- testing: -9223372036854775808, -44 --- 68float(-8) 69--- testing: -9223372036854775808, 2147483647 --- 70float(-2) 71--- testing: -9223372036854775808, -2147483648 --- 72float(-0) 73--- testing: -9223372036854775808, 9223372036854775807 --- 74float(-0) 75--- testing: -9223372036854775808, -9223372036854775808 --- 76float(-0) 77--- testing: 2147483647, 0 --- 78float(NAN) 79--- testing: 2147483647, 1 --- 80float(0) 81--- testing: 2147483647, -1 --- 82float(0) 83--- testing: 2147483647, 7 --- 84float(1) 85--- testing: 2147483647, 9 --- 86float(1) 87--- testing: 2147483647, 65 --- 88float(62) 89--- testing: 2147483647, -44 --- 90float(23) 91--- testing: 2147483647, 2147483647 --- 92float(0) 93--- testing: 2147483647, -2147483648 --- 94float(2147483647) 95--- testing: 2147483647, 9223372036854775807 --- 96float(2147483647) 97--- testing: 2147483647, -9223372036854775808 --- 98float(2147483647) 99--- testing: -2147483648, 0 --- 100float(NAN) 101--- testing: -2147483648, 1 --- 102float(-0) 103--- testing: -2147483648, -1 --- 104float(-0) 105--- testing: -2147483648, 7 --- 106float(-2) 107--- testing: -2147483648, 9 --- 108float(-2) 109--- testing: -2147483648, 65 --- 110float(-63) 111--- testing: -2147483648, -44 --- 112float(-24) 113--- testing: -2147483648, 2147483647 --- 114float(-1) 115--- testing: -2147483648, -2147483648 --- 116float(-0) 117--- testing: -2147483648, 9223372036854775807 --- 118float(-2147483648) 119--- testing: -2147483648, -9223372036854775808 --- 120float(-2147483648) 121--- testing: 9223372034707292160, 0 --- 122float(NAN) 123--- testing: 9223372034707292160, 1 --- 124float(0) 125--- testing: 9223372034707292160, -1 --- 126float(0) 127--- testing: 9223372034707292160, 7 --- 128float(6) 129--- testing: 9223372034707292160, 9 --- 130float(6) 131--- testing: 9223372034707292160, 65 --- 132float(10) 133--- testing: 9223372034707292160, -44 --- 134float(28) 135--- testing: 9223372034707292160, 2147483647 --- 136float(1) 137--- testing: 9223372034707292160, -2147483648 --- 138float(0) 139--- testing: 9223372034707292160, 9223372036854775807 --- 140float(9.223372034707292E+18) 141--- testing: 9223372034707292160, -9223372036854775808 --- 142float(9.223372034707292E+18) 143--- testing: -9223372034707292160, 0 --- 144float(NAN) 145--- testing: -9223372034707292160, 1 --- 146float(-0) 147--- testing: -9223372034707292160, -1 --- 148float(-0) 149--- testing: -9223372034707292160, 7 --- 150float(-6) 151--- testing: -9223372034707292160, 9 --- 152float(-6) 153--- testing: -9223372034707292160, 65 --- 154float(-10) 155--- testing: -9223372034707292160, -44 --- 156float(-28) 157--- testing: -9223372034707292160, 2147483647 --- 158float(-1) 159--- testing: -9223372034707292160, -2147483648 --- 160float(-0) 161--- testing: -9223372034707292160, 9223372036854775807 --- 162float(-9.223372034707292E+18) 163--- testing: -9223372034707292160, -9223372036854775808 --- 164float(-9.223372034707292E+18) 165--- testing: 2147483648, 0 --- 166float(NAN) 167--- testing: 2147483648, 1 --- 168float(0) 169--- testing: 2147483648, -1 --- 170float(0) 171--- testing: 2147483648, 7 --- 172float(2) 173--- testing: 2147483648, 9 --- 174float(2) 175--- testing: 2147483648, 65 --- 176float(63) 177--- testing: 2147483648, -44 --- 178float(24) 179--- testing: 2147483648, 2147483647 --- 180float(1) 181--- testing: 2147483648, -2147483648 --- 182float(0) 183--- testing: 2147483648, 9223372036854775807 --- 184float(2147483648) 185--- testing: 2147483648, -9223372036854775808 --- 186float(2147483648) 187--- testing: -2147483649, 0 --- 188float(NAN) 189--- testing: -2147483649, 1 --- 190float(-0) 191--- testing: -2147483649, -1 --- 192float(-0) 193--- testing: -2147483649, 7 --- 194float(-3) 195--- testing: -2147483649, 9 --- 196float(-3) 197--- testing: -2147483649, 65 --- 198float(-64) 199--- testing: -2147483649, -44 --- 200float(-25) 201--- testing: -2147483649, 2147483647 --- 202float(-2) 203--- testing: -2147483649, -2147483648 --- 204float(-1) 205--- testing: -2147483649, 9223372036854775807 --- 206float(-2147483649) 207--- testing: -2147483649, -9223372036854775808 --- 208float(-2147483649) 209--- testing: 4294967294, 0 --- 210float(NAN) 211--- testing: 4294967294, 1 --- 212float(0) 213--- testing: 4294967294, -1 --- 214float(0) 215--- testing: 4294967294, 7 --- 216float(2) 217--- testing: 4294967294, 9 --- 218float(2) 219--- testing: 4294967294, 65 --- 220float(59) 221--- testing: 4294967294, -44 --- 222float(2) 223--- testing: 4294967294, 2147483647 --- 224float(0) 225--- testing: 4294967294, -2147483648 --- 226float(2147483646) 227--- testing: 4294967294, 9223372036854775807 --- 228float(4294967294) 229--- testing: 4294967294, -9223372036854775808 --- 230float(4294967294) 231--- testing: 4294967295, 0 --- 232float(NAN) 233--- testing: 4294967295, 1 --- 234float(0) 235--- testing: 4294967295, -1 --- 236float(0) 237--- testing: 4294967295, 7 --- 238float(3) 239--- testing: 4294967295, 9 --- 240float(3) 241--- testing: 4294967295, 65 --- 242float(60) 243--- testing: 4294967295, -44 --- 244float(3) 245--- testing: 4294967295, 2147483647 --- 246float(1) 247--- testing: 4294967295, -2147483648 --- 248float(2147483647) 249--- testing: 4294967295, 9223372036854775807 --- 250float(4294967295) 251--- testing: 4294967295, -9223372036854775808 --- 252float(4294967295) 253--- testing: 4294967293, 0 --- 254float(NAN) 255--- testing: 4294967293, 1 --- 256float(0) 257--- testing: 4294967293, -1 --- 258float(0) 259--- testing: 4294967293, 7 --- 260float(1) 261--- testing: 4294967293, 9 --- 262float(1) 263--- testing: 4294967293, 65 --- 264float(58) 265--- testing: 4294967293, -44 --- 266float(1) 267--- testing: 4294967293, 2147483647 --- 268float(2147483646) 269--- testing: 4294967293, -2147483648 --- 270float(2147483645) 271--- testing: 4294967293, 9223372036854775807 --- 272float(4294967293) 273--- testing: 4294967293, -9223372036854775808 --- 274float(4294967293) 275--- testing: 9223372036854775806, 0 --- 276float(NAN) 277--- testing: 9223372036854775806, 1 --- 278float(0) 279--- testing: 9223372036854775806, -1 --- 280float(0) 281--- testing: 9223372036854775806, 7 --- 282float(1) 283--- testing: 9223372036854775806, 9 --- 284float(8) 285--- testing: 9223372036854775806, 65 --- 286float(8) 287--- testing: 9223372036854775806, -44 --- 288float(8) 289--- testing: 9223372036854775806, 2147483647 --- 290float(2) 291--- testing: 9223372036854775806, -2147483648 --- 292float(0) 293--- testing: 9223372036854775806, 9223372036854775807 --- 294float(0) 295--- testing: 9223372036854775806, -9223372036854775808 --- 296float(0) 297--- testing: 9.2233720368548E+18, 0 --- 298float(NAN) 299--- testing: 9.2233720368548E+18, 1 --- 300float(0) 301--- testing: 9.2233720368548E+18, -1 --- 302float(0) 303--- testing: 9.2233720368548E+18, 7 --- 304float(1) 305--- testing: 9.2233720368548E+18, 9 --- 306float(8) 307--- testing: 9.2233720368548E+18, 65 --- 308float(8) 309--- testing: 9.2233720368548E+18, -44 --- 310float(8) 311--- testing: 9.2233720368548E+18, 2147483647 --- 312float(2) 313--- testing: 9.2233720368548E+18, -2147483648 --- 314float(0) 315--- testing: 9.2233720368548E+18, 9223372036854775807 --- 316float(0) 317--- testing: 9.2233720368548E+18, -9223372036854775808 --- 318float(0) 319--- testing: -9223372036854775807, 0 --- 320float(NAN) 321--- testing: -9223372036854775807, 1 --- 322float(-0) 323--- testing: -9223372036854775807, -1 --- 324float(-0) 325--- testing: -9223372036854775807, 7 --- 326float(-1) 327--- testing: -9223372036854775807, 9 --- 328float(-8) 329--- testing: -9223372036854775807, 65 --- 330float(-8) 331--- testing: -9223372036854775807, -44 --- 332float(-8) 333--- testing: -9223372036854775807, 2147483647 --- 334float(-2) 335--- testing: -9223372036854775807, -2147483648 --- 336float(-0) 337--- testing: -9223372036854775807, 9223372036854775807 --- 338float(-0) 339--- testing: -9223372036854775807, -9223372036854775808 --- 340float(-0) 341--- testing: -9.2233720368548E+18, 0 --- 342float(NAN) 343--- testing: -9.2233720368548E+18, 1 --- 344float(-0) 345--- testing: -9.2233720368548E+18, -1 --- 346float(-0) 347--- testing: -9.2233720368548E+18, 7 --- 348float(-1) 349--- testing: -9.2233720368548E+18, 9 --- 350float(-8) 351--- testing: -9.2233720368548E+18, 65 --- 352float(-8) 353--- testing: -9.2233720368548E+18, -44 --- 354float(-8) 355--- testing: -9.2233720368548E+18, 2147483647 --- 356float(-2) 357--- testing: -9.2233720368548E+18, -2147483648 --- 358float(-0) 359--- testing: -9.2233720368548E+18, 9223372036854775807 --- 360float(-0) 361--- testing: -9.2233720368548E+18, -9223372036854775808 --- 362float(-0) 363