Agree, it's broken... in java... Has it has been broken in the past in several architectures...
I understand your frustration but this is not something new. It's been a problem for at least 30 years. It is kind of a basic programming issue: - Never compare floats with different representations. - Never mix different representations in computations - Convert representations as early as possible to a common format These are the rules to follow to avoid running into trouble. Now if you think you can overcome this persistent (ah ! ah !) problem with some David Copperfield trick, fine. But that's a trick nothing else. The problem will resurface in some form in another. Better cope with reality... Luc P. > On Jan 23, 2015, at 1:33 AM, Immo Heikkinen <immo.heikki...@gmail.com> wrote: > > > > I actually ran into this while comparing nested data structures from two > > different sources and spent a good part of my day figuring out what's > > happening. While it is a good advice to avoid mixing floats and doubles, it > > is inevitable that Clojure users will get bitten by this once in a while > > and hours will be wasted. > > > > It is also very disturbing to realise that "(= a b)" doesn't always imply > > "(= (hash a) (hash b))" or "(= #{a} #{b})" as you would think. > > (inc) > > This is fundamentally broken behavior. Telling people to just learn to avoid > it is not good, IMO. If the hashes must be unequal, then = should return > false. > > As for backwards compatibility, note that if such a change were made to =, it > wouldn't affect anyone who was already following Andy's advice to avoid > mixing doubles and floats. IOW, it should only affect those who are doing > something you're not "supposed" to do anyway. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Luc Prefontaine<lprefonta...@softaddicts.ca> sent by ibisMail! -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.