add percentages!

This commit is contained in:
NunoSempere 2024-11-10 17:13:01 +00:00
parent 27f9932db8
commit 05cbc2029d
2 changed files with 3 additions and 0 deletions

View File

@ -194,6 +194,7 @@ Done:
To (possibly) do:
- [ ] Consider adding an understanding of percentages
- [ ] With the -f command line option, the program doesn't read from stdin after finishing reading the file
- [ ] Add functions. Now easier to do with an explicit representation of the stakc
- [ ] Think about how to draw a histogram from samples

View File

@ -72,6 +72,8 @@ func ParseFloat(word string) (float64, error) {
n := len(word) - 1
f, err := strconv.ParseFloat(word[:n], 64)
switch word[n] {
case '%':
return multiplyOrPassThroughError(0.01, f, err)
case 'K':
return multiplyOrPassThroughError(1_000, f, err)
case 'M':