h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.9k stars 323 forks source link

fix: Support up to 1e-20 numbers in ui.spinbox #1525 #2248

Closed marek-mihok closed 5 months ago

marek-mihok commented 5 months ago

The PR fulfills these requirements: (check all the apply)

The problem was with calculatePrecision function not working with scientific (exponential) notation numbers.

The fix converts scientific notation numbers to regular decimal numbers and it uses Number.toFixed() for conversion.

This solution is simple but works for numbers with up to 20 decimal points. To support more decimal points, it would need more complicated solution (something like this one but more reliable).

I think 20 decimal points should be enough for now and if it won't, someone will open the new issue. Wdyt @mturoci ?

Closes #1525

mturoci commented 5 months ago

I think 20 decimal points should be enough for now

wdyt @pascal-pfeiffer?

pascal-pfeiffer commented 5 months ago

20 decimals is enough for our needs. Sounds good! If there happens to be a new case that needs more, we can reconsider alternatives.

Thank you @marek-mihok !