Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min, max and decimalFormat functions #36

Closed
dacanhminhle opened this issue May 11, 2017 · 1 comment
Closed

min, max and decimalFormat functions #36

dacanhminhle opened this issue May 11, 2017 · 1 comment

Comments

@dacanhminhle
Copy link

dacanhminhle commented May 11, 2017

Hello,

I downloaded the geostats library several days ago, it was the master branch. I found some little issues in the new implementation of the 3 functions min, max and decimalFormat.

In the min and max functions, there are undeclared variables respectively called min (line 277) and max (line 293), that I believe is a bug when you changed the implementation for those 2 functions. I think they should be this.stat_min and this.stat_max instead.

In the decimalFormat function, when you use toFixed() (line 245), values in the number array (a) will be converted to string and copied to the new array (b). Therefore, there will be a subtle type transformation of the serie, and will become a greater issue when we search for the min and max values of the serie (since 2 < 12 but "2" > "12"). I suggest to add parseFloat after doing toFixed() (b[i] = parseFloat(parseFloat(a[i]).toFixed(this.precision));).

Nonetheless, your library geostats is a great help for our works concerning statistics.

Best regards,
Dac Anh Minh LE

@simogeo
Copy link
Owner

simogeo commented May 12, 2017

Thanks for reporting.
I introduced proposed fixes.
I quickly restored old code to fix a bug issue related to min/max whithout changing varibales names. Well spotted.

I also implemented a type transformation on decimalFormat().

Last commit is available at 8941b54
I also release geostats in v1.6.
Thanks again.

@simogeo simogeo closed this as completed May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants