Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 56 for IsInf (0.25 sec)

  1. src/math/cmplx/sin.go

    // Sin returns the sine of x.
    func Sin(x complex128) complex128 {
    	switch re, im := real(x), imag(x); {
    	case im == 0 && (math.IsInf(re, 0) || math.IsNaN(re)):
    		return complex(math.NaN(), im)
    	case math.IsInf(im, 0):
    		switch {
    		case re == 0:
    			return x
    		case math.IsInf(re, 0) || math.IsNaN(re):
    			return complex(math.NaN(), im)
    		}
    	case re == 0 && math.IsNaN(im):
    		return x
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  2. src/math/atan2.go

    		}
    		return Copysign(Pi, y)
    	case x == 0:
    		return Copysign(Pi/2, y)
    	case IsInf(x, 0):
    		if IsInf(x, 1) {
    			switch {
    			case IsInf(y, 0):
    				return Copysign(Pi/4, y)
    			default:
    				return Copysign(0, y)
    			}
    		}
    		switch {
    		case IsInf(y, 0):
    			return Copysign(3*Pi/4, y)
    		default:
    			return Copysign(Pi, y)
    		}
    	case IsInf(y, 0):
    		return Copysign(Pi/2, y)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  3. src/math/bits.go

    	//	return uint32(x>>shift)&mask == mask && x != uvinf && x != uvneginf
    	return f != f
    }
    
    // IsInf reports whether f is an infinity, according to sign.
    // If sign > 0, IsInf reports whether f is positive infinity.
    // If sign < 0, IsInf reports whether f is negative infinity.
    // If sign == 0, IsInf reports whether f is either infinity.
    func IsInf(f float64, sign int) bool {
    	// Test for infinity by comparing against maximum float.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:52:29 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  4. src/math/logb.go

    //
    // Special cases are:
    //
    //	Logb(±Inf) = +Inf
    //	Logb(0) = -Inf
    //	Logb(NaN) = NaN
    func Logb(x float64) float64 {
    	// special cases
    	switch {
    	case x == 0:
    		return Inf(-1)
    	case IsInf(x, 0):
    		return Inf(1)
    	case IsNaN(x):
    		return x
    	}
    	return float64(ilogb(x))
    }
    
    // Ilogb returns the binary exponent of x as an integer.
    //
    // Special cases are:
    //
    //	Ilogb(±Inf) = MaxInt32
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 07 19:46:45 UTC 2022
    - 1021 bytes
    - Viewed (0)
  5. src/math/dim.go

    // with NaN and +Inf.
    func Max(x, y float64) float64 {
    	if haveArchMax {
    		return archMax(x, y)
    	}
    	return max(x, y)
    }
    
    func max(x, y float64) float64 {
    	// special cases
    	switch {
    	case IsInf(x, 1) || IsInf(y, 1):
    		return Inf(1)
    	case IsNaN(x) || IsNaN(y):
    		return NaN()
    	case x == 0 && x == y:
    		if Signbit(x) {
    			return y
    		}
    		return x
    	}
    	if x > y {
    		return x
    	}
    	return y
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jun 15 19:45:12 UTC 2023
    - 1.9K bytes
    - Viewed (0)
  6. src/math/cmplx/isnan.go

    package cmplx
    
    import "math"
    
    // IsNaN reports whether either real(x) or imag(x) is NaN
    // and neither is an infinity.
    func IsNaN(x complex128) bool {
    	switch {
    	case math.IsInf(real(x), 0) || math.IsInf(imag(x), 0):
    		return false
    	case math.IsNaN(real(x)) || math.IsNaN(imag(x)):
    		return true
    	}
    	return false
    }
    
    // NaN returns a complex “not-a-number” value.
    func NaN() complex128 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:52:29 UTC 2022
    - 598 bytes
    - Viewed (0)
  7. src/math/hypot.go

    func Hypot(p, q float64) float64 {
    	if haveArchHypot {
    		return archHypot(p, q)
    	}
    	return hypot(p, q)
    }
    
    func hypot(p, q float64) float64 {
    	p, q = Abs(p), Abs(q)
    	// special cases
    	switch {
    	case IsInf(p, 1) || IsInf(q, 1):
    		return Inf(1)
    	case IsNaN(p) || IsNaN(q):
    		return NaN()
    	}
    	if p < q {
    		p, q = q, p
    	}
    	if p == 0 {
    		return 0
    	}
    	q = q / p
    	return p * Sqrt(1+q*q)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 850 bytes
    - Viewed (0)
  8. src/math/pow.go

    			}
    			return Inf(1)
    		case y > 0:
    			if Signbit(x) && isOddInt(y) {
    				return x
    			}
    			return 0
    		}
    	case IsInf(y, 0):
    		switch {
    		case x == -1:
    			return 1
    		case (Abs(x) < 1) == IsInf(y, 1):
    			return 0
    		default:
    			return Inf(1)
    		}
    	case IsInf(x, 0):
    		if IsInf(x, -1) {
    			return Pow(1/x, -y) // Pow(-0, -y)
    		}
    		switch {
    		case y < 0:
    			return 0
    		case y > 0:
    			return Inf(1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 24 19:10:58 UTC 2023
    - 3.6K bytes
    - Viewed (0)
  9. src/runtime/float.go

    	return f != f
    }
    
    // isFinite reports whether f is neither NaN nor an infinity.
    func isFinite(f float64) bool {
    	return !isNaN(f - f)
    }
    
    // isInf reports whether f is an infinity.
    func isInf(f float64) bool {
    	return !isNaN(f) && !isFinite(f)
    }
    
    // abs returns the absolute value of x.
    //
    // Special cases are:
    //
    //	abs(±Inf) = +Inf
    //	abs(NaN) = NaN
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 26 02:39:39 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  10. src/math/remainder.go

    	const (
    		Tiny    = 4.45014771701440276618e-308 // 0x0020000000000000
    		HalfMax = MaxFloat64 / 2
    	)
    	// special cases
    	switch {
    	case IsNaN(x) || IsNaN(y) || IsInf(x, 0) || y == 0:
    		return NaN()
    	case IsInf(y, 0):
    		return x
    	}
    	sign := false
    	if x < 0 {
    		x = -x
    		sign = true
    	}
    	if y < 0 {
    		y = -y
    	}
    	if x == y {
    		if sign {
    			zero := 0.0
    			return -zero
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 2K bytes
    - Viewed (0)
Back to top