Ftos

From QuakeQEWiki
Revision as of 08:27, 17 February 2022 by Teamred (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

ftos is a quake-c function which converts a single floating point to a string (thus the contracted name f-to-s).

It is one of very few string methods in vanilla quake c


There are lots of different needs when turning numbers into strings. ftos has quirks most especially that it doesn't always produce a string containing only numbers.

function call string output string length
ftos(3) "3" 1
ftos(3.0) "3" 1
ftos(3.1) " 3.1" 5
ftos(23.1) " 23.1" 5
ftos(123.1) "123.1" 5
ftos(1234.1) "1234.1" 6