add percentages!
This commit is contained in:
parent
27f9932db8
commit
05cbc2029d
|
@ -194,6 +194,7 @@ Done:
|
||||||
|
|
||||||
To (possibly) do:
|
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
|
- [ ] 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
|
- [ ] Add functions. Now easier to do with an explicit representation of the stakc
|
||||||
- [ ] Think about how to draw a histogram from samples
|
- [ ] Think about how to draw a histogram from samples
|
||||||
|
|
|
@ -72,6 +72,8 @@ func ParseFloat(word string) (float64, error) {
|
||||||
n := len(word) - 1
|
n := len(word) - 1
|
||||||
f, err := strconv.ParseFloat(word[:n], 64)
|
f, err := strconv.ParseFloat(word[:n], 64)
|
||||||
switch word[n] {
|
switch word[n] {
|
||||||
|
case '%':
|
||||||
|
return multiplyOrPassThroughError(0.01, f, err)
|
||||||
case 'K':
|
case 'K':
|
||||||
return multiplyOrPassThroughError(1_000, f, err)
|
return multiplyOrPassThroughError(1_000, f, err)
|
||||||
case 'M':
|
case 'M':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user