Module:Math: Difference between revisions

441 bytes added ,  11 years ago
deal with unary minus
m>Dragons flight
m (really fix trailing periods)
m>Dragons flight
(deal with unary minus)
Line 119: Line 119:
     end     
     end     
      
      
     local formatted_num = lang:formatNum( value );
     local formatted_num;
   
    -- Use proper unary minus sign rather than ASCII default
    if value < 0 then
        formatted_num = '−';
    else
        formatted_num = '';
    end   
   
    formatted_num = formatted_num .. lang:formatNum( math.abs(value) );
     local order;
     local order;
      
      
Line 148: Line 157:
     -- Add exponential notation, if necessary.
     -- Add exponential notation, if necessary.
     if order ~= 0 then
     if order ~= 0 then
         formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. lang:formatNum(order) .. '</sup>'
        -- Use proper unary minus sign rather than ASCII default
        if order < 0 then
            order = '−' .. lang:formatNum( math.abs(order) );
        else
            order = lang:formatNum( order );
        end   
       
         formatted_num = formatted_num .. '<span style="margin:0 .15em 0 .25em">×</span>10<sup>' .. order .. '</sup>'
     end
     end
      
      
Anonymous user