Module:Shared: Difference between revisions

Fixed specific edge case of rounding sometimes leading to too few digits being shown.
(Added a pagename fix to handle apostrophes)
(Fixed specific edge case of rounding sometimes leading to too few digits being shown.)
Line 178: Line 178:
   
   
         if(maxDigits ~= nil and decimals > maxDigits) then
         if(maxDigits ~= nil and decimals > maxDigits) then
             result = tonumber(string.format("%."..maxDigits.."f", result))
             result = string.format("%."..minDigits.."f", tonumber(string.format("%."..maxDigits.."f", result)))
         elseif(minDigits ~= nil and decimals < minDigits) then
         elseif(minDigits ~= nil and decimals < minDigits) then
             result = string.format("%."..minDigits.."f", result)
             result = string.format("%."..minDigits.."f", result)