detecting NaN and Infiinity

"Oleg A. Paraschenko" <[email protected]> Tue, 29 May 2007 08:11:21 +0400
Newsgroups gmane.comp.java.sisc.user
Organization private person
Message-ID <[email protected]>
Hello,

I've tried to detect infinities and numbers using different combinations
of '=' and 'eq', but failed. Would you please suggest the correct way?

(define gx:+nan.0 #!nan)
(define gx:+inf.0 #!+inf)
(define gx:-inf.0 #!-inf)

(define gx:nan? .... please help ....)
(define gx:inf? .... please help ....)

Expected:

(map gx:inf? (list gx:+nan.0 gx:+inf.0 gx:-inf.0)) ===> (#f #t #t)
(map gx:nan? (list gx:+nan.0 gx:+inf.0 gx:-inf.0)) ===> (#t #f #f)
(map gx:inf? (list (/ 0.0 0.0) (/ 1.0 0.0) (/ -1.0 0.0))) ===> (#f #t #t)
(map gx:nan? (list (/ 0.0 0.0) (/ 1.0 0.0) (/ -1.0 0.0))) ===> (#t #f #f)

Thanks in advance.



-- 
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme
http://tohtml.com/       Online syntax highlighting

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/