Drop the CLI's no-data hint, keep the number underflow rule in grammar/number.go, and name the JSON a template may be

This commit is contained in:
2026-10-08 12:28:52 +02:00
committed by Lillem4n
parent 295347a455
commit 9baa77c752
4 changed files with 13 additions and 23 deletions
-8
View File
@@ -4,7 +4,6 @@ import (
"fmt"
"slices"
"strconv"
"strings"
"unicode"
)
@@ -178,10 +177,3 @@ func (p *calcParser) ident() (CalcNode, error) {
}
return CalcVar{name, at}, nil
}
// Underflows reports a number written as text that reads as f = 0 though a digit before its
// exponent is not 0, as 1e-400 does: no float64 holds the number written.
func Underflows(text string, f float64) bool {
mantissa, _, _ := strings.Cut(strings.ToLower(text), "e")
return f == 0 && strings.ContainsAny(mantissa, "123456789")
}
+10
View File
@@ -0,0 +1,10 @@
package grammar
import "strings"
// Underflows reports a number written as text that reads as f = 0 though a digit before its
// exponent is not 0, as 1e-400 does: no float64 holds the number written.
func Underflows(text string, f float64) bool {
mantissa, _, _ := strings.Cut(strings.ToLower(text), "e")
return f == 0 && strings.ContainsAny(mantissa, "123456789")
}