BIS fnc romanNumeral: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " |r1=[[" to " |r1= [[") |
Lou Montana (talk | contribs) m (Text replacement - "<tt>([a-zA-Z0-9\. _"\\']+)<\/tt>" to "{{hl|$1}}") |
||
Line 41: | Line 41: | ||
* It is read from left to right from the biggest numeral to the lowest*, adding up:<br><small>*: not entirely true, see subtractions below</small> | * It is read from left to right from the biggest numeral to the lowest*, adding up:<br><small>*: not entirely true, see subtractions below</small> | ||
** | ** {{hl|DCLVII}} {{=}} {{hl|D}} → {{hl|C}} → {{hl|L}} → {{hl|V}} → {{hl|I}} → {{hl|I}} {{=}} 500 + 100 + 50 + 5 + 1 + 1 {{=}} 657 | ||
* A subtraction is done by writing '''one''' smaller numeral before a big one: | * A subtraction is done by writing '''one''' smaller numeral before a big one: | ||
** 9 could be written | ** 9 could be written {{hl|VIIII}}, or {{hl|IX}} {{=}} 1 and 10 {{=}} 10 - 1 {{=}} 9 / but {{hl|IIX}} for 8 doesn't exist, only {{hl|VIII}} | ||
* The same numeral can be put together multiple times, but ''usually'' (there is no standard, but the shorter version is usually preferred) up to the point where it can be subtracted from the bigger numeral above the used one (subtraction still done with only '''one''' numeral): | * The same numeral can be put together multiple times, but ''usually'' (there is no standard, but the shorter version is usually preferred) up to the point where it can be subtracted from the bigger numeral above the used one (subtraction still done with only '''one''' numeral): | ||
** | ** {{hl|IIII}} {{=}} {{hl|IV}}, {{hl|CCCC}} {{=}} {{hl|CD}} | ||
Now let's see if you can translate this one: | Now let's see if you can translate this one: {{hl|MCMLXXXV}}. Tip: where it all started ;-) <small><small>{{hl|MCMLXXXII}} for the purists!</small></small><br> | ||
To learn more: '''{{Wikipedia|Roman_numerals|Roman numerals on wikipedia}}''' | To learn more: '''{{Wikipedia|Roman_numerals|Roman numerals on wikipedia}}''' | ||
</dd> | </dd> | ||
</dl> | </dl> |
Revision as of 23:55, 15 November 2021
Description
- Description:
- Convert integer to roman numeral (e.g. 42 becomes "XLII").
- Execution:
- call
- Groups:
- StringsMath
Syntax
- Syntax:
- integer call BIS_fnc_romanNumeral
- Parameters:
- integer: Number, String, Code or Config, same as BIS_fnc_parseNumber (used in this function) - any integer between 1 and 3999
- Return Value:
- String - Roman number
Examples
- Example 1:
1 call BIS_fnc_romanNumeral; // returns "I"
- Example 2:
3999 call BIS_fnc_romanNumeral; // returns "MMMCMXCIX"
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on October 1, 2019 - 01:46 (UTC)
- Lou Montana
-
A Roman numeral is read like this:
Numeral I V X L C D M Value 1 5 10 50 100 500 1000 - It is read from left to right from the biggest numeral to the lowest*, adding up:
*: not entirely true, see subtractions below- DCLVII = D → C → L → V → I → I = 500 + 100 + 50 + 5 + 1 + 1 = 657
- A subtraction is done by writing one smaller numeral before a big one:
- 9 could be written VIIII, or IX = 1 and 10 = 10 - 1 = 9 / but IIX for 8 doesn't exist, only VIII
- The same numeral can be put together multiple times, but usually (there is no standard, but the shorter version is usually preferred) up to the point where it can be subtracted from the bigger numeral above the used one (subtraction still done with only one numeral):
- IIII = IV, CCCC = CD
Now let's see if you can translate this one: MCMLXXXV. Tip: where it all started ;-) MCMLXXXII for the purists!
To learn more: Roman numerals on wikipedia - It is read from left to right from the biggest numeral to the lowest*, adding up: