mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
strconv: fix assert .f64() == 0
This commit is contained in:
parent
b2538e83da
commit
0f01236e52
2 changed files with 22 additions and 13 deletions
|
@ -78,9 +78,7 @@ fn sub96(s2 u32, s1 u32, s0 u32, d2 u32, d1 u32, d0 u32) (u32, u32, u32) {
|
|||
return r2, r1, r0
|
||||
}
|
||||
|
||||
/*
|
||||
Constants
|
||||
*/
|
||||
// Constants
|
||||
|
||||
pub const (
|
||||
//
|
||||
|
@ -118,9 +116,7 @@ pub const (
|
|||
c_ten = u32(10)
|
||||
)
|
||||
|
||||
/*
|
||||
Utility
|
||||
*/
|
||||
// Utility functions
|
||||
|
||||
// NOTE: Modify these if working with non-ASCII encoding
|
||||
fn is_digit(x byte) bool {
|
||||
|
@ -135,10 +131,6 @@ fn is_exp(x byte) bool {
|
|||
return (x == `E` || x == `e`) == true
|
||||
}
|
||||
|
||||
/*
|
||||
Support struct
|
||||
*/
|
||||
|
||||
/*
|
||||
String parser
|
||||
NOTE: #TOFIX need one char after the last char of the number
|
||||
|
@ -408,12 +400,13 @@ fn converter(mut pn PrepNumber) u64 {
|
|||
return result
|
||||
}
|
||||
|
||||
/*
|
||||
Public functions
|
||||
*/
|
||||
// Public functions
|
||||
|
||||
// atof64 return a f64 from a string doing a parsing operation
|
||||
pub fn atof64(s string) f64 {
|
||||
if s.len == 0 {
|
||||
return 0
|
||||
}
|
||||
mut pn := PrepNumber{}
|
||||
mut res_parsing := 0
|
||||
mut res := Float64u{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue