You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For real and imag, the argument must be of complex type, and the return type is the corresponding
floating-point type: float32 for a complex64 argument, and float64 for a complex128 argument. If the
argument evaluates to an untyped constant, it must be a number, and the return value
of the function is an untyped floating-point constant.
Both gotypes and gccgo accept the program without diagnostics.
The text was updated successfully, but these errors were encountered:
1.1 is a float64 untyped constant, not a typed or untyped complex128 or (typed only) complex64 constant, thus it is an invalid argument of the built int real function because
For real and imag, the argument must be of complex type.
On
go version devel +81a8f1a Mon May 30 05:24:16 2016 +0000 linux/amd64
the following program (https://play.golang.org/p/DbyUqeHamB), compiled with
go run real.go
exits with error message
and behaves analogously with other kinds of untyped constants, passed as an argument
to
real
orimag
.The Go Language Specification seems to allow any kind of
untyped numeric constant to be passed as an argument to
real
orimag
.https://golang.org/ref/spec#Complex_numbers
Both
gotypes
andgccgo
accept the program without diagnostics.The text was updated successfully, but these errors were encountered: