v / vlib / strconv / atof.js.v
12 lines · 10 sloc · 411 bytes · f6844e97661d55094833fd8a0e44589aeca62ebf
Raw
1module strconv
2
3// atof64 return a f64 from a string doing a parsing operation
4pub fn atof64(s string) !f64 {
5 // TODO: handle parsing invalid numbers as close as possible to the pure V version
6 // that may be slower, but more portable, and will guarantee that higher level code
7 // works the same in the JS version, as well as in the C and Native versions.
8 res := 0.0
9 #res.val = Number(s.str)
10
11 return res
12}
13