In languages that doesn't give you support to arbitrary precision like
Clojure do, it's a usual practice compare values using round
functions.

In pseudo-C it would be like that:

float a = 148.52 * 0.0256;
float b = 3.802112;

a == b;
=> false

round(a, 5) == round(b, 5);
=> true

Or, if possible, don't use float type.

I saw some coworkers spend a whole night debugging until they figured
that float trick.

On Tue, Apr 9, 2013 at 10:17 AM, Rostislav Svoboda
<rostislav.svob...@gmail.com> wrote:
> I see. I did some testing. It's not clojure, it's not java, it's deeper.
>
> People of planet Earth! Stop wasting time on SETI if your machines
> can't properly calculate 148.52 * 0.0256 !!!
>
> --
> --
> 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/groups/opt_out.
>
>

-- 
-- 
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/groups/opt_out.


Reply via email to