Numbers

Table of Contents

1. Floating Points and Integers

2. Type Predicates for Numbers

3. Numeric Conversions

4. Arithmetics

mod dividend divisor returns the value of dividend modulo divisor. The result has same sign as divisor. This operator supports FP arguments, which rounds the quotient downward to an integer to compute the remainder.

5. Rounding

6. Bitwise Operations

7. Random Numbers

We mainly use random &optional arg function to generate pseudo-random numbers. To be more specific, random may have different behaviours dependent on the argument it accepts:

random <positive integer>
The function will return a non-negative and less than arg.
random <string>
If arg is a string, the seed will be determined from it. It’s useful to return reproducible results.
random t
If arg is t, it means a new seed is chosen, making later calls return unpredictable results.

Date: 2026-08-11 Tue

Author: ArcaLunar