1--TEST-- 2bcmod() function 3--EXTENSIONS-- 4bcmath 5--INI-- 6bcmath.scale=0 7--FILE-- 8<?php 9require(__DIR__ . "/run_bcmath_tests_function.inc"); 10 11$dividends = ["15", "-15", "1", "-9", "14.14", "-16.60", "0.15", "-0.01"]; 12$divisors = array_merge($dividends, [ 13 "15151324141414.412312232141241", 14 "-132132245132134.1515123765412", 15 "141241241241241248267654747412", 16 "-149143276547656984948124912", 17 "0.1322135476547459213732911312", 18 "-0.123912932193769965476541321", 19]); 20 21run_bcmath_tests($dividends, $divisors, "mod", bcmod(...)); 22 23?> 24--EXPECT-- 25Number "15" (scale 0) 2615 mod 15 = 0 2715 mod -15 = 0 2815 mod 1 = 0 2915 mod -9 = 6 3015 mod 14.14 = 0 3115 mod -16.60 = 15 3215 mod 0.15 = 0 3315 mod -0.01 = 0 3415 mod 15151324141414.412312232141241 = 15 3515 mod -132132245132134.1515123765412 = 15 3615 mod 141241241241241248267654747412 = 15 3715 mod -149143276547656984948124912 = 15 3815 mod 0.1322135476547459213732911312 = 0 3915 mod -0.123912932193769965476541321 = 0 40 41Number "-15" (scale 0) 42-15 mod 15 = 0 43-15 mod -15 = 0 44-15 mod 1 = 0 45-15 mod -9 = -6 46-15 mod 14.14 = 0 47-15 mod -16.60 = -15 48-15 mod 0.15 = 0 49-15 mod -0.01 = 0 50-15 mod 15151324141414.412312232141241 = -15 51-15 mod -132132245132134.1515123765412 = -15 52-15 mod 141241241241241248267654747412 = -15 53-15 mod -149143276547656984948124912 = -15 54-15 mod 0.1322135476547459213732911312 = 0 55-15 mod -0.123912932193769965476541321 = 0 56 57Number "1" (scale 0) 581 mod 15 = 1 591 mod -15 = 1 601 mod 1 = 0 611 mod -9 = 1 621 mod 14.14 = 1 631 mod -16.60 = 1 641 mod 0.15 = 0 651 mod -0.01 = 0 661 mod 15151324141414.412312232141241 = 1 671 mod -132132245132134.1515123765412 = 1 681 mod 141241241241241248267654747412 = 1 691 mod -149143276547656984948124912 = 1 701 mod 0.1322135476547459213732911312 = 0 711 mod -0.123912932193769965476541321 = 0 72 73Number "-9" (scale 0) 74-9 mod 15 = -9 75-9 mod -15 = -9 76-9 mod 1 = 0 77-9 mod -9 = 0 78-9 mod 14.14 = -9 79-9 mod -16.60 = -9 80-9 mod 0.15 = 0 81-9 mod -0.01 = 0 82-9 mod 15151324141414.412312232141241 = -9 83-9 mod -132132245132134.1515123765412 = -9 84-9 mod 141241241241241248267654747412 = -9 85-9 mod -149143276547656984948124912 = -9 86-9 mod 0.1322135476547459213732911312 = 0 87-9 mod -0.123912932193769965476541321 = 0 88 89Number "14.14" (scale 0) 9014.14 mod 15 = 14 9114.14 mod -15 = 14 9214.14 mod 1 = 0 9314.14 mod -9 = 5 9414.14 mod 14.14 = 0 9514.14 mod -16.60 = 14 9614.14 mod 0.15 = 0 9714.14 mod -0.01 = 0 9814.14 mod 15151324141414.412312232141241 = 14 9914.14 mod -132132245132134.1515123765412 = 14 10014.14 mod 141241241241241248267654747412 = 14 10114.14 mod -149143276547656984948124912 = 14 10214.14 mod 0.1322135476547459213732911312 = 0 10314.14 mod -0.123912932193769965476541321 = 0 104 105Number "-16.60" (scale 0) 106-16.60 mod 15 = -1 107-16.60 mod -15 = -1 108-16.60 mod 1 = 0 109-16.60 mod -9 = -7 110-16.60 mod 14.14 = -2 111-16.60 mod -16.60 = 0 112-16.60 mod 0.15 = 0 113-16.60 mod -0.01 = 0 114-16.60 mod 15151324141414.412312232141241 = -16 115-16.60 mod -132132245132134.1515123765412 = -16 116-16.60 mod 141241241241241248267654747412 = -16 117-16.60 mod -149143276547656984948124912 = -16 118-16.60 mod 0.1322135476547459213732911312 = 0 119-16.60 mod -0.123912932193769965476541321 = 0 120 121Number "0.15" (scale 0) 1220.15 mod 15 = 0 1230.15 mod -15 = 0 1240.15 mod 1 = 0 1250.15 mod -9 = 0 1260.15 mod 14.14 = 0 1270.15 mod -16.60 = 0 1280.15 mod 0.15 = 0 1290.15 mod -0.01 = 0 1300.15 mod 15151324141414.412312232141241 = 0 1310.15 mod -132132245132134.1515123765412 = 0 1320.15 mod 141241241241241248267654747412 = 0 1330.15 mod -149143276547656984948124912 = 0 1340.15 mod 0.1322135476547459213732911312 = 0 1350.15 mod -0.123912932193769965476541321 = 0 136 137Number "-0.01" (scale 0) 138-0.01 mod 15 = 0 139-0.01 mod -15 = 0 140-0.01 mod 1 = 0 141-0.01 mod -9 = 0 142-0.01 mod 14.14 = 0 143-0.01 mod -16.60 = 0 144-0.01 mod 0.15 = 0 145-0.01 mod -0.01 = 0 146-0.01 mod 15151324141414.412312232141241 = 0 147-0.01 mod -132132245132134.1515123765412 = 0 148-0.01 mod 141241241241241248267654747412 = 0 149-0.01 mod -149143276547656984948124912 = 0 150-0.01 mod 0.1322135476547459213732911312 = 0 151-0.01 mod -0.123912932193769965476541321 = 0 152 153Number "15" (scale 10) 15415 mod 15 = 0.0000000000 15515 mod -15 = 0.0000000000 15615 mod 1 = 0.0000000000 15715 mod -9 = 6.0000000000 15815 mod 14.14 = 0.8600000000 15915 mod -16.60 = 15.0000000000 16015 mod 0.15 = 0.0000000000 16115 mod -0.01 = 0.0000000000 16215 mod 15151324141414.412312232141241 = 15.0000000000 16315 mod -132132245132134.1515123765412 = 15.0000000000 16415 mod 141241241241241248267654747412 = 15.0000000000 16515 mod -149143276547656984948124912 = 15.0000000000 16615 mod 0.1322135476547459213732911312 = 0.0598691150 16715 mod -0.123912932193769965476541321 = 0.0065352045 168 169Number "-15" (scale 10) 170-15 mod 15 = 0.0000000000 171-15 mod -15 = 0.0000000000 172-15 mod 1 = 0.0000000000 173-15 mod -9 = -6.0000000000 174-15 mod 14.14 = -0.8600000000 175-15 mod -16.60 = -15.0000000000 176-15 mod 0.15 = 0.0000000000 177-15 mod -0.01 = 0.0000000000 178-15 mod 15151324141414.412312232141241 = -15.0000000000 179-15 mod -132132245132134.1515123765412 = -15.0000000000 180-15 mod 141241241241241248267654747412 = -15.0000000000 181-15 mod -149143276547656984948124912 = -15.0000000000 182-15 mod 0.1322135476547459213732911312 = -0.0598691150 183-15 mod -0.123912932193769965476541321 = -0.0065352045 184 185Number "1" (scale 10) 1861 mod 15 = 1.0000000000 1871 mod -15 = 1.0000000000 1881 mod 1 = 0.0000000000 1891 mod -9 = 1.0000000000 1901 mod 14.14 = 1.0000000000 1911 mod -16.60 = 1.0000000000 1921 mod 0.15 = 0.1000000000 1931 mod -0.01 = 0.0000000000 1941 mod 15151324141414.412312232141241 = 1.0000000000 1951 mod -132132245132134.1515123765412 = 1.0000000000 1961 mod 141241241241241248267654747412 = 1.0000000000 1971 mod -149143276547656984948124912 = 1.0000000000 1981 mod 0.1322135476547459213732911312 = 0.0745051664 1991 mod -0.123912932193769965476541321 = 0.0086965424 200 201Number "-9" (scale 10) 202-9 mod 15 = -9.0000000000 203-9 mod -15 = -9.0000000000 204-9 mod 1 = 0.0000000000 205-9 mod -9 = 0.0000000000 206-9 mod 14.14 = -9.0000000000 207-9 mod -16.60 = -9.0000000000 208-9 mod 0.15 = 0.0000000000 209-9 mod -0.01 = 0.0000000000 210-9 mod 15151324141414.412312232141241 = -9.0000000000 211-9 mod -132132245132134.1515123765412 = -9.0000000000 212-9 mod 141241241241241248267654747412 = -9.0000000000 213-9 mod -149143276547656984948124912 = -9.0000000000 214-9 mod 0.1322135476547459213732911312 = -0.0094787594 215-9 mod -0.123912932193769965476541321 = -0.0782688820 216 217Number "14.14" (scale 10) 21814.14 mod 15 = 14.1400000000 21914.14 mod -15 = 14.1400000000 22014.14 mod 1 = 0.1400000000 22114.14 mod -9 = 5.1400000000 22214.14 mod 14.14 = 0.0000000000 22314.14 mod -16.60 = 14.1400000000 22414.14 mod 0.15 = 0.0400000000 22514.14 mod -0.01 = 0.0000000000 22614.14 mod 15151324141414.412312232141241 = 14.1400000000 22714.14 mod -132132245132134.1515123765412 = 14.1400000000 22814.14 mod 141241241241241248267654747412 = 14.1400000000 22914.14 mod -149143276547656984948124912 = 14.1400000000 23014.14 mod 0.1322135476547459213732911312 = 0.1253639485 23114.14 mod -0.123912932193769965476541321 = 0.0139257299 232 233Number "-16.60" (scale 10) 234-16.60 mod 15 = -1.6000000000 235-16.60 mod -15 = -1.6000000000 236-16.60 mod 1 = -0.6000000000 237-16.60 mod -9 = -7.6000000000 238-16.60 mod 14.14 = -2.4600000000 239-16.60 mod -16.60 = 0.0000000000 240-16.60 mod 0.15 = -0.1000000000 241-16.60 mod -0.01 = 0.0000000000 242-16.60 mod 15151324141414.412312232141241 = -16.6000000000 243-16.60 mod -132132245132134.1515123765412 = -16.6000000000 244-16.60 mod 141241241241241248267654747412 = -16.6000000000 245-16.60 mod -149143276547656984948124912 = -16.6000000000 246-16.60 mod 0.1322135476547459213732911312 = -0.0733065431 247-16.60 mod -0.123912932193769965476541321 = -0.1195800182 248 249Number "0.15" (scale 10) 2500.15 mod 15 = 0.1500000000 2510.15 mod -15 = 0.1500000000 2520.15 mod 1 = 0.1500000000 2530.15 mod -9 = 0.1500000000 2540.15 mod 14.14 = 0.1500000000 2550.15 mod -16.60 = 0.1500000000 2560.15 mod 0.15 = 0.0000000000 2570.15 mod -0.01 = 0.0000000000 2580.15 mod 15151324141414.412312232141241 = 0.1500000000 2590.15 mod -132132245132134.1515123765412 = 0.1500000000 2600.15 mod 141241241241241248267654747412 = 0.1500000000 2610.15 mod -149143276547656984948124912 = 0.1500000000 2620.15 mod 0.1322135476547459213732911312 = 0.0177864523 2630.15 mod -0.123912932193769965476541321 = 0.0260870678 264 265Number "-0.01" (scale 10) 266-0.01 mod 15 = -0.0100000000 267-0.01 mod -15 = -0.0100000000 268-0.01 mod 1 = -0.0100000000 269-0.01 mod -9 = -0.0100000000 270-0.01 mod 14.14 = -0.0100000000 271-0.01 mod -16.60 = -0.0100000000 272-0.01 mod 0.15 = -0.0100000000 273-0.01 mod -0.01 = 0.0000000000 274-0.01 mod 15151324141414.412312232141241 = -0.0100000000 275-0.01 mod -132132245132134.1515123765412 = -0.0100000000 276-0.01 mod 141241241241241248267654747412 = -0.0100000000 277-0.01 mod -149143276547656984948124912 = -0.0100000000 278-0.01 mod 0.1322135476547459213732911312 = -0.0100000000 279-0.01 mod -0.123912932193769965476541321 = -0.0100000000 280