<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="id">
	<id>https://wiki.javasatu.com/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARoman</id>
	<title>Modul:Roman - Riwayat revisi</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.javasatu.com/index.php?action=history&amp;feed=atom&amp;title=Modul%3ARoman"/>
	<link rel="alternate" type="text/html" href="https://wiki.javasatu.com/index.php?title=Modul:Roman&amp;action=history"/>
	<updated>2026-04-12T12:37:05Z</updated>
	<subtitle>Riwayat revisi halaman ini di wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.javasatu.com/index.php?title=Modul:Roman&amp;diff=1299&amp;oldid=prev</id>
		<title>Adminjavasatu: ←Membuat halaman berisi '-- This module implements {{Roman}}.  local p = {}  -- This function implements the {{overline}} template. local function overline(s)     return mw.ustring.format( '&lt;span style=&quot;text-decoration:overline;&quot;&gt;%s&lt;/span&gt;', s ) end  -- Gets the Roman numerals for a given numeral table. Returns both the string of -- numerals and the value of the number after it is finished being processed. local function getLetters(num, t)     local ret = {}     for _, v in ipairs(t) do...'</title>
		<link rel="alternate" type="text/html" href="https://wiki.javasatu.com/index.php?title=Modul:Roman&amp;diff=1299&amp;oldid=prev"/>
		<updated>2023-09-20T13:45:15Z</updated>

		<summary type="html">&lt;p&gt;←Membuat halaman berisi &amp;#039;-- This module implements {{Roman}}.  local p = {}  -- This function implements the {{overline}} template. local function overline(s)     return mw.ustring.format( &amp;#039;&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;&amp;#039;, s ) end  -- Gets the Roman numerals for a given numeral table. Returns both the string of -- numerals and the value of the number after it is finished being processed. local function getLetters(num, t)     local ret = {}     for _, v in ipairs(t) do...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Halaman baru&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This module implements {{Roman}}.&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- This function implements the {{overline}} template.&lt;br /&gt;
local function overline(s)&lt;br /&gt;
    return mw.ustring.format( '&amp;lt;span style=&amp;quot;text-decoration:overline;&amp;quot;&amp;gt;%s&amp;lt;/span&amp;gt;', s )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Gets the Roman numerals for a given numeral table. Returns both the string of&lt;br /&gt;
-- numerals and the value of the number after it is finished being processed.&lt;br /&gt;
local function getLetters(num, t)&lt;br /&gt;
    local ret = {}&lt;br /&gt;
    for _, v in ipairs(t) do&lt;br /&gt;
        local val, letter = unpack(v)&lt;br /&gt;
        while num &amp;gt;= val do&lt;br /&gt;
            num = num - val&lt;br /&gt;
            table.insert(ret, letter)&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return table.concat(ret), num&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- The main control flow of the module.&lt;br /&gt;
local function _main(args)&lt;br /&gt;
    -- Get input and exit displaying nothing if the input is empty.&lt;br /&gt;
    if args[1] == nil then return end&lt;br /&gt;
    local num = tonumber(args[1])&lt;br /&gt;
    if not num or num &amp;lt; 0 or num == math.huge then&lt;br /&gt;
    	error('Invalid number ' .. args[1], 2)&lt;br /&gt;
    elseif num == 0 then&lt;br /&gt;
        return 'N'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Return a message for numbers too big to be expressed in Roman numerals.&lt;br /&gt;
    if num &amp;gt;= 5000000 then&lt;br /&gt;
        return args[2] or 'N/A'&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    local ret = ''&lt;br /&gt;
    -- Find the Roman numerals for the large part of numbers.&lt;br /&gt;
    -- 23 April 2016 - tweaked to &amp;gt;= 4000 to accept big Roman 'IV'&lt;br /&gt;
    -- The if statement is not strictly necessary, but makes the algorithm &lt;br /&gt;
    -- more efficient for smaller numbers.&lt;br /&gt;
    if num &amp;gt;= 4000 then&lt;br /&gt;
        local bigRomans = {&lt;br /&gt;
            { 1000000, 'M' },&lt;br /&gt;
            { 900000, 'CM' }, { 500000, 'D' }, { 400000, 'CD' }, { 100000, 'C' },&lt;br /&gt;
            {  90000, 'XC' }, {  50000, 'L' }, {  40000, 'XL' }, {  10000, 'X' },&lt;br /&gt;
            {   9000, 'IX' }, {   5000, 'V' }, {   4000, 'IV' },&lt;br /&gt;
        }&lt;br /&gt;
        local bigLetters&lt;br /&gt;
        bigLetters, num = getLetters(num, bigRomans)&lt;br /&gt;
        ret = overline(bigLetters)&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    -- Find the Roman numerals for numbers less than the big Roman threshold.&lt;br /&gt;
    local smallRomans = {&lt;br /&gt;
        { 1000, 'M' },&lt;br /&gt;
        { 900, 'CM' }, { 500, 'D' }, { 400, 'CD' }, { 100, 'C' },&lt;br /&gt;
        {  90, 'XC' }, {  50, 'L' }, {  40, 'XL' }, {  10, 'X' },&lt;br /&gt;
        {   9, 'IX' }, {   5, 'V' }, {   4, 'IV' }, {   1, 'I' }&lt;br /&gt;
    }&lt;br /&gt;
    local smallLetters = getLetters( num, smallRomans )&lt;br /&gt;
    ret = ret .. smallLetters&lt;br /&gt;
&lt;br /&gt;
    if args.fraction == 'yes' then&lt;br /&gt;
        -- Find the Roman numerals for the fractional parts of numbers.&lt;br /&gt;
        -- If num is not a whole number, add half of 1/1728 (the smallest unit) to equate to rounding.&lt;br /&gt;
        -- Ensure we're not less than the smallest unit or larger than 1 - smallest unit&lt;br /&gt;
        -- to avoid getting two &amp;quot;half&amp;quot; symbols or no symbols at all&lt;br /&gt;
        num = num - math.floor(num)&lt;br /&gt;
        if num ~= 0 then&lt;br /&gt;
            num = math.max(1.1/1728, math.min(1727.1/1728, num + 1/3456))&lt;br /&gt;
        end&lt;br /&gt;
        local fractionalRomans = {&lt;br /&gt;
            { 1/2, 'S' }, { 5/12, &amp;quot;''':'''•''':'''&amp;quot; }, { 1/3, &amp;quot;'''::'''&amp;quot; },&lt;br /&gt;
            { 1/4, &amp;quot;''':'''•&amp;quot; }, { 1/6, &amp;quot;''':'''&amp;quot; }, { 1/12, '•' },&lt;br /&gt;
            { 1/24, 'Є' }, { 1/36, 'ƧƧ' }, { 1/48, 'Ɔ' }, { 1/72, 'Ƨ' }, { 1/144, '&amp;lt;s&amp;gt;Ƨ&amp;lt;/s&amp;gt;' },&lt;br /&gt;
            { 1/288, '℈' }, { 1/1728, '»' },&lt;br /&gt;
        }&lt;br /&gt;
        local fractionalLetters = getLetters(num, fractionalRomans)&lt;br /&gt;
        &lt;br /&gt;
        ret = ret .. fractionalLetters&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame)&lt;br /&gt;
    -- If called via #invoke, use the args passed into the invoking&lt;br /&gt;
    -- template, or the args passed to #invoke if any exist. Otherwise&lt;br /&gt;
    -- assume args are being passed directly in from the debug console&lt;br /&gt;
    -- or from another Lua module.&lt;br /&gt;
    local origArgs&lt;br /&gt;
    if frame == mw.getCurrentFrame() then&lt;br /&gt;
        origArgs = frame:getParent().args&lt;br /&gt;
        for k, v in pairs(frame.args) do&lt;br /&gt;
            origArgs = frame.args&lt;br /&gt;
            break&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        origArgs = frame&lt;br /&gt;
    end&lt;br /&gt;
    -- Trim whitespace and remove blank arguments.&lt;br /&gt;
    local args = {}&lt;br /&gt;
    for k, v in pairs(origArgs) do&lt;br /&gt;
        if type( v ) == 'string' then&lt;br /&gt;
            v = mw.text.trim(v)&lt;br /&gt;
        end&lt;br /&gt;
        if v ~= '' then&lt;br /&gt;
            args[k] = v&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    -- exit if not given anything&lt;br /&gt;
    if args == nil or args == {} then return end&lt;br /&gt;
    -- Given mathematical expression, simplify to a number&lt;br /&gt;
    if type(args[1]) == 'string' then&lt;br /&gt;
        args[1] = mw.ext.ParserFunctions.expr(args[1])&lt;br /&gt;
    end&lt;br /&gt;
    return _main(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Adminjavasatu</name></author>
	</entry>
</feed>