mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix string interpolation float type
This commit is contained in:
@ -18,12 +18,12 @@ pub fn complex(re f64, im f64) Complex {
|
||||
|
||||
// To String method
|
||||
pub fn (c Complex) str() string {
|
||||
mut out := '$c.re'
|
||||
mut out := '${c.re:f}'
|
||||
out += if c.im >= 0 {
|
||||
'+$c.im'
|
||||
'+${c.im:f}'
|
||||
}
|
||||
else {
|
||||
'$c.im'
|
||||
'${c.im:f}'
|
||||
}
|
||||
out += 'i'
|
||||
return out
|
||||
|
Reference in New Issue
Block a user