Text → number fails not_a_number when it is not a number, and out_of_range when it is one too big for the type, however many digits.
text_to_number.zg
# Text → number fails `not_a_number` when it is not a number, and `out_of_range`# when it is one too big for the type, however many digits (owner, 2026-09-24).# Text comes from outside, so either is bad input to handle, never a crash.MAIN{let'a':=to.int32["42"]otherwise0;let'b':=to.int32["99999999999"]otherwise-1;# too big for int32let'c':=to.int64["99999999999999999999999999999999999999999999"]otherwise-1;# too big for anythinglet'd':=to.uint8["-1"]otherwise0;# below what uint8 holdslet'e':=to.int32["12x"]otherwise-2;# not a number at allstd::print.useful['a'," ",'b'," ",'c'," ",'d'," ",'e',newln];# text → bin: digits, an optional fraction, an optional exponent (owner, 2026-09-24: b)let'f':=to.bin64["2.5e3"]otherwise-1.0;let'g':=to.bin64["nan"]otherwise-1.0;# not a number: a data file's "missing" lands herelet'h':=to.bin64["1e400"]otherwise-2.0;# a number too big for bin64std::print.useful['f'," ",'g'," ",'h',newln];}