FHIR Chat · javascript decimal precision · implementers

Stream: implementers

Topic: javascript decimal precision


view this post on Zulip Brett Esler (Apr 06 2020 at 03:28):

this has come up before but looking for an easy answer; Quanity value as a decimal in JSON, when parsed, effectively looses precision - e,g 2.000 goes to 2 - any good parsing solutions to keep the precision so can at least present the value back as a string like "2.000" ?

view this post on Zulip Grahame Grieve (Apr 06 2020 at 03:42):

what parsing library are you using?

view this post on Zulip Brett Esler (Apr 06 2020 at 03:44):

this is a SMART on FHIR app developer just using JSON.parse()

view this post on Zulip Brett Esler (Apr 06 2020 at 03:45):

would https://github.com/jtobey/javascript-bignum work? since they care about the precision

view this post on Zulip Grahame Grieve (Apr 06 2020 at 03:46):

it's referenced in the spec ;-)

view this post on Zulip Brett Esler (Apr 06 2020 at 03:46):

they are probably looking for the simplest thing possible to be able to present back the full precision in a string

view this post on Zulip Paul Lynch (Mar 12 2021 at 22:10):

javascript-bignum was last updated 5 years ago and has 4 open issues.


Last updated: Apr 12 2022 at 19:14 UTC