const {abs, ceil, floor, pow, log, LN10} = Math;

export default function e3Ticks(domain, ticks) {
  if(domain) {
    return linearTickRange(domain, ticks);
  } else {
    return [];
  }
}

function linearTickRange(extent, m = 10) {
  let span = extent[1] - extent[0],
      step = pow(10, floor(log(span / m) / LN10)),
      err = m / span * step;

  // Filter ticks to get closer to the desired count.
  if (err <= .15) step *= 10;
  else if (err <= .35) step *= 5;
  else if (err <= .75) step *= 2;

  // Round start and stop values to step interval.
  return range(ceil(extent[0] / step) * step, floor(extent[1] / step) * step + step * .5, step);
}

function range(start, stop, step) {
  if (arguments.length < 3) {
    step = 1;
    if (arguments.length < 2) {
      stop = start;
      start = 0;
    }
  }
  if ((stop - start) / step === Infinity) throw new Error("infinite range");
  let range = [],
       k = integerScale(abs(step)),
       i = -1,
       j;
  start *= k, stop *= k, step *= k;
  if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
  else while ((j = start + step * ++i) < stop) range.push(j / k);
  return range;
}

function integerScale(x) {
  let k = 1;
  while (x * k % 1) k *= 10;
  return k;
}

@@ -414,12 +414,19 @@
  %3C= 
+0
 .15)
+ %7B%0A   
  ste
@@ -435,16 +435,18 @@
 *= 10;%0A 
+ %7D
  else if
@@ -458,12 +458,19 @@
  %3C= 
+0
 .35)
+ %7B%0A   
  ste
@@ -478,16 +478,18 @@
  *= 5;%0A 
+ %7D
  else if
@@ -501,12 +501,19 @@
  %3C= 
+0
 .75)
+ %7B%0A   
  ste
@@ -519,16 +519,20 @@
 ep *= 2;
+%0A  %7D
 %0A%0A  // R
@@ -662,16 +662,17 @@
  step * 
+0
 .5, step
@@ -877,16 +877,22 @@
 nfinity)
+ %7B%0A   
  throw n
@@ -925,15 +925,23 @@
 ;%0A  
-let ran
+%7D%0A%0A  let usedRa
 ge =
@@ -945,19 +945,16 @@
 e = %5B%5D,%0A
-   
     k = 
@@ -981,23 +981,16 @@
 p)),
-%0A      
  i = -1,
 %0A   
@@ -989,19 +989,13 @@
  -1,
-%0A      
  j;%0A
+%0A
   st
@@ -1026,16 +1026,17 @@
 p *= k;%0A
+%0A
   if (st
@@ -1042,16 +1042,22 @@
 tep %3C 0)
+ %7B%0A   
  while (
@@ -1085,27 +1085,38 @@
 +i) %3E stop) 
-ran
+%7B%0A      usedRa
 ge.push(j / 
@@ -1121,20 +1121,34 @@
 / k);%0A  
-else
+  %7D%0A  %7D else %7B%0A   
  while (
@@ -1180,19 +1180,30 @@
 %3C stop) 
-ran
+%7B%0A      usedRa
 ge.push(
@@ -1210,16 +1210,26 @@
 j / k);%0A
+    %7D%0A  %7D%0A
   return
@@ -1229,19 +1229,22 @@
  return 
-ran
+usedRa
 ge;%0A%7D%0A%0Af

Fix JS Hint