[plt-scheme] Numeric Comparison Contracts

From: Doug Williams (m.douglas.williams at gmail.com)
Date: Wed Oct 28 11:44:29 EDT 2009

I have a question about numeric comparisons (inequality operators) in
contracts.I'm not sure if it's a documentation bug or an implementation bug,
but </c specifies a real? argument, while >/c, <=/c, and >=/c (and between/c
and possibly others) specifies a number? argument. Unfortunately, they
actually error (as opposed to giving a contract violation) when given a
complex number. [The actual inequality operators require real numbers.] So,
you actually need to write (and/c real? (<=/c 0.0)), for example, to guard
the <=/c contract. It seems that the inequality operators should require
(and enforce) a real number as its argument.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091028/d12d9c87/attachment.html>

Posted on the users mailing list.