The strconv library - pf-lang/pipefish GitHub Wiki
formatFloat converts the floating-point number f to a string, according to the
format fmt and precision prec. It rounds the result assuming that the original was
obtained from a floating-point value of bitSize bits (32 for float32, 64 for float64).
The format fmt is one of
- 'b' (-ddddp±ddd, a binary exponent),
- 'e' (-d.dddde±dd, a decimal exponent),
- 'E' (-d.ddddE±dd, a decimal exponent),
- 'f' (-ddd.dddd, no exponent),
- 'g' ('e' for large exponents, 'f' otherwise),
- 'G' ('E' for large exponents, 'f' otherwise),
- 'x' (-0xd.ddddp±ddd, a hexadecimal fraction and binary exponent), or
- 'X' (-0Xd.ddddP±ddd, a hexadecimal fraction and binary exponent).
The precision prec controls the number of digits (excluding the exponent) printed by
the 'e', 'E', 'f', 'g', 'G', 'x', and 'X' formats. For 'e', 'E', 'f', 'x', and 'X', it
is the number of digits after the decimal point. For 'g' and 'G' it is the maximum
number of significant digits (trailing zeros are removed). The special precision -1 uses
the smallest number of digits necessary such that ParseFloat will return f exactly.
The exponent is written as a decimal integer; for all formats other than 'b', it will be
at least two digits.
formatInt returns the string representation of i in the given base, for 2 <= base
<= 36. The result uses the lower-case letters 'a' to 'z' for digit values >= 10.
parseInt`` interprets a string s`` in the given base (0, 2 to 36) and returns the
corresponding integer.
The string may begin with a leading sign: "+" or "-".
If the base argument is 0, the true base is implied by the string's prefix following
the sign (if present): 2 for "0b", 8 for "0" or "0o", 16 for "0x", and 10 otherwise.
Also, for argument base 0 only, underscore characters are permitted as defined by the Go
syntax for integer literals.
Calls the preceding function with base set to 0.
This page is automatically generated from the Pipefish standard library. Any edits made directly to this wiki page will be overwritten the next time the documentation is regenerated.