Module:Math: Difference between revisions

    m>Dragons flight
    (problem with lost precision)
    m>Dragons flight
    (can't work due to prehandling by #expr, simplify)
    Line 109: Line 109:
         local lang = mw.getContentLanguage();
         local lang = mw.getContentLanguage();
          
          
         local value_string = ( frame.args[1] or '0' )
         local value = tonumber( frame.args[1] or 0 );
        local value = tonumber( value_string );
         local precision = tonumber( frame.args[2] or 0 );
         local precision = tonumber( frame.args[2] or 0 );
         local current_precision = z._precision( value );
         local current_precision = z._precision( value );
    Line 119: Line 118:
         -- some circumstances because the terminal digits will be inaccurately reported.
         -- some circumstances because the terminal digits will be inaccurately reported.
         if order + precision >= 14 then
         if order + precision >= 14 then
             local orig_precision = z._precision( value_string );
             precision = 13 - order;      
            if order + orig_precision >= 14 then
                precision = 13 - order;
            end
         end
         end