Numbers

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 t if the argument is NaN, nil otherwise.
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 obj is a floating point number.
integerp obj
Test whether obj is an integer.
numberp obj
Test whether obj is an integer or a floating point.
natnump obj
Test whether obj is a natrual number.

Date: 2026-08-11 Tue

Author: ArcaLunar