Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Floats are rounded when they should not be #18

Closed
denis-soundcloud opened this issue Sep 29, 2016 · 2 comments
Closed

Floats are rounded when they should not be #18

denis-soundcloud opened this issue Sep 29, 2016 · 2 comments

Comments

@denis-soundcloud
Copy link
Contributor

denis-soundcloud commented Sep 29, 2016

Expected behavior

Do not reformat float. Example withcurl:

% curl http://example.com/tracks/123 | jq . | grep bpm
    "bpm": 128.10000610351562,

(This uses jq to pretty-print the JSON.)

Actual behavior

crul reformats floats. Example:

% crul http://example.com/tracks/123 | grep bpm
    "bpm": 128.1,
@asterite
Copy link
Contributor

I think it's because crul was compiled with a very old crystal version where floats weren't formatted correctly. Compiling with a newer compiler should fix this... except that crul doesn't seem to compile anymore with the latest compiler due to breaking changes (and a required dependency, completion, doesn't compile either)

@porras
Copy link
Owner

porras commented Nov 17, 2016

You were right @asterite, the specific example reproduced by @denis-soundcloud was fixed by #20:

$ curl http://localhost:4568/ | jq . | grep float
  "float": 128.10000610351562

$ crul http://localhost:4568/ | grep float
  "float": 128.10000610351562

(I'm running a small app that returns that, of course)

Thanks, you two!

@porras porras closed this as completed Nov 17, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants