Skip to content

Commit dbd7383

Browse files
committed
Slight optimization for previous fix.
1 parent 6ca72c4 commit dbd7383

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

d3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ var d3_format_types = {
512512
e: function(x, p) { return x.toExponential(p); },
513513
f: function(x, p) { return x.toFixed(p); },
514514
r: function(x, p) {
515-
var n = 1 + Math.floor(1e-15 + Math.log(x) / Math.LN10);
515+
var n = x ? 1 + Math.floor(1e-15 + Math.log(x) / Math.LN10) : 1;
516516
return d3.round(x, p - n).toFixed(Math.max(0, Math.min(20, p - n)));
517517
}
518518
};

0 commit comments

Comments
 (0)