Hey Mark, don't get paranoid :)... this is all Cedric did!

user=> (def .3 0.4)
#'user/.3
user=> (+ .3 1.7)
2.1

Jim



On 09/04/13 10:46, Mark Engelberg wrote:
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 <[email protected] <mailto:[email protected]>> 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 [email protected]
    <mailto:[email protected]>
    Note that posts from new members are moderated - please be patient
    with your first post.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:clojure%[email protected]>
    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 [email protected]
    <mailto:clojure%[email protected]>.
    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 [email protected]
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
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 [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to