Elisp Arithmetics

Table of Contents

1. Truncate, Round, Ceiling, Floor

  ;; to int
  (truncate 3.5) ; => 3

  (round 3.5) ; => 4

  (ceiling 3.5) ; => 4

  (floor 3.5) ; => 3

2. Test If a Number is Integer or Float

Returns t if yes, nil if not.

  (integerp 2) ; t
  (integerp 2.) ; t
  (integerp 2.0) ; nil

  (floatp 2) ; nil
  (floatp 2.) ; nil
  (floatp 2.0) ; t

3. Conversion between Numbers and Strings

  (number-to-string 3) ; => "3"
  (string-to-number "3") ; => 3

4. Equality

We use = equal sign to evaluate equality, arguments can be integers and flaots. We use /= to evaluate inequality.

Date: 2026-07-21 Tue