aboutsummaryrefslogtreecommitdiff
path: root/doc/language/function/cpsc-function-num_to_str.7.md
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-28 13:41:26 +0000
committer_ov4 <ov4@ov4.org>2026-10-28 13:41:26 +0000
commit63109537383fa58c6a1db95f275d6b5de63b0015 (patch)
tree318441dd53b9f7208e65867fd57dd2587fa8f147 /doc/language/function/cpsc-function-num_to_str.7.md
parent5370a0d74d90799ca010d308d54330283116ca5e (diff)
docs(overload): document default return selection
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'doc/language/function/cpsc-function-num_to_str.7.md')
-rw-r--r--doc/language/function/cpsc-function-num_to_str.7.md7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/language/function/cpsc-function-num_to_str.7.md b/doc/language/function/cpsc-function-num_to_str.7.md
index 8e895ee..9d9c071 100644
--- a/doc/language/function/cpsc-function-num_to_str.7.md
+++ b/doc/language/function/cpsc-function-num_to_str.7.md
@@ -7,13 +7,16 @@ cpsc-function-num_to_str - convert a number to text
# SYNOPSIS
```text
-NUM_TO_STR(number : INTEGER or REAL) RETURNS STRING
+NUM_TO_STR(number : INTEGER or REAL) RETURNS DEFAULT STRING
+NUM_TO_STR(number : INTEGER or REAL) RETURNS CHAR
```
# DESCRIPTION
Provided by the standard string library, loaded and linked by default.
+The function table in the 9618 winter 2025 insert allows INTEGER or REAL input and STRING or CHAR output. Context selects the result type; the compiler's DEFAULT extension selects STRING when context supplies none. CHAR results use the same formatting as STRING results and must contain exactly one character, otherwise a catchable runtime error is raised. Thus INTEGER 7 can return '7', but INTEGER 12 and REAL 7.0 cannot return CHAR.
+
Format INTEGER as signed decimal text and REAL in the same shortest round-trip form that OUTPUT prints. The text is the shortest decimal text that reads back as the same value (as Python's `repr`): fixed notation with at least one fractional digit when 1e-4 <= |x| < 1e16 (`2.0`, `87.5`, `0.0001`), otherwise scientific notation with an exponent of at least two digits (`1e-07`, `1.5e-07`, `1e+16`); special values print as `-0.0`, `inf`, `-inf` and `nan`.
# EXAMPLE
@@ -24,4 +27,4 @@ OUTPUT NUM_TO_STR(42), " ", NUM_TO_STR(3.5)
# SEE ALSO
-[cpsc-language-overview(7)](../cpsc-language-overview.7.md), [cpsc-function-str_to_num(7)](cpsc-function-str_to_num.7.md).
+[cpsc-language-overview(7)](../cpsc-language-overview.7.md), [cpsc-keyword-default(7)](../keyword/cpsc-keyword-default.7.md), [cpsc-function-str_to_num(7)](cpsc-function-str_to_num.7.md).