Numbers in Emacs Lisp
Table of Contents
1. Floating Numbers
Emacs Lisp uses IEEE standard. There’s nothing too much to say here. Let’s talk about some useful functions through examples.
isnan x- This predicate return
tif the argument is NaN,nilotherwise. frexp x- Return a cons cell
(s . e)such that \(x = s \cdot 2^{e}\) and \(s \in [0.5, 1)\) if \(x\) is finite. If \(x\) is infinity or zero, then \(s=x\). Otherwise, \(x\) is NaN, \(s\) is also NaN. logb x- Returns \(\log_{2} x\). If \(x=0\) or \(\infin\), then returns infinity; is \(x\) is NaN, then return NaN.
2. Type Predicators for Numbers
floatp obj- Test whether
objis a floating point number. integerp obj- Test whether
objis an integer. numberp obj- Test whether
objis an integer or a floating point. natnump obj- Test whether
objis a natrual number.