mbostock/d3 — comment on commit 7895afbda5d60eefa56c1851561b6a5c90175a21
File: d3.js line 2278
By jmarca:

No, I'm fine thanks!! As I noted, pow(extent[1]) is 0.4 and pow(extent[0]) is 0.00088. Neither is zero, no infinity problems.

What *is* zero is Math.round( ... ).

I was going to write an issue, but, here is my super hacky fix, so that Math.Round can do what it is supposed to do here.

var i = Math.floor(extent[0]),
j = Math.ceil(extent[1]),
u = Math.round(pow(extent[0])),
v = Math.round(pow(extent[1]));
var power = 1;
while (u === v){
power *= 10;
u = Math.round(pow(extent[0])*power)/power;
v = Math.round(pow(extent[1])*power)/power;
}