Browse Source

Full numbers still go to scientific once they get sufficiently large

tags/v0.7.0^2
Fen Dweller 7 years ago
parent
commit
fc7ba45b45
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      units.js

+ 5
- 1
units.js View File

@@ -43,7 +43,11 @@ function numberRough(value,suffix="") {
function number(value, type="full", precision=3) { function number(value, type="full", precision=3) {
var val = parseFloat(value); var val = parseFloat(value);
switch(type) { switch(type) {
case "full": return val.toString();
case "full":
if (Math.log(value) / Math.log(10) < 10) {
return val.toString();
}

case "scientific": return val.toExponential(precision).toString(); case "scientific": return val.toExponential(precision).toString();
case "words": return number_words_repeated(val); case "words": return number_words_repeated(val);
case "prefix": return number_prefix(val); case "prefix": return number_prefix(val);


Loading…
Cancel
Save