]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgo/go/cmath/isinf.go
Add Go frontend, libgo library, and Go testsuite.
[thirdparty/gcc.git] / libgo / go / cmath / isinf.go
1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package cmath
6
7 import "math"
8
9 // IsInf returns true if either real(x) or imag(x) is an infinity.
10 func IsInf(x complex128) bool {
11 if math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) {
12 return true
13 }
14 return false
15 }
16
17 // Inf returns a complex infinity, cmplx(+Inf, +Inf).
18 func Inf() complex128 {
19 inf := math.Inf(1)
20 return cmplx(inf, inf)
21 }