Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 57 for IsNaN (0.03 sec)

  1. src/math/cmplx/isnan.go

    // license that can be found in the LICENSE file.
    
    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.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:52:29 UTC 2022
    - 598 bytes
    - Viewed (0)
  2. src/math/cmplx/sin.go

    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
    	}
    	s, c := math.Sincos(real(x))
    	sh, ch := sinhcosh(imag(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)
  3. src/runtime/float.go

    package runtime
    
    import "unsafe"
    
    var inf = float64frombits(0x7FF0000000000000)
    
    // isNaN reports whether f is an IEEE 754 “not-a-number” value.
    func isNaN(f float64) (is bool) {
    	// IEEE 754 says that only NaNs satisfy f != f.
    	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 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 26 02:39:39 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  4. test/typeparam/ordered.go

    type orderedSlice[Elem Ordered] []Elem
    
    func (s orderedSlice[Elem]) Len() int { return len(s) }
    func (s orderedSlice[Elem]) Less(i, j int) bool {
    	if s[i] < s[j] {
    		return true
    	}
    	isNaN := func(f Elem) bool { return f != f }
    	if isNaN(s[i]) && !isNaN(s[j]) {
    		return true
    	}
    	return false
    }
    func (s orderedSlice[Elem]) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
    
    func _OrderedSlice[Elem Ordered](s []Elem) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  5. src/cmp/cmp.go

    func Less[T Ordered](x, y T) bool {
    	return (isNaN(x) && !isNaN(y)) || x < y
    }
    
    // Compare returns
    //
    //	-1 if x is less than y,
    //	 0 if x equals y,
    //	+1 if x is greater than y.
    //
    // For floating-point types, a NaN is considered less than any non-NaN,
    // a NaN is considered equal to a NaN, and -0.0 is equal to 0.0.
    func Compare[T Ordered](x, y T) int {
    	xNaN := isNaN(x)
    	yNaN := isNaN(y)
    	if xNaN {
    		if yNaN {
    			return 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 19 16:31:02 UTC 2024
    - 2K bytes
    - Viewed (0)
  6. src/math/nextafter.go

    //
    // Special cases are:
    //
    //	Nextafter32(x, x)   = x
    //	Nextafter32(NaN, y) = NaN
    //	Nextafter32(x, NaN) = NaN
    func Nextafter32(x, y float32) (r float32) {
    	switch {
    	case IsNaN(float64(x)) || IsNaN(float64(y)): // special case
    		r = float32(NaN())
    	case x == y:
    		r = x
    	case x == 0:
    		r = float32(Copysign(float64(Float32frombits(1)), float64(y)))
    	case (y > x) == (x > 0):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  7. src/math/dim.go

    	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
    }
    
    // Min returns the smaller of x or 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)
  8. src/math/hypot.go

    		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)
  9. src/math/logb.go

    	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
    //	Ilogb(0) = MinInt32
    //	Ilogb(NaN) = MaxInt32
    func Ilogb(x float64) int {
    	// special cases
    	switch {
    	case x == 0:
    		return MinInt32
    	case IsNaN(x):
    		return MaxInt32
    	case IsInf(x, 0):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Nov 07 19:46:45 UTC 2022
    - 1021 bytes
    - Viewed (0)
  10. src/math/remainder.go

    	return remainder(x, y)
    }
    
    func remainder(x, y float64) float64 {
    	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 {
    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