Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
 
3
namespace PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
4
 
5
use PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
6
use PhpOffice\PhpSpreadsheet\Calculation\Exception;
7
use PhpOffice\PhpSpreadsheet\Calculation\Information\ExcelError;
8
 
9
class Roman
10
{
11
    use ArrayEnabled;
12
 
13
    private const VALUES = [
14
        45 => ['VL'],
15
        46 => ['VLI'],
16
        47 => ['VLII'],
17
        48 => ['VLIII'],
18
        49 => ['VLIV', 'IL'],
19
        95 => ['VC'],
20
        96 => ['VCI'],
21
        97 => ['VCII'],
22
        98 => ['VCIII'],
23
        99 => ['VCIV', 'IC'],
24
        145 => ['CVL'],
25
        146 => ['CVLI'],
26
        147 => ['CVLII'],
27
        148 => ['CVLIII'],
28
        149 => ['CVLIV', 'CIL'],
29
        195 => ['CVC'],
30
        196 => ['CVCI'],
31
        197 => ['CVCII'],
32
        198 => ['CVCIII'],
33
        199 => ['CVCIV', 'CIC'],
34
        245 => ['CCVL'],
35
        246 => ['CCVLI'],
36
        247 => ['CCVLII'],
37
        248 => ['CCVLIII'],
38
        249 => ['CCVLIV', 'CCIL'],
39
        295 => ['CCVC'],
40
        296 => ['CCVCI'],
41
        297 => ['CCVCII'],
42
        298 => ['CCVCIII'],
43
        299 => ['CCVCIV', 'CCIC'],
44
        345 => ['CCCVL'],
45
        346 => ['CCCVLI'],
46
        347 => ['CCCVLII'],
47
        348 => ['CCCVLIII'],
48
        349 => ['CCCVLIV', 'CCCIL'],
49
        395 => ['CCCVC'],
50
        396 => ['CCCVCI'],
51
        397 => ['CCCVCII'],
52
        398 => ['CCCVCIII'],
53
        399 => ['CCCVCIV', 'CCCIC'],
54
        445 => ['CDVL'],
55
        446 => ['CDVLI'],
56
        447 => ['CDVLII'],
57
        448 => ['CDVLIII'],
58
        449 => ['CDVLIV', 'CDIL'],
59
        450 => ['LD'],
60
        451 => ['LDI'],
61
        452 => ['LDII'],
62
        453 => ['LDIII'],
63
        454 => ['LDIV'],
64
        455 => ['LDV'],
65
        456 => ['LDVI'],
66
        457 => ['LDVII'],
67
        458 => ['LDVIII'],
68
        459 => ['LDIX'],
69
        460 => ['LDX'],
70
        461 => ['LDXI'],
71
        462 => ['LDXII'],
72
        463 => ['LDXIII'],
73
        464 => ['LDXIV'],
74
        465 => ['LDXV'],
75
        466 => ['LDXVI'],
76
        467 => ['LDXVII'],
77
        468 => ['LDXVIII'],
78
        469 => ['LDXIX'],
79
        470 => ['LDXX'],
80
        471 => ['LDXXI'],
81
        472 => ['LDXXII'],
82
        473 => ['LDXXIII'],
83
        474 => ['LDXXIV'],
84
        475 => ['LDXXV'],
85
        476 => ['LDXXVI'],
86
        477 => ['LDXXVII'],
87
        478 => ['LDXXVIII'],
88
        479 => ['LDXXIX'],
89
        480 => ['LDXXX'],
90
        481 => ['LDXXXI'],
91
        482 => ['LDXXXII'],
92
        483 => ['LDXXXIII'],
93
        484 => ['LDXXXIV'],
94
        485 => ['LDXXXV'],
95
        486 => ['LDXXXVI'],
96
        487 => ['LDXXXVII'],
97
        488 => ['LDXXXVIII'],
98
        489 => ['LDXXXIX'],
99
        490 => ['LDXL', 'XD'],
100
        491 => ['LDXLI', 'XDI'],
101
        492 => ['LDXLII', 'XDII'],
102
        493 => ['LDXLIII', 'XDIII'],
103
        494 => ['LDXLIV', 'XDIV'],
104
        495 => ['LDVL', 'XDV', 'VD'],
105
        496 => ['LDVLI', 'XDVI', 'VDI'],
106
        497 => ['LDVLII', 'XDVII', 'VDII'],
107
        498 => ['LDVLIII', 'XDVIII', 'VDIII'],
108
        499 => ['LDVLIV', 'XDIX', 'VDIV', 'ID'],
109
        545 => ['DVL'],
110
        546 => ['DVLI'],
111
        547 => ['DVLII'],
112
        548 => ['DVLIII'],
113
        549 => ['DVLIV', 'DIL'],
114
        595 => ['DVC'],
115
        596 => ['DVCI'],
116
        597 => ['DVCII'],
117
        598 => ['DVCIII'],
118
        599 => ['DVCIV', 'DIC'],
119
        645 => ['DCVL'],
120
        646 => ['DCVLI'],
121
        647 => ['DCVLII'],
122
        648 => ['DCVLIII'],
123
        649 => ['DCVLIV', 'DCIL'],
124
        695 => ['DCVC'],
125
        696 => ['DCVCI'],
126
        697 => ['DCVCII'],
127
        698 => ['DCVCIII'],
128
        699 => ['DCVCIV', 'DCIC'],
129
        745 => ['DCCVL'],
130
        746 => ['DCCVLI'],
131
        747 => ['DCCVLII'],
132
        748 => ['DCCVLIII'],
133
        749 => ['DCCVLIV', 'DCCIL'],
134
        795 => ['DCCVC'],
135
        796 => ['DCCVCI'],
136
        797 => ['DCCVCII'],
137
        798 => ['DCCVCIII'],
138
        799 => ['DCCVCIV', 'DCCIC'],
139
        845 => ['DCCCVL'],
140
        846 => ['DCCCVLI'],
141
        847 => ['DCCCVLII'],
142
        848 => ['DCCCVLIII'],
143
        849 => ['DCCCVLIV', 'DCCCIL'],
144
        895 => ['DCCCVC'],
145
        896 => ['DCCCVCI'],
146
        897 => ['DCCCVCII'],
147
        898 => ['DCCCVCIII'],
148
        899 => ['DCCCVCIV', 'DCCCIC'],
149
        945 => ['CMVL'],
150
        946 => ['CMVLI'],
151
        947 => ['CMVLII'],
152
        948 => ['CMVLIII'],
153
        949 => ['CMVLIV', 'CMIL'],
154
        950 => ['LM'],
155
        951 => ['LMI'],
156
        952 => ['LMII'],
157
        953 => ['LMIII'],
158
        954 => ['LMIV'],
159
        955 => ['LMV'],
160
        956 => ['LMVI'],
161
        957 => ['LMVII'],
162
        958 => ['LMVIII'],
163
        959 => ['LMIX'],
164
        960 => ['LMX'],
165
        961 => ['LMXI'],
166
        962 => ['LMXII'],
167
        963 => ['LMXIII'],
168
        964 => ['LMXIV'],
169
        965 => ['LMXV'],
170
        966 => ['LMXVI'],
171
        967 => ['LMXVII'],
172
        968 => ['LMXVIII'],
173
        969 => ['LMXIX'],
174
        970 => ['LMXX'],
175
        971 => ['LMXXI'],
176
        972 => ['LMXXII'],
177
        973 => ['LMXXIII'],
178
        974 => ['LMXXIV'],
179
        975 => ['LMXXV'],
180
        976 => ['LMXXVI'],
181
        977 => ['LMXXVII'],
182
        978 => ['LMXXVIII'],
183
        979 => ['LMXXIX'],
184
        980 => ['LMXXX'],
185
        981 => ['LMXXXI'],
186
        982 => ['LMXXXII'],
187
        983 => ['LMXXXIII'],
188
        984 => ['LMXXXIV'],
189
        985 => ['LMXXXV'],
190
        986 => ['LMXXXVI'],
191
        987 => ['LMXXXVII'],
192
        988 => ['LMXXXVIII'],
193
        989 => ['LMXXXIX'],
194
        990 => ['LMXL', 'XM'],
195
        991 => ['LMXLI', 'XMI'],
196
        992 => ['LMXLII', 'XMII'],
197
        993 => ['LMXLIII', 'XMIII'],
198
        994 => ['LMXLIV', 'XMIV'],
199
        995 => ['LMVL', 'XMV', 'VM'],
200
        996 => ['LMVLI', 'XMVI', 'VMI'],
201
        997 => ['LMVLII', 'XMVII', 'VMII'],
202
        998 => ['LMVLIII', 'XMVIII', 'VMIII'],
203
        999 => ['LMVLIV', 'XMIX', 'VMIV', 'IM'],
204
        1045 => ['MVL'],
205
        1046 => ['MVLI'],
206
        1047 => ['MVLII'],
207
        1048 => ['MVLIII'],
208
        1049 => ['MVLIV', 'MIL'],
209
        1095 => ['MVC'],
210
        1096 => ['MVCI'],
211
        1097 => ['MVCII'],
212
        1098 => ['MVCIII'],
213
        1099 => ['MVCIV', 'MIC'],
214
        1145 => ['MCVL'],
215
        1146 => ['MCVLI'],
216
        1147 => ['MCVLII'],
217
        1148 => ['MCVLIII'],
218
        1149 => ['MCVLIV', 'MCIL'],
219
        1195 => ['MCVC'],
220
        1196 => ['MCVCI'],
221
        1197 => ['MCVCII'],
222
        1198 => ['MCVCIII'],
223
        1199 => ['MCVCIV', 'MCIC'],
224
        1245 => ['MCCVL'],
225
        1246 => ['MCCVLI'],
226
        1247 => ['MCCVLII'],
227
        1248 => ['MCCVLIII'],
228
        1249 => ['MCCVLIV', 'MCCIL'],
229
        1295 => ['MCCVC'],
230
        1296 => ['MCCVCI'],
231
        1297 => ['MCCVCII'],
232
        1298 => ['MCCVCIII'],
233
        1299 => ['MCCVCIV', 'MCCIC'],
234
        1345 => ['MCCCVL'],
235
        1346 => ['MCCCVLI'],
236
        1347 => ['MCCCVLII'],
237
        1348 => ['MCCCVLIII'],
238
        1349 => ['MCCCVLIV', 'MCCCIL'],
239
        1395 => ['MCCCVC'],
240
        1396 => ['MCCCVCI'],
241
        1397 => ['MCCCVCII'],
242
        1398 => ['MCCCVCIII'],
243
        1399 => ['MCCCVCIV', 'MCCCIC'],
244
        1445 => ['MCDVL'],
245
        1446 => ['MCDVLI'],
246
        1447 => ['MCDVLII'],
247
        1448 => ['MCDVLIII'],
248
        1449 => ['MCDVLIV', 'MCDIL'],
249
        1450 => ['MLD'],
250
        1451 => ['MLDI'],
251
        1452 => ['MLDII'],
252
        1453 => ['MLDIII'],
253
        1454 => ['MLDIV'],
254
        1455 => ['MLDV'],
255
        1456 => ['MLDVI'],
256
        1457 => ['MLDVII'],
257
        1458 => ['MLDVIII'],
258
        1459 => ['MLDIX'],
259
        1460 => ['MLDX'],
260
        1461 => ['MLDXI'],
261
        1462 => ['MLDXII'],
262
        1463 => ['MLDXIII'],
263
        1464 => ['MLDXIV'],
264
        1465 => ['MLDXV'],
265
        1466 => ['MLDXVI'],
266
        1467 => ['MLDXVII'],
267
        1468 => ['MLDXVIII'],
268
        1469 => ['MLDXIX'],
269
        1470 => ['MLDXX'],
270
        1471 => ['MLDXXI'],
271
        1472 => ['MLDXXII'],
272
        1473 => ['MLDXXIII'],
273
        1474 => ['MLDXXIV'],
274
        1475 => ['MLDXXV'],
275
        1476 => ['MLDXXVI'],
276
        1477 => ['MLDXXVII'],
277
        1478 => ['MLDXXVIII'],
278
        1479 => ['MLDXXIX'],
279
        1480 => ['MLDXXX'],
280
        1481 => ['MLDXXXI'],
281
        1482 => ['MLDXXXII'],
282
        1483 => ['MLDXXXIII'],
283
        1484 => ['MLDXXXIV'],
284
        1485 => ['MLDXXXV'],
285
        1486 => ['MLDXXXVI'],
286
        1487 => ['MLDXXXVII'],
287
        1488 => ['MLDXXXVIII'],
288
        1489 => ['MLDXXXIX'],
289
        1490 => ['MLDXL', 'MXD'],
290
        1491 => ['MLDXLI', 'MXDI'],
291
        1492 => ['MLDXLII', 'MXDII'],
292
        1493 => ['MLDXLIII', 'MXDIII'],
293
        1494 => ['MLDXLIV', 'MXDIV'],
294
        1495 => ['MLDVL', 'MXDV', 'MVD'],
295
        1496 => ['MLDVLI', 'MXDVI', 'MVDI'],
296
        1497 => ['MLDVLII', 'MXDVII', 'MVDII'],
297
        1498 => ['MLDVLIII', 'MXDVIII', 'MVDIII'],
298
        1499 => ['MLDVLIV', 'MXDIX', 'MVDIV', 'MID'],
299
        1545 => ['MDVL'],
300
        1546 => ['MDVLI'],
301
        1547 => ['MDVLII'],
302
        1548 => ['MDVLIII'],
303
        1549 => ['MDVLIV', 'MDIL'],
304
        1595 => ['MDVC'],
305
        1596 => ['MDVCI'],
306
        1597 => ['MDVCII'],
307
        1598 => ['MDVCIII'],
308
        1599 => ['MDVCIV', 'MDIC'],
309
        1645 => ['MDCVL'],
310
        1646 => ['MDCVLI'],
311
        1647 => ['MDCVLII'],
312
        1648 => ['MDCVLIII'],
313
        1649 => ['MDCVLIV', 'MDCIL'],
314
        1695 => ['MDCVC'],
315
        1696 => ['MDCVCI'],
316
        1697 => ['MDCVCII'],
317
        1698 => ['MDCVCIII'],
318
        1699 => ['MDCVCIV', 'MDCIC'],
319
        1745 => ['MDCCVL'],
320
        1746 => ['MDCCVLI'],
321
        1747 => ['MDCCVLII'],
322
        1748 => ['MDCCVLIII'],
323
        1749 => ['MDCCVLIV', 'MDCCIL'],
324
        1795 => ['MDCCVC'],
325
        1796 => ['MDCCVCI'],
326
        1797 => ['MDCCVCII'],
327
        1798 => ['MDCCVCIII'],
328
        1799 => ['MDCCVCIV', 'MDCCIC'],
329
        1845 => ['MDCCCVL'],
330
        1846 => ['MDCCCVLI'],
331
        1847 => ['MDCCCVLII'],
332
        1848 => ['MDCCCVLIII'],
333
        1849 => ['MDCCCVLIV', 'MDCCCIL'],
334
        1895 => ['MDCCCVC'],
335
        1896 => ['MDCCCVCI'],
336
        1897 => ['MDCCCVCII'],
337
        1898 => ['MDCCCVCIII'],
338
        1899 => ['MDCCCVCIV', 'MDCCCIC'],
339
        1945 => ['MCMVL'],
340
        1946 => ['MCMVLI'],
341
        1947 => ['MCMVLII'],
342
        1948 => ['MCMVLIII'],
343
        1949 => ['MCMVLIV', 'MCMIL'],
344
        1950 => ['MLM'],
345
        1951 => ['MLMI'],
346
        1952 => ['MLMII'],
347
        1953 => ['MLMIII'],
348
        1954 => ['MLMIV'],
349
        1955 => ['MLMV'],
350
        1956 => ['MLMVI'],
351
        1957 => ['MLMVII'],
352
        1958 => ['MLMVIII'],
353
        1959 => ['MLMIX'],
354
        1960 => ['MLMX'],
355
        1961 => ['MLMXI'],
356
        1962 => ['MLMXII'],
357
        1963 => ['MLMXIII'],
358
        1964 => ['MLMXIV'],
359
        1965 => ['MLMXV'],
360
        1966 => ['MLMXVI'],
361
        1967 => ['MLMXVII'],
362
        1968 => ['MLMXVIII'],
363
        1969 => ['MLMXIX'],
364
        1970 => ['MLMXX'],
365
        1971 => ['MLMXXI'],
366
        1972 => ['MLMXXII'],
367
        1973 => ['MLMXXIII'],
368
        1974 => ['MLMXXIV'],
369
        1975 => ['MLMXXV'],
370
        1976 => ['MLMXXVI'],
371
        1977 => ['MLMXXVII'],
372
        1978 => ['MLMXXVIII'],
373
        1979 => ['MLMXXIX'],
374
        1980 => ['MLMXXX'],
375
        1981 => ['MLMXXXI'],
376
        1982 => ['MLMXXXII'],
377
        1983 => ['MLMXXXIII'],
378
        1984 => ['MLMXXXIV'],
379
        1985 => ['MLMXXXV'],
380
        1986 => ['MLMXXXVI'],
381
        1987 => ['MLMXXXVII'],
382
        1988 => ['MLMXXXVIII'],
383
        1989 => ['MLMXXXIX'],
384
        1990 => ['MLMXL', 'MXM'],
385
        1991 => ['MLMXLI', 'MXMI'],
386
        1992 => ['MLMXLII', 'MXMII'],
387
        1993 => ['MLMXLIII', 'MXMIII'],
388
        1994 => ['MLMXLIV', 'MXMIV'],
389
        1995 => ['MLMVL', 'MXMV', 'MVM'],
390
        1996 => ['MLMVLI', 'MXMVI', 'MVMI'],
391
        1997 => ['MLMVLII', 'MXMVII', 'MVMII'],
392
        1998 => ['MLMVLIII', 'MXMVIII', 'MVMIII'],
393
        1999 => ['MLMVLIV', 'MXMIX', 'MVMIV', 'MIM'],
394
        2045 => ['MMVL'],
395
        2046 => ['MMVLI'],
396
        2047 => ['MMVLII'],
397
        2048 => ['MMVLIII'],
398
        2049 => ['MMVLIV', 'MMIL'],
399
        2095 => ['MMVC'],
400
        2096 => ['MMVCI'],
401
        2097 => ['MMVCII'],
402
        2098 => ['MMVCIII'],
403
        2099 => ['MMVCIV', 'MMIC'],
404
        2145 => ['MMCVL'],
405
        2146 => ['MMCVLI'],
406
        2147 => ['MMCVLII'],
407
        2148 => ['MMCVLIII'],
408
        2149 => ['MMCVLIV', 'MMCIL'],
409
        2195 => ['MMCVC'],
410
        2196 => ['MMCVCI'],
411
        2197 => ['MMCVCII'],
412
        2198 => ['MMCVCIII'],
413
        2199 => ['MMCVCIV', 'MMCIC'],
414
        2245 => ['MMCCVL'],
415
        2246 => ['MMCCVLI'],
416
        2247 => ['MMCCVLII'],
417
        2248 => ['MMCCVLIII'],
418
        2249 => ['MMCCVLIV', 'MMCCIL'],
419
        2295 => ['MMCCVC'],
420
        2296 => ['MMCCVCI'],
421
        2297 => ['MMCCVCII'],
422
        2298 => ['MMCCVCIII'],
423
        2299 => ['MMCCVCIV', 'MMCCIC'],
424
        2345 => ['MMCCCVL'],
425
        2346 => ['MMCCCVLI'],
426
        2347 => ['MMCCCVLII'],
427
        2348 => ['MMCCCVLIII'],
428
        2349 => ['MMCCCVLIV', 'MMCCCIL'],
429
        2395 => ['MMCCCVC'],
430
        2396 => ['MMCCCVCI'],
431
        2397 => ['MMCCCVCII'],
432
        2398 => ['MMCCCVCIII'],
433
        2399 => ['MMCCCVCIV', 'MMCCCIC'],
434
        2445 => ['MMCDVL'],
435
        2446 => ['MMCDVLI'],
436
        2447 => ['MMCDVLII'],
437
        2448 => ['MMCDVLIII'],
438
        2449 => ['MMCDVLIV', 'MMCDIL'],
439
        2450 => ['MMLD'],
440
        2451 => ['MMLDI'],
441
        2452 => ['MMLDII'],
442
        2453 => ['MMLDIII'],
443
        2454 => ['MMLDIV'],
444
        2455 => ['MMLDV'],
445
        2456 => ['MMLDVI'],
446
        2457 => ['MMLDVII'],
447
        2458 => ['MMLDVIII'],
448
        2459 => ['MMLDIX'],
449
        2460 => ['MMLDX'],
450
        2461 => ['MMLDXI'],
451
        2462 => ['MMLDXII'],
452
        2463 => ['MMLDXIII'],
453
        2464 => ['MMLDXIV'],
454
        2465 => ['MMLDXV'],
455
        2466 => ['MMLDXVI'],
456
        2467 => ['MMLDXVII'],
457
        2468 => ['MMLDXVIII'],
458
        2469 => ['MMLDXIX'],
459
        2470 => ['MMLDXX'],
460
        2471 => ['MMLDXXI'],
461
        2472 => ['MMLDXXII'],
462
        2473 => ['MMLDXXIII'],
463
        2474 => ['MMLDXXIV'],
464
        2475 => ['MMLDXXV'],
465
        2476 => ['MMLDXXVI'],
466
        2477 => ['MMLDXXVII'],
467
        2478 => ['MMLDXXVIII'],
468
        2479 => ['MMLDXXIX'],
469
        2480 => ['MMLDXXX'],
470
        2481 => ['MMLDXXXI'],
471
        2482 => ['MMLDXXXII'],
472
        2483 => ['MMLDXXXIII'],
473
        2484 => ['MMLDXXXIV'],
474
        2485 => ['MMLDXXXV'],
475
        2486 => ['MMLDXXXVI'],
476
        2487 => ['MMLDXXXVII'],
477
        2488 => ['MMLDXXXVIII'],
478
        2489 => ['MMLDXXXIX'],
479
        2490 => ['MMLDXL', 'MMXD'],
480
        2491 => ['MMLDXLI', 'MMXDI'],
481
        2492 => ['MMLDXLII', 'MMXDII'],
482
        2493 => ['MMLDXLIII', 'MMXDIII'],
483
        2494 => ['MMLDXLIV', 'MMXDIV'],
484
        2495 => ['MMLDVL', 'MMXDV', 'MMVD'],
485
        2496 => ['MMLDVLI', 'MMXDVI', 'MMVDI'],
486
        2497 => ['MMLDVLII', 'MMXDVII', 'MMVDII'],
487
        2498 => ['MMLDVLIII', 'MMXDVIII', 'MMVDIII'],
488
        2499 => ['MMLDVLIV', 'MMXDIX', 'MMVDIV', 'MMID'],
489
        2545 => ['MMDVL'],
490
        2546 => ['MMDVLI'],
491
        2547 => ['MMDVLII'],
492
        2548 => ['MMDVLIII'],
493
        2549 => ['MMDVLIV', 'MMDIL'],
494
        2595 => ['MMDVC'],
495
        2596 => ['MMDVCI'],
496
        2597 => ['MMDVCII'],
497
        2598 => ['MMDVCIII'],
498
        2599 => ['MMDVCIV', 'MMDIC'],
499
        2645 => ['MMDCVL'],
500
        2646 => ['MMDCVLI'],
501
        2647 => ['MMDCVLII'],
502
        2648 => ['MMDCVLIII'],
503
        2649 => ['MMDCVLIV', 'MMDCIL'],
504
        2695 => ['MMDCVC'],
505
        2696 => ['MMDCVCI'],
506
        2697 => ['MMDCVCII'],
507
        2698 => ['MMDCVCIII'],
508
        2699 => ['MMDCVCIV', 'MMDCIC'],
509
        2745 => ['MMDCCVL'],
510
        2746 => ['MMDCCVLI'],
511
        2747 => ['MMDCCVLII'],
512
        2748 => ['MMDCCVLIII'],
513
        2749 => ['MMDCCVLIV', 'MMDCCIL'],
514
        2795 => ['MMDCCVC'],
515
        2796 => ['MMDCCVCI'],
516
        2797 => ['MMDCCVCII'],
517
        2798 => ['MMDCCVCIII'],
518
        2799 => ['MMDCCVCIV', 'MMDCCIC'],
519
        2845 => ['MMDCCCVL'],
520
        2846 => ['MMDCCCVLI'],
521
        2847 => ['MMDCCCVLII'],
522
        2848 => ['MMDCCCVLIII'],
523
        2849 => ['MMDCCCVLIV', 'MMDCCCIL'],
524
        2895 => ['MMDCCCVC'],
525
        2896 => ['MMDCCCVCI'],
526
        2897 => ['MMDCCCVCII'],
527
        2898 => ['MMDCCCVCIII'],
528
        2899 => ['MMDCCCVCIV', 'MMDCCCIC'],
529
        2945 => ['MMCMVL'],
530
        2946 => ['MMCMVLI'],
531
        2947 => ['MMCMVLII'],
532
        2948 => ['MMCMVLIII'],
533
        2949 => ['MMCMVLIV', 'MMCMIL'],
534
        2950 => ['MMLM'],
535
        2951 => ['MMLMI'],
536
        2952 => ['MMLMII'],
537
        2953 => ['MMLMIII'],
538
        2954 => ['MMLMIV'],
539
        2955 => ['MMLMV'],
540
        2956 => ['MMLMVI'],
541
        2957 => ['MMLMVII'],
542
        2958 => ['MMLMVIII'],
543
        2959 => ['MMLMIX'],
544
        2960 => ['MMLMX'],
545
        2961 => ['MMLMXI'],
546
        2962 => ['MMLMXII'],
547
        2963 => ['MMLMXIII'],
548
        2964 => ['MMLMXIV'],
549
        2965 => ['MMLMXV'],
550
        2966 => ['MMLMXVI'],
551
        2967 => ['MMLMXVII'],
552
        2968 => ['MMLMXVIII'],
553
        2969 => ['MMLMXIX'],
554
        2970 => ['MMLMXX'],
555
        2971 => ['MMLMXXI'],
556
        2972 => ['MMLMXXII'],
557
        2973 => ['MMLMXXIII'],
558
        2974 => ['MMLMXXIV'],
559
        2975 => ['MMLMXXV'],
560
        2976 => ['MMLMXXVI'],
561
        2977 => ['MMLMXXVII'],
562
        2978 => ['MMLMXXVIII'],
563
        2979 => ['MMLMXXIX'],
564
        2980 => ['MMLMXXX'],
565
        2981 => ['MMLMXXXI'],
566
        2982 => ['MMLMXXXII'],
567
        2983 => ['MMLMXXXIII'],
568
        2984 => ['MMLMXXXIV'],
569
        2985 => ['MMLMXXXV'],
570
        2986 => ['MMLMXXXVI'],
571
        2987 => ['MMLMXXXVII'],
572
        2988 => ['MMLMXXXVIII'],
573
        2989 => ['MMLMXXXIX'],
574
        2990 => ['MMLMXL', 'MMXM'],
575
        2991 => ['MMLMXLI', 'MMXMI'],
576
        2992 => ['MMLMXLII', 'MMXMII'],
577
        2993 => ['MMLMXLIII', 'MMXMIII'],
578
        2994 => ['MMLMXLIV', 'MMXMIV'],
579
        2995 => ['MMLMVL', 'MMXMV', 'MMVM'],
580
        2996 => ['MMLMVLI', 'MMXMVI', 'MMVMI'],
581
        2997 => ['MMLMVLII', 'MMXMVII', 'MMVMII'],
582
        2998 => ['MMLMVLIII', 'MMXMVIII', 'MMVMIII'],
583
        2999 => ['MMLMVLIV', 'MMXMIX', 'MMVMIV', 'MMIM'],
584
        3045 => ['MMMVL'],
585
        3046 => ['MMMVLI'],
586
        3047 => ['MMMVLII'],
587
        3048 => ['MMMVLIII'],
588
        3049 => ['MMMVLIV', 'MMMIL'],
589
        3095 => ['MMMVC'],
590
        3096 => ['MMMVCI'],
591
        3097 => ['MMMVCII'],
592
        3098 => ['MMMVCIII'],
593
        3099 => ['MMMVCIV', 'MMMIC'],
594
        3145 => ['MMMCVL'],
595
        3146 => ['MMMCVLI'],
596
        3147 => ['MMMCVLII'],
597
        3148 => ['MMMCVLIII'],
598
        3149 => ['MMMCVLIV', 'MMMCIL'],
599
        3195 => ['MMMCVC'],
600
        3196 => ['MMMCVCI'],
601
        3197 => ['MMMCVCII'],
602
        3198 => ['MMMCVCIII'],
603
        3199 => ['MMMCVCIV', 'MMMCIC'],
604
        3245 => ['MMMCCVL'],
605
        3246 => ['MMMCCVLI'],
606
        3247 => ['MMMCCVLII'],
607
        3248 => ['MMMCCVLIII'],
608
        3249 => ['MMMCCVLIV', 'MMMCCIL'],
609
        3295 => ['MMMCCVC'],
610
        3296 => ['MMMCCVCI'],
611
        3297 => ['MMMCCVCII'],
612
        3298 => ['MMMCCVCIII'],
613
        3299 => ['MMMCCVCIV', 'MMMCCIC'],
614
        3345 => ['MMMCCCVL'],
615
        3346 => ['MMMCCCVLI'],
616
        3347 => ['MMMCCCVLII'],
617
        3348 => ['MMMCCCVLIII'],
618
        3349 => ['MMMCCCVLIV', 'MMMCCCIL'],
619
        3395 => ['MMMCCCVC'],
620
        3396 => ['MMMCCCVCI'],
621
        3397 => ['MMMCCCVCII'],
622
        3398 => ['MMMCCCVCIII'],
623
        3399 => ['MMMCCCVCIV', 'MMMCCCIC'],
624
        3445 => ['MMMCDVL'],
625
        3446 => ['MMMCDVLI'],
626
        3447 => ['MMMCDVLII'],
627
        3448 => ['MMMCDVLIII'],
628
        3449 => ['MMMCDVLIV', 'MMMCDIL'],
629
        3450 => ['MMMLD'],
630
        3451 => ['MMMLDI'],
631
        3452 => ['MMMLDII'],
632
        3453 => ['MMMLDIII'],
633
        3454 => ['MMMLDIV'],
634
        3455 => ['MMMLDV'],
635
        3456 => ['MMMLDVI'],
636
        3457 => ['MMMLDVII'],
637
        3458 => ['MMMLDVIII'],
638
        3459 => ['MMMLDIX'],
639
        3460 => ['MMMLDX'],
640
        3461 => ['MMMLDXI'],
641
        3462 => ['MMMLDXII'],
642
        3463 => ['MMMLDXIII'],
643
        3464 => ['MMMLDXIV'],
644
        3465 => ['MMMLDXV'],
645
        3466 => ['MMMLDXVI'],
646
        3467 => ['MMMLDXVII'],
647
        3468 => ['MMMLDXVIII'],
648
        3469 => ['MMMLDXIX'],
649
        3470 => ['MMMLDXX'],
650
        3471 => ['MMMLDXXI'],
651
        3472 => ['MMMLDXXII'],
652
        3473 => ['MMMLDXXIII'],
653
        3474 => ['MMMLDXXIV'],
654
        3475 => ['MMMLDXXV'],
655
        3476 => ['MMMLDXXVI'],
656
        3477 => ['MMMLDXXVII'],
657
        3478 => ['MMMLDXXVIII'],
658
        3479 => ['MMMLDXXIX'],
659
        3480 => ['MMMLDXXX'],
660
        3481 => ['MMMLDXXXI'],
661
        3482 => ['MMMLDXXXII'],
662
        3483 => ['MMMLDXXXIII'],
663
        3484 => ['MMMLDXXXIV'],
664
        3485 => ['MMMLDXXXV'],
665
        3486 => ['MMMLDXXXVI'],
666
        3487 => ['MMMLDXXXVII'],
667
        3488 => ['MMMLDXXXVIII'],
668
        3489 => ['MMMLDXXXIX'],
669
        3490 => ['MMMLDXL', 'MMMXD'],
670
        3491 => ['MMMLDXLI', 'MMMXDI'],
671
        3492 => ['MMMLDXLII', 'MMMXDII'],
672
        3493 => ['MMMLDXLIII', 'MMMXDIII'],
673
        3494 => ['MMMLDXLIV', 'MMMXDIV'],
674
        3495 => ['MMMLDVL', 'MMMXDV', 'MMMVD'],
675
        3496 => ['MMMLDVLI', 'MMMXDVI', 'MMMVDI'],
676
        3497 => ['MMMLDVLII', 'MMMXDVII', 'MMMVDII'],
677
        3498 => ['MMMLDVLIII', 'MMMXDVIII', 'MMMVDIII'],
678
        3499 => ['MMMLDVLIV', 'MMMXDIX', 'MMMVDIV', 'MMMID'],
679
        3545 => ['MMMDVL'],
680
        3546 => ['MMMDVLI'],
681
        3547 => ['MMMDVLII'],
682
        3548 => ['MMMDVLIII'],
683
        3549 => ['MMMDVLIV', 'MMMDIL'],
684
        3595 => ['MMMDVC'],
685
        3596 => ['MMMDVCI'],
686
        3597 => ['MMMDVCII'],
687
        3598 => ['MMMDVCIII'],
688
        3599 => ['MMMDVCIV', 'MMMDIC'],
689
        3645 => ['MMMDCVL'],
690
        3646 => ['MMMDCVLI'],
691
        3647 => ['MMMDCVLII'],
692
        3648 => ['MMMDCVLIII'],
693
        3649 => ['MMMDCVLIV', 'MMMDCIL'],
694
        3695 => ['MMMDCVC'],
695
        3696 => ['MMMDCVCI'],
696
        3697 => ['MMMDCVCII'],
697
        3698 => ['MMMDCVCIII'],
698
        3699 => ['MMMDCVCIV', 'MMMDCIC'],
699
        3745 => ['MMMDCCVL'],
700
        3746 => ['MMMDCCVLI'],
701
        3747 => ['MMMDCCVLII'],
702
        3748 => ['MMMDCCVLIII'],
703
        3749 => ['MMMDCCVLIV', 'MMMDCCIL'],
704
        3795 => ['MMMDCCVC'],
705
        3796 => ['MMMDCCVCI'],
706
        3797 => ['MMMDCCVCII'],
707
        3798 => ['MMMDCCVCIII'],
708
        3799 => ['MMMDCCVCIV', 'MMMDCCIC'],
709
        3845 => ['MMMDCCCVL'],
710
        3846 => ['MMMDCCCVLI'],
711
        3847 => ['MMMDCCCVLII'],
712
        3848 => ['MMMDCCCVLIII'],
713
        3849 => ['MMMDCCCVLIV', 'MMMDCCCIL'],
714
        3895 => ['MMMDCCCVC'],
715
        3896 => ['MMMDCCCVCI'],
716
        3897 => ['MMMDCCCVCII'],
717
        3898 => ['MMMDCCCVCIII'],
718
        3899 => ['MMMDCCCVCIV', 'MMMDCCCIC'],
719
        3945 => ['MMMCMVL'],
720
        3946 => ['MMMCMVLI'],
721
        3947 => ['MMMCMVLII'],
722
        3948 => ['MMMCMVLIII'],
723
        3949 => ['MMMCMVLIV', 'MMMCMIL'],
724
        3950 => ['MMMLM'],
725
        3951 => ['MMMLMI'],
726
        3952 => ['MMMLMII'],
727
        3953 => ['MMMLMIII'],
728
        3954 => ['MMMLMIV'],
729
        3955 => ['MMMLMV'],
730
        3956 => ['MMMLMVI'],
731
        3957 => ['MMMLMVII'],
732
        3958 => ['MMMLMVIII'],
733
        3959 => ['MMMLMIX'],
734
        3960 => ['MMMLMX'],
735
        3961 => ['MMMLMXI'],
736
        3962 => ['MMMLMXII'],
737
        3963 => ['MMMLMXIII'],
738
        3964 => ['MMMLMXIV'],
739
        3965 => ['MMMLMXV'],
740
        3966 => ['MMMLMXVI'],
741
        3967 => ['MMMLMXVII'],
742
        3968 => ['MMMLMXVIII'],
743
        3969 => ['MMMLMXIX'],
744
        3970 => ['MMMLMXX'],
745
        3971 => ['MMMLMXXI'],
746
        3972 => ['MMMLMXXII'],
747
        3973 => ['MMMLMXXIII'],
748
        3974 => ['MMMLMXXIV'],
749
        3975 => ['MMMLMXXV'],
750
        3976 => ['MMMLMXXVI'],
751
        3977 => ['MMMLMXXVII'],
752
        3978 => ['MMMLMXXVIII'],
753
        3979 => ['MMMLMXXIX'],
754
        3980 => ['MMMLMXXX'],
755
        3981 => ['MMMLMXXXI'],
756
        3982 => ['MMMLMXXXII'],
757
        3983 => ['MMMLMXXXIII'],
758
        3984 => ['MMMLMXXXIV'],
759
        3985 => ['MMMLMXXXV'],
760
        3986 => ['MMMLMXXXVI'],
761
        3987 => ['MMMLMXXXVII'],
762
        3988 => ['MMMLMXXXVIII'],
763
        3989 => ['MMMLMXXXIX'],
764
        3990 => ['MMMLMXL', 'MMMXM'],
765
        3991 => ['MMMLMXLI', 'MMMXMI'],
766
        3992 => ['MMMLMXLII', 'MMMXMII'],
767
        3993 => ['MMMLMXLIII', 'MMMXMIII'],
768
        3994 => ['MMMLMXLIV', 'MMMXMIV'],
769
        3995 => ['MMMLMVL', 'MMMXMV', 'MMMVM'],
770
        3996 => ['MMMLMVLI', 'MMMXMVI', 'MMMVMI'],
771
        3997 => ['MMMLMVLII', 'MMMXMVII', 'MMMVMII'],
772
        3998 => ['MMMLMVLIII', 'MMMXMVIII', 'MMMVMIII'],
773
        3999 => ['MMMLMVLIV', 'MMMXMIX', 'MMMVMIV', 'MMMIM'],
774
    ];
775
 
776
    private const THOUSANDS = ['', 'M', 'MM', 'MMM'];
777
    private const HUNDREDS = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM'];
778
    private const TENS = ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'];
779
    private const ONES = ['', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
780
    const MAX_ROMAN_VALUE = 3999;
781
    const MAX_ROMAN_STYLE = 4;
782
 
783
    private static function valueOk(int $aValue, int $style): string
784
    {
785
        $origValue = $aValue;
786
        $m = \intdiv($aValue, 1000);
787
        $aValue %= 1000;
788
        $c = \intdiv($aValue, 100);
789
        $aValue %= 100;
790
        $t = \intdiv($aValue, 10);
791
        $aValue %= 10;
792
        $result = self::THOUSANDS[$m] . self::HUNDREDS[$c] . self::TENS[$t] . self::ONES[$aValue];
793
        if ($style > 0) {
794
            if (array_key_exists($origValue, self::VALUES)) {
795
                $arr = self::VALUES[$origValue];
796
                $idx = min($style, count($arr)) - 1;
797
                $result = $arr[$idx];
798
            }
799
        }
800
 
801
        return $result;
802
    }
803
 
804
    private static function styleOk(int $aValue, int $style): string
805
    {
806
        return ($aValue < 0 || $aValue > self::MAX_ROMAN_VALUE) ? ExcelError::VALUE() : self::valueOk($aValue, $style);
807
    }
808
 
809
    public static function calculateRoman(int $aValue, int $style): string
810
    {
811
        return ($style < 0 || $style > self::MAX_ROMAN_STYLE) ? ExcelError::VALUE() : self::styleOk($aValue, $style);
812
    }
813
 
814
    /**
815
     * ROMAN.
816
     *
817
     * Converts a number to Roman numeral
818
     *
819
     * @param mixed $aValue Number to convert
820
     *                      Or can be an array of numbers
821
     * @param mixed $style Number indicating one of five possible forms
822
     *                      Or can be an array of styles
823
     *
824
     * @return array|string Roman numeral, or a string containing an error
825
     *         If an array of numbers is passed as an argument, then the returned result will also be an array
826
     *            with the same dimensions
827
     */
828
    public static function evaluate(mixed $aValue, mixed $style = 0): array|string
829
    {
830
        if (is_array($aValue) || is_array($style)) {
831
            return self::evaluateArrayArguments([self::class, __FUNCTION__], $aValue, $style);
832
        }
833
 
834
        try {
835
            $aValue = Helpers::validateNumericNullBool($aValue);
836
            if (is_bool($style)) {
837
                $style = $style ? 0 : 4;
838
            }
839
            $style = Helpers::validateNumericNullSubstitution($style, null);
840
        } catch (Exception $e) {
841
            return $e->getMessage();
842
        }
843
 
844
        return self::calculateRoman((int) $aValue, (int) $style);
845
    }
846
}