diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-10-28 13:53:15 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-10-28 13:53:15 -0400 |
| commit | 9c302fdc34403f46572d9524309617888ba816bb (patch) | |
| tree | 58ea7faf390536503de114cf2889ed85ba60df7b /docs/nums.md | |
| parent | c632a72486d347e7ef30c0b7890e2045ed42b903 (diff) | |
| parent | ce2aebe91085f987aab31bd2a49820fb605cf386 (diff) | |
Merge branch 'main' into internal-textsinternal-texts
Diffstat (limited to 'docs/nums.md')
| -rw-r--r-- | docs/nums.md | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/nums.md b/docs/nums.md index fc683fe7..9072f86a 100644 --- a/docs/nums.md +++ b/docs/nums.md @@ -543,7 +543,7 @@ The largest integer less than or equal to `x`. ### `format` **Description:** -Formats a number as a string with a specified precision. +Formats a number as a text with a specified precision. **Signature:** ```tomo @@ -556,7 +556,7 @@ func format(n: Num, precision: Int = 0 -> Text) - `precision`: The number of decimal places. Default is `0`. **Returns:** -A string representation of the number with the specified precision. +A text representation of the number with the specified precision. **Example:** ```tomo @@ -569,20 +569,19 @@ A string representation of the number with the specified precision. ### `from_text` **Description:** -Converts a string representation of a number into a floating-point number. +Converts a text representation of a number into a floating-point number. **Signature:** ```tomo -func from_text(text: Text, the_rest: Text = "!&Text" -> Num) +func from_text(text: Text -> Num?) ``` **Parameters:** -- `text`: The string containing the number. -- `the_rest`: A string indicating what to return if the conversion fails. Default is `"!&Text"`. +- `text`: The text containing the number. **Returns:** -The number represented by the string. +The number represented by the text or a null value if the entire text can't be parsed as a number. **Example:** ```tomo @@ -917,7 +916,7 @@ func nan(tag: Text = "" -> Num) **Parameters:** -- `tag`: An optional tag to describe the NaN. Default is an empty string. +- `tag`: An optional tag to describe the NaN. Default is an empty text. **Returns:** A NaN value. @@ -1086,7 +1085,7 @@ func scientific(n: Num, precision: Int = 0 -> Text) - `precision`: The number of decimal places. Default is `0`. **Returns:** -A string representation of the number in scientific notation with the specified precision. +A text representation of the number in scientific notation with the specified precision. **Example:** ```tomo |
