Module:Shared: Difference between revisions

round: Amend such that result remains with maxDigits dp when decimals > maxDigits
No edit summary
(round: Amend such that result remains with maxDigits dp when decimals > maxDigits)
Line 183: Line 183:
   
   
         if(maxDigits ~= nil and decimals > maxDigits) then
         if(maxDigits ~= nil and decimals > maxDigits) then
             result = string.format("%."..minDigits.."f", tonumber(string.format("%."..maxDigits.."f", result)))
             result = 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)