function nonintegerp (was RE: should all floats be nonintegers?)
Subject: function nonintegerp (was RE: should all floats be nonintegers?)
From: Barton Willis
Date: Fri, 21 Dec 2012 13:45:51 +0000
My nonintegerp function has the defect
(%i17) featurep(inf,noninteger);
sign: sign of und is undefined. -- an error. To debug this try: debugmode(true);
I could look for floor to return und, and handle that, but is more general way?
Additionally, should all complex numbers be noninteger? Currently
(%i1) featurep(%i+7,noninteger);
(%o1) false
(%i2) featurep(%i,noninteger);
(%o2) true
(defun nonintegerp (e)
(cond ((and (symbolp e) (or (kindp e '$noninteger) (check-noninteger-facts e) (kindp e '$irrational)))) ;declared noninteger
((mnump e)
(if (integerp e) nil t)) ;all floats are noninteger and integers are not nonintegers
(($ratp e)
(nonintegerp ($ratdisrep e)))
(t
(eq t (mgrp e (take '($floor) e))))))
--Barton