gonum.org/v1/gonum@v0.14.0/num/quat/inf.go (about)

     1  // Copyright ©2018 The Gonum 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 Go 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 quat
    10  
    11  import "math"
    12  
    13  // IsInf returns true if any of real(q), imag(q), jmag(q), or kmag(q) is an infinity.
    14  func IsInf(q Number) bool {
    15  	return math.IsInf(q.Real, 0) || math.IsInf(q.Imag, 0) || math.IsInf(q.Jmag, 0) || math.IsInf(q.Kmag, 0)
    16  }
    17  
    18  // Inf returns a quaternion infinity, quaternion(+Inf, +Inf, +Inf, +Inf).
    19  func Inf() Number {
    20  	inf := math.Inf(1)
    21  	return Number{Real: inf, Imag: inf, Jmag: inf, Kmag: inf}
    22  }