changeset 5385:436e67ca8c79

Give docstrings to least-{positive,negative}-normalized-float, float-*epsilon 2011-03-29 Aidan Kehoe <kehoea@parhasard.net> * cl.el: * cl.el (least-positive-float): * cl.el (least-positive-normalized-float): * cl.el (least-negative-normalized-float): * cl.el (float-epsilon): * cl.el (float-negative-epsilon): Document some previously-undocumented float constants here. * cl.el (oddp): * cl.el (evenp): Change numeric comparison to use #'eql instead of #'eq in passing.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 29 Mar 2011 17:28:34 +0100
parents 3889ef128488
children af961911bcb2 5f5d48053e86
files lisp/ChangeLog lisp/cl.el
diffstat 2 files changed, 44 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Mar 24 11:00:11 2011 -0600
+++ b/lisp/ChangeLog	Tue Mar 29 17:28:34 2011 +0100
@@ -1,3 +1,17 @@
+2011-03-29  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* cl.el:
+	* cl.el (least-positive-float):
+	* cl.el (least-positive-normalized-float):
+	* cl.el (least-negative-normalized-float):
+	* cl.el (float-epsilon):
+	* cl.el (float-negative-epsilon):
+	Document some previously-undocumented float constants here.
+	* cl.el (oddp):
+	* cl.el (evenp):
+	Change numeric comparison to use #'eql instead of #'eq in
+	passing.
+
 2011-03-24  Jerry James  <james@xemacs.org>
 
 	* cl-macs.el (loop): "arbitary" -> "arbitrary".
--- a/lisp/cl.el	Thu Mar 24 11:00:11 2011 -0600
+++ b/lisp/cl.el	Tue Mar 29 17:28:34 2011 +0100
@@ -312,11 +312,11 @@
 
 (defun oddp (integer)
   "Return t if INTEGER is odd."
-  (eq (logand integer 1) 1))
+  (eql (logand integer 1) 1))
 
 (defun evenp (integer)
   "Return t if INTEGER is even."
-  (eq (logand integer 1) 0))
+  (eql (logand integer 1) 0))
 
 ;; XEmacs addition
 (defalias 'cl-abs 'abs)
@@ -329,13 +329,35 @@
 (defconst most-negative-float nil
   "The float closest in value to negative infinity.")
 (defconst least-positive-float nil
-  "The positive float closest in value to 0.")
+  "The positive float closest in value to zero.")
 (defconst least-negative-float nil
-  "The negative float closest in value to 0.")
-(defconst least-positive-normalized-float nil)
-(defconst least-negative-normalized-float nil)
-(defconst float-epsilon nil)
-(defconst float-negative-epsilon nil)
+  "The negative float closest in value to zero.")
+(defconst least-positive-normalized-float nil
+  "The normalized positive float closest in value to zero.
+
+A float is normalized if the most significant bit of its mantissa is 1.
+Use of denormalized (equivalently, subnormal) floats in calculations will
+lead to gradual underflow, though they can be more accurate in representing
+individual small values.  Normal and subnormal floats are as described in
+IEEE 754.")
+
+(defconst least-negative-normalized-float nil
+  "The normalized negative float closest in value to zero.
+
+See `least-positive-normalized-float' for details of normal and denormalized
+numbers.")
+
+(defconst float-epsilon nil
+  "The smallest float guaranteed not `eql' to 1.0 when added to 1.0.
+
+That is, (eql 1.0 (+ 1.0 X)) will always give nil if (<= float-epsilon X) ,
+but it may give t for smaller values.")
+
+(defconst float-negative-epsilon nil
+  "The smallest float guaranteed not `eql' to 1.0 when subtracted from 1.0.
+
+That is, (eql 1.0 (- 1.0 X)) will always give nil if (<=
+float-negative-epsilon X) , but it may give t for smaller values.")
 
 ;;; Sequence functions.