File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,8 +90,6 @@ const essential_list = [
9090 'vlib/v/fmt/fmt_test.v' ,
9191 'vlib/v/gen/c/coutput_test.v' ,
9292 'vlib/v/gen/js/program_test.v' ,
93- 'vlib/v/gen/native/macho_test.v' ,
94- 'vlib/v/gen/native/tests/native_test.v' ,
9593 'vlib/v/pkgconfig/pkgconfig_test.v' ,
9694 'vlib/v/slow_tests/inout/compiler_test.v' ,
9795 'vlib/x/json2/tests/json2_test.v' ,
Original file line number Diff line number Diff line change @@ -33,8 +33,13 @@ pub fn (x f64) str() string {
3333// strg return a `f64` as `string` in "g" printf format.
3434@[inline]
3535pub fn (x f64) strg () string {
36- if x == 0 {
37- return '0.0'
36+ unsafe {
37+ f := strconv.Float64 u{
38+ f: x
39+ }
40+ if f.u == strconv.double_minus_zero || f.u == strconv.double_plus_zero {
41+ return '0.0'
42+ }
3843 }
3944 abs_x := f64_abs (x)
4045 if abs_x > = 0.0001 && abs_x < 1.0e6 {
@@ -99,8 +104,13 @@ pub fn (x f32) str() string {
99104// strg return a `f32` as `string` in "g" printf format
100105@[inline]
101106pub fn (x f32) strg () string {
102- if x == 0 {
103- return '0.0'
107+ unsafe {
108+ f := strconv.Float32 u{
109+ f: x
110+ }
111+ if f.u == strconv.single_minus_zero || f.u == strconv.single_plus_zero {
112+ return '0.0'
113+ }
104114 }
105115 abs_x := f32_abs (x)
106116 if abs_x > = 0.0001 && abs_x < 1.0e6 {
Original file line number Diff line number Diff line change 11// vtest retry: 3
22// vtest build: present_node?
33import rand
4- import strings
54
65const strings = unique_strings (200 , 10 )
76
Original file line number Diff line number Diff line change 11import rand
2- import strings
32
43const strings = unique_strings (7000 , 10 )
54
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ fn (mut c Checker) string_inter_lit(mut node ast.StringInterLiteral) ast.Type {
168168 node.fmt_poss[i])
169169 }
170170 node.need_fmts[i] = fmt != c.get_default_fmt (ftyp, typ)
171+ || (typ.is_float () && fmt in [`g` , `G` ])
171172 }
172173 // check recursive str
173174 if c.table.cur_fn != unsafe { nil } && c.table.cur_fn.is_method
You can’t perform that action at this time.
0 commit comments