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

Maintaining precision with numbers #63

Open
brianreinhold opened this issue Sep 11, 2020 · 3 comments
Open

Maintaining precision with numbers #63

brianreinhold opened this issue Sep 11, 2020 · 3 comments

Comments

@brianreinhold
Copy link

This is more of a question than a bug. I am trying to find a way to encode a decimal value with the proper precision. For example, with a precision of 1/1000, I want to encode 2.000 and not 2 or 2.0. The easy way would be to encode it as a string, but the FHIR spec requires that it be encoded as a number.

In Java I had access to a minimal JSON library where I had the option to encode the string sequence that would appear in the value even though the value itself was representing an integer.

In any case, is there a way I could encode a float. double, or Decimal value with the correct precision? What would it take to do it?

@brianreinhold
Copy link
Author

Actually I have a hunch I know how to do it looking at the encoder code but I am so new to Swift and Xcode I wouldn't put too much on that. So I am trying to figure out how to import this source into a test XCode project.

@fabianfett
Copy link
Collaborator

Is this a duplicate of #64?

@brianreinhold
Copy link
Author

brianreinhold commented Sep 14, 2020 via email

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