1--TEST-- 2bcadd() function 3--EXTENSIONS-- 4bcmath 5--INI-- 6bcmath.scale=0 7--FILE-- 8<?php 9require(__DIR__ . "/run_bcmath_tests_function.inc"); 10 11$leftSummands = ["15", "-15", "1", "-9", "14.14", "-16.60", "0.15", "-0.01", "99"]; 12$rightSummands = array_merge($leftSummands, [ 13 "0", 14 "0.00", 15 "-0", 16 "-0.00", 17 "15151324141414.412312232141241", 18 "-132132245132134.1515123765412", 19 "141241241241241248267654747412", 20 "-149143276547656984948124912", 21 "0.1322135476547459213732911312", 22 "-0.123912932193769965476541321", 23 "2", 24]); 25 26run_bcmath_tests($leftSummands, $rightSummands, "+", bcadd(...)); 27 28?> 29--EXPECT-- 30Number "15" (scale 0) 3115 + 15 = 30 3215 + -15 = 0 3315 + 1 = 16 3415 + -9 = 6 3515 + 14.14 = 29 3615 + -16.60 = -1 3715 + 0.15 = 15 3815 + -0.01 = 14 3915 + 99 = 114 4015 + 0 = 15 4115 + 0.00 = 15 4215 + -0 = 15 4315 + -0.00 = 15 4415 + 15151324141414.412312232141241 = 15151324141429 4515 + -132132245132134.1515123765412 = -132132245132119 4615 + 141241241241241248267654747412 = 141241241241241248267654747427 4715 + -149143276547656984948124912 = -149143276547656984948124897 4815 + 0.1322135476547459213732911312 = 15 4915 + -0.123912932193769965476541321 = 14 5015 + 2 = 17 51 52Number "-15" (scale 0) 53-15 + 15 = 0 54-15 + -15 = -30 55-15 + 1 = -14 56-15 + -9 = -24 57-15 + 14.14 = 0 58-15 + -16.60 = -31 59-15 + 0.15 = -14 60-15 + -0.01 = -15 61-15 + 99 = 84 62-15 + 0 = -15 63-15 + 0.00 = -15 64-15 + -0 = -15 65-15 + -0.00 = -15 66-15 + 15151324141414.412312232141241 = 15151324141399 67-15 + -132132245132134.1515123765412 = -132132245132149 68-15 + 141241241241241248267654747412 = 141241241241241248267654747397 69-15 + -149143276547656984948124912 = -149143276547656984948124927 70-15 + 0.1322135476547459213732911312 = -14 71-15 + -0.123912932193769965476541321 = -15 72-15 + 2 = -13 73 74Number "1" (scale 0) 751 + 15 = 16 761 + -15 = -14 771 + 1 = 2 781 + -9 = -8 791 + 14.14 = 15 801 + -16.60 = -15 811 + 0.15 = 1 821 + -0.01 = 0 831 + 99 = 100 841 + 0 = 1 851 + 0.00 = 1 861 + -0 = 1 871 + -0.00 = 1 881 + 15151324141414.412312232141241 = 15151324141415 891 + -132132245132134.1515123765412 = -132132245132133 901 + 141241241241241248267654747412 = 141241241241241248267654747413 911 + -149143276547656984948124912 = -149143276547656984948124911 921 + 0.1322135476547459213732911312 = 1 931 + -0.123912932193769965476541321 = 0 941 + 2 = 3 95 96Number "-9" (scale 0) 97-9 + 15 = 6 98-9 + -15 = -24 99-9 + 1 = -8 100-9 + -9 = -18 101-9 + 14.14 = 5 102-9 + -16.60 = -25 103-9 + 0.15 = -8 104-9 + -0.01 = -9 105-9 + 99 = 90 106-9 + 0 = -9 107-9 + 0.00 = -9 108-9 + -0 = -9 109-9 + -0.00 = -9 110-9 + 15151324141414.412312232141241 = 15151324141405 111-9 + -132132245132134.1515123765412 = -132132245132143 112-9 + 141241241241241248267654747412 = 141241241241241248267654747403 113-9 + -149143276547656984948124912 = -149143276547656984948124921 114-9 + 0.1322135476547459213732911312 = -8 115-9 + -0.123912932193769965476541321 = -9 116-9 + 2 = -7 117 118Number "14.14" (scale 0) 11914.14 + 15 = 29 12014.14 + -15 = 0 12114.14 + 1 = 15 12214.14 + -9 = 5 12314.14 + 14.14 = 28 12414.14 + -16.60 = -2 12514.14 + 0.15 = 14 12614.14 + -0.01 = 14 12714.14 + 99 = 113 12814.14 + 0 = 14 12914.14 + 0.00 = 14 13014.14 + -0 = 14 13114.14 + -0.00 = 14 13214.14 + 15151324141414.412312232141241 = 15151324141428 13314.14 + -132132245132134.1515123765412 = -132132245132120 13414.14 + 141241241241241248267654747412 = 141241241241241248267654747426 13514.14 + -149143276547656984948124912 = -149143276547656984948124897 13614.14 + 0.1322135476547459213732911312 = 14 13714.14 + -0.123912932193769965476541321 = 14 13814.14 + 2 = 16 139 140Number "-16.60" (scale 0) 141-16.60 + 15 = -1 142-16.60 + -15 = -31 143-16.60 + 1 = -15 144-16.60 + -9 = -25 145-16.60 + 14.14 = -2 146-16.60 + -16.60 = -33 147-16.60 + 0.15 = -16 148-16.60 + -0.01 = -16 149-16.60 + 99 = 82 150-16.60 + 0 = -16 151-16.60 + 0.00 = -16 152-16.60 + -0 = -16 153-16.60 + -0.00 = -16 154-16.60 + 15151324141414.412312232141241 = 15151324141397 155-16.60 + -132132245132134.1515123765412 = -132132245132150 156-16.60 + 141241241241241248267654747412 = 141241241241241248267654747395 157-16.60 + -149143276547656984948124912 = -149143276547656984948124928 158-16.60 + 0.1322135476547459213732911312 = -16 159-16.60 + -0.123912932193769965476541321 = -16 160-16.60 + 2 = -14 161 162Number "0.15" (scale 0) 1630.15 + 15 = 15 1640.15 + -15 = -14 1650.15 + 1 = 1 1660.15 + -9 = -8 1670.15 + 14.14 = 14 1680.15 + -16.60 = -16 1690.15 + 0.15 = 0 1700.15 + -0.01 = 0 1710.15 + 99 = 99 1720.15 + 0 = 0 1730.15 + 0.00 = 0 1740.15 + -0 = 0 1750.15 + -0.00 = 0 1760.15 + 15151324141414.412312232141241 = 15151324141414 1770.15 + -132132245132134.1515123765412 = -132132245132134 1780.15 + 141241241241241248267654747412 = 141241241241241248267654747412 1790.15 + -149143276547656984948124912 = -149143276547656984948124911 1800.15 + 0.1322135476547459213732911312 = 0 1810.15 + -0.123912932193769965476541321 = 0 1820.15 + 2 = 2 183 184Number "-0.01" (scale 0) 185-0.01 + 15 = 14 186-0.01 + -15 = -15 187-0.01 + 1 = 0 188-0.01 + -9 = -9 189-0.01 + 14.14 = 14 190-0.01 + -16.60 = -16 191-0.01 + 0.15 = 0 192-0.01 + -0.01 = 0 193-0.01 + 99 = 98 194-0.01 + 0 = 0 195-0.01 + 0.00 = 0 196-0.01 + -0 = 0 197-0.01 + -0.00 = 0 198-0.01 + 15151324141414.412312232141241 = 15151324141414 199-0.01 + -132132245132134.1515123765412 = -132132245132134 200-0.01 + 141241241241241248267654747412 = 141241241241241248267654747411 201-0.01 + -149143276547656984948124912 = -149143276547656984948124912 202-0.01 + 0.1322135476547459213732911312 = 0 203-0.01 + -0.123912932193769965476541321 = 0 204-0.01 + 2 = 1 205 206Number "99" (scale 0) 20799 + 15 = 114 20899 + -15 = 84 20999 + 1 = 100 21099 + -9 = 90 21199 + 14.14 = 113 21299 + -16.60 = 82 21399 + 0.15 = 99 21499 + -0.01 = 98 21599 + 99 = 198 21699 + 0 = 99 21799 + 0.00 = 99 21899 + -0 = 99 21999 + -0.00 = 99 22099 + 15151324141414.412312232141241 = 15151324141513 22199 + -132132245132134.1515123765412 = -132132245132035 22299 + 141241241241241248267654747412 = 141241241241241248267654747511 22399 + -149143276547656984948124912 = -149143276547656984948124813 22499 + 0.1322135476547459213732911312 = 99 22599 + -0.123912932193769965476541321 = 98 22699 + 2 = 101 227 228Number "15" (scale 10) 22915 + 15 = 30.0000000000 23015 + -15 = 0.0000000000 23115 + 1 = 16.0000000000 23215 + -9 = 6.0000000000 23315 + 14.14 = 29.1400000000 23415 + -16.60 = -1.6000000000 23515 + 0.15 = 15.1500000000 23615 + -0.01 = 14.9900000000 23715 + 99 = 114.0000000000 23815 + 0 = 15.0000000000 23915 + 0.00 = 15.0000000000 24015 + -0 = 15.0000000000 24115 + -0.00 = 15.0000000000 24215 + 15151324141414.412312232141241 = 15151324141429.4123122321 24315 + -132132245132134.1515123765412 = -132132245132119.1515123765 24415 + 141241241241241248267654747412 = 141241241241241248267654747427.0000000000 24515 + -149143276547656984948124912 = -149143276547656984948124897.0000000000 24615 + 0.1322135476547459213732911312 = 15.1322135476 24715 + -0.123912932193769965476541321 = 14.8760870678 24815 + 2 = 17.0000000000 249 250Number "-15" (scale 10) 251-15 + 15 = 0.0000000000 252-15 + -15 = -30.0000000000 253-15 + 1 = -14.0000000000 254-15 + -9 = -24.0000000000 255-15 + 14.14 = -0.8600000000 256-15 + -16.60 = -31.6000000000 257-15 + 0.15 = -14.8500000000 258-15 + -0.01 = -15.0100000000 259-15 + 99 = 84.0000000000 260-15 + 0 = -15.0000000000 261-15 + 0.00 = -15.0000000000 262-15 + -0 = -15.0000000000 263-15 + -0.00 = -15.0000000000 264-15 + 15151324141414.412312232141241 = 15151324141399.4123122321 265-15 + -132132245132134.1515123765412 = -132132245132149.1515123765 266-15 + 141241241241241248267654747412 = 141241241241241248267654747397.0000000000 267-15 + -149143276547656984948124912 = -149143276547656984948124927.0000000000 268-15 + 0.1322135476547459213732911312 = -14.8677864523 269-15 + -0.123912932193769965476541321 = -15.1239129321 270-15 + 2 = -13.0000000000 271 272Number "1" (scale 10) 2731 + 15 = 16.0000000000 2741 + -15 = -14.0000000000 2751 + 1 = 2.0000000000 2761 + -9 = -8.0000000000 2771 + 14.14 = 15.1400000000 2781 + -16.60 = -15.6000000000 2791 + 0.15 = 1.1500000000 2801 + -0.01 = 0.9900000000 2811 + 99 = 100.0000000000 2821 + 0 = 1.0000000000 2831 + 0.00 = 1.0000000000 2841 + -0 = 1.0000000000 2851 + -0.00 = 1.0000000000 2861 + 15151324141414.412312232141241 = 15151324141415.4123122321 2871 + -132132245132134.1515123765412 = -132132245132133.1515123765 2881 + 141241241241241248267654747412 = 141241241241241248267654747413.0000000000 2891 + -149143276547656984948124912 = -149143276547656984948124911.0000000000 2901 + 0.1322135476547459213732911312 = 1.1322135476 2911 + -0.123912932193769965476541321 = 0.8760870678 2921 + 2 = 3.0000000000 293 294Number "-9" (scale 10) 295-9 + 15 = 6.0000000000 296-9 + -15 = -24.0000000000 297-9 + 1 = -8.0000000000 298-9 + -9 = -18.0000000000 299-9 + 14.14 = 5.1400000000 300-9 + -16.60 = -25.6000000000 301-9 + 0.15 = -8.8500000000 302-9 + -0.01 = -9.0100000000 303-9 + 99 = 90.0000000000 304-9 + 0 = -9.0000000000 305-9 + 0.00 = -9.0000000000 306-9 + -0 = -9.0000000000 307-9 + -0.00 = -9.0000000000 308-9 + 15151324141414.412312232141241 = 15151324141405.4123122321 309-9 + -132132245132134.1515123765412 = -132132245132143.1515123765 310-9 + 141241241241241248267654747412 = 141241241241241248267654747403.0000000000 311-9 + -149143276547656984948124912 = -149143276547656984948124921.0000000000 312-9 + 0.1322135476547459213732911312 = -8.8677864523 313-9 + -0.123912932193769965476541321 = -9.1239129321 314-9 + 2 = -7.0000000000 315 316Number "14.14" (scale 10) 31714.14 + 15 = 29.1400000000 31814.14 + -15 = -0.8600000000 31914.14 + 1 = 15.1400000000 32014.14 + -9 = 5.1400000000 32114.14 + 14.14 = 28.2800000000 32214.14 + -16.60 = -2.4600000000 32314.14 + 0.15 = 14.2900000000 32414.14 + -0.01 = 14.1300000000 32514.14 + 99 = 113.1400000000 32614.14 + 0 = 14.1400000000 32714.14 + 0.00 = 14.1400000000 32814.14 + -0 = 14.1400000000 32914.14 + -0.00 = 14.1400000000 33014.14 + 15151324141414.412312232141241 = 15151324141428.5523122321 33114.14 + -132132245132134.1515123765412 = -132132245132120.0115123765 33214.14 + 141241241241241248267654747412 = 141241241241241248267654747426.1400000000 33314.14 + -149143276547656984948124912 = -149143276547656984948124897.8600000000 33414.14 + 0.1322135476547459213732911312 = 14.2722135476 33514.14 + -0.123912932193769965476541321 = 14.0160870678 33614.14 + 2 = 16.1400000000 337 338Number "-16.60" (scale 10) 339-16.60 + 15 = -1.6000000000 340-16.60 + -15 = -31.6000000000 341-16.60 + 1 = -15.6000000000 342-16.60 + -9 = -25.6000000000 343-16.60 + 14.14 = -2.4600000000 344-16.60 + -16.60 = -33.2000000000 345-16.60 + 0.15 = -16.4500000000 346-16.60 + -0.01 = -16.6100000000 347-16.60 + 99 = 82.4000000000 348-16.60 + 0 = -16.6000000000 349-16.60 + 0.00 = -16.6000000000 350-16.60 + -0 = -16.6000000000 351-16.60 + -0.00 = -16.6000000000 352-16.60 + 15151324141414.412312232141241 = 15151324141397.8123122321 353-16.60 + -132132245132134.1515123765412 = -132132245132150.7515123765 354-16.60 + 141241241241241248267654747412 = 141241241241241248267654747395.4000000000 355-16.60 + -149143276547656984948124912 = -149143276547656984948124928.6000000000 356-16.60 + 0.1322135476547459213732911312 = -16.4677864523 357-16.60 + -0.123912932193769965476541321 = -16.7239129321 358-16.60 + 2 = -14.6000000000 359 360Number "0.15" (scale 10) 3610.15 + 15 = 15.1500000000 3620.15 + -15 = -14.8500000000 3630.15 + 1 = 1.1500000000 3640.15 + -9 = -8.8500000000 3650.15 + 14.14 = 14.2900000000 3660.15 + -16.60 = -16.4500000000 3670.15 + 0.15 = 0.3000000000 3680.15 + -0.01 = 0.1400000000 3690.15 + 99 = 99.1500000000 3700.15 + 0 = 0.1500000000 3710.15 + 0.00 = 0.1500000000 3720.15 + -0 = 0.1500000000 3730.15 + -0.00 = 0.1500000000 3740.15 + 15151324141414.412312232141241 = 15151324141414.5623122321 3750.15 + -132132245132134.1515123765412 = -132132245132134.0015123765 3760.15 + 141241241241241248267654747412 = 141241241241241248267654747412.1500000000 3770.15 + -149143276547656984948124912 = -149143276547656984948124911.8500000000 3780.15 + 0.1322135476547459213732911312 = 0.2822135476 3790.15 + -0.123912932193769965476541321 = 0.0260870678 3800.15 + 2 = 2.1500000000 381 382Number "-0.01" (scale 10) 383-0.01 + 15 = 14.9900000000 384-0.01 + -15 = -15.0100000000 385-0.01 + 1 = 0.9900000000 386-0.01 + -9 = -9.0100000000 387-0.01 + 14.14 = 14.1300000000 388-0.01 + -16.60 = -16.6100000000 389-0.01 + 0.15 = 0.1400000000 390-0.01 + -0.01 = -0.0200000000 391-0.01 + 99 = 98.9900000000 392-0.01 + 0 = -0.0100000000 393-0.01 + 0.00 = -0.0100000000 394-0.01 + -0 = -0.0100000000 395-0.01 + -0.00 = -0.0100000000 396-0.01 + 15151324141414.412312232141241 = 15151324141414.4023122321 397-0.01 + -132132245132134.1515123765412 = -132132245132134.1615123765 398-0.01 + 141241241241241248267654747412 = 141241241241241248267654747411.9900000000 399-0.01 + -149143276547656984948124912 = -149143276547656984948124912.0100000000 400-0.01 + 0.1322135476547459213732911312 = 0.1222135476 401-0.01 + -0.123912932193769965476541321 = -0.1339129321 402-0.01 + 2 = 1.9900000000 403 404Number "99" (scale 10) 40599 + 15 = 114.0000000000 40699 + -15 = 84.0000000000 40799 + 1 = 100.0000000000 40899 + -9 = 90.0000000000 40999 + 14.14 = 113.1400000000 41099 + -16.60 = 82.4000000000 41199 + 0.15 = 99.1500000000 41299 + -0.01 = 98.9900000000 41399 + 99 = 198.0000000000 41499 + 0 = 99.0000000000 41599 + 0.00 = 99.0000000000 41699 + -0 = 99.0000000000 41799 + -0.00 = 99.0000000000 41899 + 15151324141414.412312232141241 = 15151324141513.4123122321 41999 + -132132245132134.1515123765412 = -132132245132035.1515123765 42099 + 141241241241241248267654747412 = 141241241241241248267654747511.0000000000 42199 + -149143276547656984948124912 = -149143276547656984948124813.0000000000 42299 + 0.1322135476547459213732911312 = 99.1322135476 42399 + -0.123912932193769965476541321 = 98.8760870678 42499 + 2 = 101.0000000000 425