mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 20:13:40 +00:00
compiler: add complex manipulation
* builtins: real, imag, complex * printing of complex numbers No support for complex arithmetic yet.
This commit is contained in:
@@ -174,6 +174,20 @@ func printfloat64(v float64) {
|
||||
}
|
||||
}
|
||||
|
||||
func printcomplex64(c complex64) {
|
||||
putchar('(')
|
||||
printfloat32(real(c))
|
||||
printfloat32(imag(c))
|
||||
printstring("i)")
|
||||
}
|
||||
|
||||
func printcomplex128(c complex128) {
|
||||
putchar('(')
|
||||
printfloat64(real(c))
|
||||
printfloat64(imag(c))
|
||||
printstring("i)")
|
||||
}
|
||||
|
||||
func printspace() {
|
||||
putchar(' ')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user