soniah / evaler

Implements a simple floating point arithmetic expression evaluator in Go (golang).
BSD 3-Clause "New" or "Revised" License
51 stars 17 forks source link

fails w/o initial zeros #6

Closed stevesmoot closed 6 years ago

stevesmoot commented 8 years ago

.5 * 2 comes out as 10 fix is var fp_rx = regexp.MustCompile(([0-9]*\.?[0-9]+))
I believe. (and add a test like): {".5 * 2", big.NewRat(1, 1), true}, // no leading zero

tried to submit, but I clearly dont know how to use github yet...so submitting as issue. -s

soniah commented 6 years ago

Thanks @stevesmoot and sorry about the years-long delay. Anyway, I've merged in some code that fixes this.