             '-'
           else
             if column.type is 'real'
-              (getFormatFunction column.precision) value
+              formatReal column.precision, value
             else
               value
 

              column.domain.length
            else
              column[attribute]
        else
          switch attribute
            when 'cardinality'
              '-'
            else
              column[attribute]


significantDigitsBeforeDecimal = (value) -> 1 + Math.floor Math.log(value) / Math.LN10

formatToSignificantDigits = (digits, value) ->
  if value is 0
    0
  else
    sd = significantDigitsBeforeDecimal value
    if sd >= digits
      value.toFixed 0
    else
      magnitude = Math.pow 10, digits - sd
      Math.round(value * magnitude) / magnitude

formatReal = do ->
  __formatFunctions = {}
  getFormatFunction = (precision) ->
    if precision is -1
      identity
    else
      __formatFunctions[precision] or __formatFunctions[precision] = d3.format ".#{precision}f"

  (precision, value) ->
    (getFormatFunction precision) value

Steam.FrameView = (_, _frame) ->
  createSummaryRow = (attribute, columns) ->
