You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library seems to suffer from the effects of number representation errors, I assume these are caused by using binary floating point arithmetic for internal calculations.
The effects may be minor (hopefully) when dealing with real-world measurements, but they do cause ugly results when converting "pure" units by powers of ten, e.g:
Input Canonicalises To
pg/L {"value":9.999999999999999e-10,"units":{"g":1,"m":-3}}
(implies 1 unit)
I believe this would would be improved using a high (or arbitrary) precision decimal arithmetic library within the module. Several such libraries are available on Github.
I realise this might be a significant rewrite, and would carry a speed penalty, but it would improve the usability of the library for unit conversion projects.
The text was updated successfully, but these errors were encountered:
Thanks for the comment! This library isn't actively maintained, but I'd be happy to accept a contribution to integrate a bigdecimal library like https://github.com/peterolson/BigRational.js/ (for example).
ucum.js: 0.0.2
The library seems to suffer from the effects of number representation errors, I assume these are caused by using binary floating point arithmetic for internal calculations.
The effects may be minor (hopefully) when dealing with real-world measurements, but they do cause ugly results when converting "pure" units by powers of ten, e.g:
I believe this would would be improved using a high (or arbitrary) precision decimal arithmetic library within the module. Several such libraries are available on Github.
I realise this might be a significant rewrite, and would carry a speed penalty, but it would improve the usability of the library for unit conversion projects.
The text was updated successfully, but these errors were encountered: