Skip to content

Commit

Permalink
fixing min/max variables bug
Browse files Browse the repository at this point in the history
parsing value as float in decimalFormat() methode
  • Loading branch information
simon committed May 12, 2017
1 parent 9a0b715 commit 8941b54
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
2 changes: 2 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ From version 1.5.0 to 1.6.0
- Typo bug converting string to float | issue #32
- Force precision to 20 if user defined is superior - to prevent browser error | issue #34
- Mean calculation outside loop | issue #35
- Min / Max methods handled without using Math function | supposed to prevent issue #33
- Cast values to Float on decimalFormat method | issue #36

From version 1.4.0 to 1.5.0
---------------------------
Expand Down
6 changes: 3 additions & 3 deletions lib/geostats.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ var geostats = function(a) {
for (var i = 0; i < a.length; i++) {
// check if the given value is a number
if (isNumber(a[i])) {
b[i] = parseFloat(a[i]).toFixed(this.precision);
b[i] = parseFloat(parseFloat(a[i]).toFixed(this.precision));
} else {
b[i] = a[i];
}
Expand Down Expand Up @@ -274,7 +274,7 @@ var geostats = function(a) {
this.stat_min = this.serie[0];

for (i = 0; i < this.pop(); i++) {
if (this.serie[i] < min) {
if (this.serie[i] < this.stat_min) {
this.stat_min = this.serie[i];
}
}
Expand All @@ -290,7 +290,7 @@ var geostats = function(a) {

this.stat_max = this.serie[0];
for (i = 0; i < this.pop(); i++) {
if (this.serie[i] > max) {
if (this.serie[i] > this.stat_max) {
this.stat_max = this.serie[i];
}
}
Expand Down
Loading

0 comments on commit 8941b54

Please sign in to comment.