QuakeServer.Builtins.Text (quake_server v0.1.0)

Copy Markdown View Source

Numbers as FTE's ftos and vtos write them for a QuakeC program.

ftos/1 gives a whole number as an integer and anything else as FTE's Q_ftoa: the 32-bit float written with as many decimals as its exponent allows (eight more than the negated power of ten of its binary exponent), trailing zeros and a bare point dropped. ftos/2 with broken: true (the cvar pr_brokenfloatconvert) writes a fraction as %5.1f instead. vtos/1 gives the three numbers as %f (six decimals) between single quotes.

QuakeServer.Builtins.Text.ftos(3.0)
#=> "3"

QuakeServer.Builtins.Text.ftos(0.75)
#=> "0.75"

QuakeServer.Builtins.Text.vtos({1.0, -2.5, 0.0})
#=> "'1.000000 -2.500000 0.000000'"

Summary

Functions

A float as FTE's Q_ftoa writes it.

A float as ftos writes it.

A vector as vtos writes it.

Functions

ftoa(value)

@spec ftoa(number()) :: String.t()

A float as FTE's Q_ftoa writes it.

ftos(value, opts \\ [])

@spec ftos(number(), keyword()) :: String.t()

A float as ftos writes it.

vtos(arg)

@spec vtos({number(), number(), number()}) :: String.t()

A vector as vtos writes it.