         continue
 
       # Get the key
-      log = Math.log1p(d) - Math.log1p(low)  # subtract the low offset
+      log = log1p(d) - log1p(low)  # subtract the low offset
       key = Math.floor(log * scale)
 
       # Deal with upper bound

    n = palette.length
    low = @low ? _.min(data)
    high = @high ? _.max(data)
    scale = n / (Math.log1p(high) - Math.log1p(low))  # subtract the low offset
    max_key = palette.length - 1
    values = []



ColorMapper = require "./color_mapper"

# Math.log1p() is not supported by any version of IE, so let's use a polyfill based on
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p.
log1p = Math.log1p ? (x) -> Math.log(1 + x)

class LogColorMapper extends ColorMapper.Model
  type: "LogColorMapper"
