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

write-read roundtrip results in different value, when key of a map is a decimal #31

Open
MrEbbinghaus opened this issue Mar 1, 2017 · 5 comments

Comments

@MrEbbinghaus
Copy link

My test generator found following, wrong behavior.

(let [w (transit/writer :json) 
      r (transit/reader :json)]
      (transit/read r (transit/write w {0.5 0})))
==> {0 0}
(let [w (transit/writer :json)]
     (transit/write w {0.5 0.5}))
==> "[\"^ \",\"~i0.5\",0.5]"

Version: [com.cognitect/transit-cljs "0.8.239"]

@msuess
Copy link

msuess commented Sep 16, 2017

I am having the same issue.

@msuess
Copy link

msuess commented Sep 16, 2017

Added a test that exposes this behaviour. Feel free to check out my branch and run lein cljsbuild once test :)

@msuess
Copy link

msuess commented Sep 16, 2017

Taking a stab at it later

@p-himik
Copy link

p-himik commented Jun 28, 2018

Parent issue: cognitect/transit-js#36

@puredanger
Copy link
Contributor

Just as an FYI, due to the difficulties of exact representation and comparison in floating point, using floats as keys in a hash table is generally considered a bad idea.

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

4 participants