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 -3
View File
@@ -187,7 +187,7 @@ func neverNumeric(n node) (text string, never bool) {
// calcPrep parses the expression and decimals once, at compile time, and places each
// operand name at the position expand will read it into. checkCalc proved both args
// valid, so no step here can fail; dp -1 prints the minimal form.
// valid, so no step here can fail.
func calcPrep(args []string) callFn {
expr, err := parseCalc(args[0])
if err != nil { // a nil AST would be a nil dereference per render, with no message
@@ -204,12 +204,12 @@ func calcPrep(args []string) callFn {
}
}
// calcDecimals is a calc's decimals count, or -1 for the shortest form.
// calcDecimals is a calc's decimals count, or shortestDecimals where it names none.
func calcDecimals(args []string) int {
if len(args) == 2 {
return atoi(args[1])
}
return -1
return shortestDecimals
}
// indexVars replaces each operand name with its position in the values expand reads.