Name printedNumber's dp cases, and say what prints and proveNumber a builtin sets

This commit is contained in:
2026-09-29 04:10:36 +02:00
committed by Lillem4n
parent be9ab3efcf
commit 0dfa615b54
5 changed files with 27 additions and 16 deletions
+3 -1
View File
@@ -16,6 +16,8 @@ import (
const (
maxLen = 1 << 20
maxDecimals = 1024
// shortestDecimals prints the fewest digits that read back as the same float64.
shortestDecimals = -1
)
// builtins is the registry of {name(args)} functions. Derivations read the digits
@@ -100,7 +102,7 @@ func chars(alphabet string) func([]string) callFn {
const hexDigits = "0123456789abcdef"
// formatFloat prints v to dp decimals, -1 for the shortest form, and a zero unsigned.
// formatFloat prints v to dp decimals, or shortestDecimals, and a zero unsigned.
func formatFloat(v float64, dp int) string {
s := strconv.FormatFloat(v, 'f', dp, 64)
if strings.HasPrefix(s, "-") && strings.Trim(s, "-0.") == "" {