github.com/gopherd/gonum@v0.0.4/internal/cmplx64/isinf.go (about) 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 // Copyright ©2017 The Gonum Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style 7 // license that can be found in the LICENSE file. 8 9 package cmplx64 10 11 import math "github.com/gopherd/gonum/internal/math32" 12 13 // IsInf returns true if either real(x) or imag(x) is an infinity. 14 func IsInf(x complex64) bool { 15 if math.IsInf(real(x), 0) || math.IsInf(imag(x), 0) { 16 return true 17 } 18 return false 19 } 20 21 // Inf returns a complex infinity, complex(+Inf, +Inf). 22 func Inf() complex64 { 23 inf := math.Inf(1) 24 return complex(inf, inf) 25 }