`prim_toString` uses `state.coerceToString`, which in turns defers to `std::to_string` for floats, which 'Converts a floating point value to a string as if by std::sprintf(buf, "%f", value)'. Finally, the `%f` specifier 'Converts floating-point number to the decimal notation in the style [-]ddd.ddd. Precision specifies the exact number of digits to appear after the decimal point character. The default precision is 6.' Closes #747 Change-Id: I42339651005d20f272459cf9f80b274f2076b1e3
681 B
681 B
name, args, renameInGlobalScope
| name | args | renameInGlobalScope | |
|---|---|---|---|
| toString |
|
false |
Convert the expression e to a string. e can be:
-
A string (in which case the string is returned unmodified).
-
A path (e.g.,
toString /foo/baryields"/foo/bar". -
A set containing
{ __toString = self: ...; }or{ outPath = ...; }. -
An integer.
-
A floating-point value, it will be converted to the decimal notation in the style
[-]ddd.dddwith 6 digits appearing after the decimal point. -
A list, in which case the string representations of its elements are joined with spaces.
-
A Boolean (
falseyields"",trueyields"1"). -
null, which yields the empty string.