cue
cue copied to clipboard
strconv.FormatFloat fails with zero (0.0)
What version of CUE are you using (cue version
)?
master 00c5ddf5
Does this issue reproduce with the latest release?
Yes
What did you do?
t6: strconv.FormatFloat(0.0, 102, -1, 64)
What did you expect to see?
"0"
What did you see instead?
cannot use 0.0 (type float) as float64 in argument 0 to strconv.FormatFloat: value was rounded down
Note: this also happens with strconv.FormatFloat(0, 103, -1, 64)
(it's not about the fact that it's a floating point literal).
Related to #1670
The proposed fix also fixes decoding number values 0 or 0.0 into Go struct fields of type float64 (using cue.Value.Decode).