mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
parent
13fdc724a7
commit
fca336c895
4 changed files with 15 additions and 8 deletions
|
@ -34,8 +34,6 @@ pub fn format_str_sb(s string, p BF_param, mut sb strings.Builder) {
|
|||
}
|
||||
}
|
||||
|
||||
const max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger
|
||||
|
||||
// digit pairs in reverse order
|
||||
const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999'
|
||||
|
||||
|
@ -328,8 +326,8 @@ pub fn format_fl(f f64, p BF_param) string {
|
|||
tmp.free()
|
||||
}
|
||||
|
||||
mut buf := [max_size_f64_char]u8{} // write temp float buffer in stack
|
||||
mut out := [max_size_f64_char]u8{} // out buffer
|
||||
mut buf := []u8{len: p.len0 + 32} // write temp float buffer
|
||||
mut out := []u8{len: p.len0 + 32} // out buffer
|
||||
mut buf_i := 0 // index temporary string
|
||||
mut out_i := 0 // index output string
|
||||
|
||||
|
@ -399,8 +397,8 @@ pub fn format_es(f f64, p BF_param) string {
|
|||
tmp.free()
|
||||
}
|
||||
|
||||
mut buf := [max_size_f64_char]u8{} // write temp float buffer in stack
|
||||
mut out := [max_size_f64_char]u8{} // out buffer
|
||||
mut buf := []u8{len: p.len0 + 32} // write temp float buffer
|
||||
mut out := []u8{len: p.len0 + 32} // out buffer
|
||||
mut buf_i := 0 // index temporary string
|
||||
mut out_i := 0 // index output string
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ pub fn format_str_sb(s string, p BF_param, mut sb strings.Builder) {
|
|||
}
|
||||
}
|
||||
|
||||
const max_size_f64_char = 32 // the f64 max representation is -36,028,797,018,963,968e1023, 21 chars, 32 is faster for the memory manger
|
||||
|
||||
// digit pairs in reverse order
|
||||
const digit_pairs = '00102030405060708090011121314151617181910212223242526272829203132333435363738393041424344454647484940515253545556575859506162636465666768696071727374757677787970818283848586878889809192939495969798999'
|
||||
|
||||
|
|
4
vlib/v/slow_tests/inout/printing_interpolating_float.out
Normal file
4
vlib/v/slow_tests/inout/printing_interpolating_float.out
Normal file
|
@ -0,0 +1,4 @@
|
|||
0.10
|
||||
0.10
|
||||
0.10
|
||||
0.100
|
7
vlib/v/slow_tests/inout/printing_interpolating_float.vv
Normal file
7
vlib/v/slow_tests/inout/printing_interpolating_float.vv
Normal file
|
@ -0,0 +1,7 @@
|
|||
fn main() {
|
||||
n := 0.1
|
||||
println('${n:36.2f}')
|
||||
println('${n:37.2f}')
|
||||
println('${n:38.2f}')
|
||||
println('${n:70.3f}')
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue