strconv: fix assert .f64() == 0

This commit is contained in:
Delyan Angelov 2022-01-04 17:43:45 +02:00
parent b2538e83da
commit 0f01236e52
No known key found for this signature in database
GPG key ID: 66886C0F12D595ED
2 changed files with 22 additions and 13 deletions

View file

@ -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{}