mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
atof: lots of fixes
* removed sprintf for f64 and f32 use * removed all pointers from the code, used unions instead * solved module name problem * fixed tests on vlib/math * fix for alpine-linux math test * small fix on byte allocation for ftoa
This commit is contained in:
@@ -58,7 +58,7 @@ fn bool_to_u64(b bool) u64 {
|
||||
|
||||
fn get_string_special(neg bool, expZero bool, mantZero bool) string {
|
||||
if !mantZero {
|
||||
return "NaN"
|
||||
return "nan"
|
||||
}
|
||||
if !expZero {
|
||||
if neg {
|
||||
@@ -230,7 +230,7 @@ pub fn f32_to_str_l(f f64) string {
|
||||
|
||||
// f64_to_str_l return a string with the f64 converted in a strign in decimal notation
|
||||
pub fn f64_to_str_l(f f64) string {
|
||||
s := ftoa.f64_to_str(f,18)
|
||||
s := f64_to_str(f,18)
|
||||
|
||||
// check for +inf -inf Nan
|
||||
if s.len > 2 && (s[0] == `N` || s[1] == `i`) {
|
||||
@@ -239,7 +239,7 @@ pub fn f64_to_str_l(f f64) string {
|
||||
|
||||
m_sgn_flag := false
|
||||
mut sgn := 1
|
||||
mut b := [32]byte
|
||||
mut b := [18+8]byte
|
||||
mut d_pos := 1
|
||||
mut i := 0
|
||||
mut i1 := 0
|
||||
|
||||
Reference in New Issue
Block a user