What version are you running?

As far as I know, .3 isn't even a valid representation for a number --
you'd have to write it as 0.3.  So I'm not sure where you're running that
code snippet such that you don't get an immediate error.

On 1.5.1:

=> (+ 0.3 1.7)
2.0

That said, I think most programmers know that floating point
representations of numbers are inexact.  That's why, if you care about
exactness, you should write:

=> (+ 0.3M 1.7M)
2.0M

On Tue, Apr 9, 2013 at 1:53 AM, Cedric Greevey <cgree...@gmail.com> wrote:

> This may look mildly surprising, and suggests one more thing *not* to ever
> do in production code:
>
> user=> (+ .3 1.7)
> 2.1
> user=>
>
> :)
>
> Shouldn't be hard to figure out how to put a repl in a state where that
> expression will evaluate to that result. I'm sure mathematicians everywhere
> are deeply offended by the clojure reader now. :)
>
>  --
> --
> 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