469,582 Members | 2,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

float comparison confusion

Type "help", "copyright", "credits" or "license" for more information.
>>cmp(20.10, 20.9)
-1

Why is cmp returning -1 instead of returning positive integer?

Jan 20 '07 #1
2 1791

chrolsonWhy is cmp returning -1 instead of returning positive integer?

Last time I checked 20.1 was less than 20.9.

Skip
Jan 20 '07 #2
"ch******@gmail.com" <ch******@gmail.comwrites:
Type "help", "copyright", "credits" or "license" for more information.
>cmp(20.10, 20.9)
-1

Why is cmp returning -1 instead of returning positive integer?
>>20.10 < 20.9
True
>>20.1 < 20.9
True
>>20.10 == 20.1
True

What leads you to expect otherwise?

--
\ "A society that will trade a little liberty for a little order |
`\ will lose both, and deserve neither." -- Thomas Jefferson, in |
_o__) a letter to Madison |
Ben Finney

Jan 20 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by maxim vexler | last post: by
11 posts views Thread by Gurikar | last post: by
29 posts views Thread by Steven D'Aprano | last post: by
7 posts views Thread by Nobody | last post: by
13 posts views Thread by Shirsoft | last post: by
2 posts views Thread by Rares Vernica | last post: by
4 posts views Thread by Yuan HOng | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.