# `QuakeServer.TextNumbers`
[🔗](https://github.com/jaman/quake_server/blob/v0.1.0/lib/quake_server/text_numbers.ex#L1)

Numbers read from text as C's `strtod`, `strtol` and `atof` read them, the readings
FTE's `stof` builtin and its entity-key parser (`ED_ParseEpair`) use.

    QuakeServer.TextNumbers.strtod(" .3 rest")
    #=> {0.3, " rest"}
    QuakeServer.TextNumbers.atof(".3")
    #=> 0.30000001192092896
    QuakeServer.TextNumbers.strtol("0x1f")
    #=> {31, ""}

Leading white space (space, tab, newline, vertical tab, form feed, carriage return) is
skipped and a `+` or `-` sign read. `strtod` reads a decimal number (digits with an
optional point, at least one digit, an optional exponent `e` or `E`) or a hexadecimal
one (`0x` or `0X`, hex digits with an optional point, an optional binary exponent `p`
or `P`); `strtol` reads base 0: `0x` hexadecimal, a leading `0` octal, else decimal.
Text with no number reads as 0 with the whole text left. Infinities and NaNs, which
QuakeC memory cannot hold, are not read; a number beyond a double's range reads as the
largest double of its sign.

# `atof`

```elixir
@spec atof(String.t()) :: float()
```

The number at the front of `text` as `atof` reads it into a 32-bit float.

# `float32`

```elixir
@spec float32(number()) :: float()
```

`value` rounded to a 32-bit float, a value beyond its range to its largest of that sign.

# `int32`

```elixir
@spec int32(integer()) :: integer()
```

`value` wrapped to a signed 32-bit integer.

# `strtod`

```elixir
@spec strtod(String.t()) :: {float(), String.t()}
```

The number at the front of `text`, a double, and the text after it.

# `strtol`

```elixir
@spec strtol(String.t()) :: {integer(), String.t()}
```

The whole number at the front of `text`, read in base 0, and the text after it.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
