My understanding is that a rational number is one that can be written as a 
fraction. For example, 5.1, which can be written as 51/10. But Clojure 
seems to disagree:

~~~
(rational? 51/10) ;=> true
(rational? 5.1)   ;=> false (?!)
~~~

Is my definition of "rational" incorrect?

Also, my understanding is that a decimal number is one that has a decimal 
point in it, like, for example, 5.1. However:

~~~
(decimal? 5.1) ;=> false (?!)
~~~

And while typing this, I also notice that while `integer?` acts like I'd 
expect, `float?` does something weird:

~~~
(integer? 5)   ;=> true     Yes
(integer? 5N)  ;=> true     Yes
(integer? 5.1) ;=> false    

(float? 5.1)  ;=> true
(float? 5.1M) ;=> false (?!)
~~~

Maybe I'm confusing "floating point number" with "decimal number" here? If 
so, what's the difference?

Thanks!

-- 
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.

Reply via email to