3 ms·
Floats are pretty hard, especially if you're accepting exponentiation: - 1.4 - -1.4 - .4 - -.4 - 1. - -1. ... plus exponents, also you don't need a decim
by camgunz 4y ago
Floats are pretty hard, especially if you're accepting exponentiation:
- 1.4
- -1.4
- .4
- -.4
- 1.
- -1.
... plus exponents, also you don't need a decimal point if there's an exponent
Won't Ruby parse a string into a float? I would just use that and check for an error unless your requirements are different.
- Rafert 4y ago`Float(str, exception: false)` returns either float or nil.