문서 편집 권한이 없습니다. 다음 이유를 확인해주세요: 요청한 명령은 다음 중 하나의 권한을 가진 사용자에게 제한됩니다: 사용자, 관리자. 문서를 고치려면 이메일 인증 절차가 필요합니다. 사용자 환경 설정에서 이메일 주소를 입력하고 이메일 주소 인증을 해주시기 바랍니다. 문서의 원본을 보거나 복사할 수 있습니다. require('Module:No globals') local p = {} function p._main(n, d) local num = tonumber(n) if not num then error('Unable to convert "' .. tostring(n) .. '" to a number') end local decimals = tonumber(d) if not decimals then error('Unable to convert "' .. tostring(d) .. '" to a number') end local maxDecimals = 14 - math.floor(math.log10(num)) -- to allow a maximum of 15 significant figures, which is the highest guaranteed correct with doubles if decimals > maxDecimals then decimals = maxDecimals end local mult = 10^decimals num = math.floor(num * mult + 0.5) / mult if decimals < 0 then return tostring(num) else return string.format('%.' .. decimals .. 'f', num) end end function p.main(frame) local args, pargs = frame.args, frame:getParent().args return p._main(mw.ext.ParserFunctions.expr(args[1] or pargs[1]), mw.ext.ParserFunctions.expr(args[2] or pargs[2])) end return p 모듈:Decimals 문서로 돌아갑니다.