NAME
std/math/roman - Roman numeral formatter for ZuzuScript.
SYNOPSIS
from std/math/roman import roman;
say( roman( 2026 ) ); # MMXXVI
say( roman( 0 ) ); # N
say( roman( 1.6 ) ); # IS·
say( roman( 0.5 ) ); # S
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module exports a single pure-Zuzu helper, roman, which formats numbers using Roman numerals with twelfth fractions.
EXPORTS
Functions
roman(Number n)Parameters:
nis the number to render. Returns:String. Formatsnas a Roman numeral, returningNfor zero.Whole numbers from 1 to 3999 are formatted with standard Roman numeral subtractive notation.
Non-integers are rounded to the nearest twelfth. The fractional part is appended using ancient twelfth marks:
1/12 => · 2/12 => : 3/12 => ∴ 4/12 => ∷ 5/12 => ⁙ 6/12 => S 7/12 => S· 8/12 => S: 9/12 => S∴ 10/12 => S∷ 11/12 => S⁙For values whose rounded twelfth part is exactly 12/12, the carry is applied to the integer Roman numeral part.
COPYRIGHT AND LICENCE
std/math/roman is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.