NationalGenomicsInfrastructure / NGI_dashboards

SciLifeLab NGI Dashboard Code

Home Page:https://ngisweden.scilifelab.se/file/stockholm_dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Floating points are awesome!

remiolsen opened this issue · comments

Try this in javascript:

0.58 * 100

The result:
screen shot 2016-01-27 at 17 14 00

Math.round(0.58*100);

or

(0.58*100).toFixed(0);

Also, python :

>>> 0.58*100
57.99999999999999

Easier than that in this case - offending number is in a HighCharts label which supports string formatting. So just a case of changing {y} to {y:,.0f}. Already done and about to commit.