Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for IsNaN (0.09 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/integrator.go

    	return x == y || x != nil && y != nil && x.Duration == y.Duration && x.Min == y.Min && x.Max == y.Max && (x.Average == y.Average || math.IsNaN(x.Average) && math.IsNaN(y.Average)) && (x.Deviation == y.Deviation || math.IsNaN(x.Deviation) && math.IsNaN(y.Deviation))
    }
    
    type integrator struct {
    	name  string
    	clock clock.PassiveClock
    	sync.Mutex
    	lastTime time.Time
    	x        float64
    	moments  Moments
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Nov 03 17:37:20 UTC 2022
    - 5K bytes
    - Viewed (0)
  8. src/runtime/minmax_test.go

    			t.Errorf("min(%v, %v) = %v, want %v", tt.max, tt.min, z, tt.min)
    		}
    	}
    	for _, x := range all {
    		if z := min(nan, x); !math.IsNaN(z) {
    			t.Errorf("min(%v, %v) = %v, want %v", nan, x, z, nan)
    		}
    		if z := min(x, nan); !math.IsNaN(z) {
    			t.Errorf("min(%v, %v) = %v, want %v", nan, x, z, nan)
    		}
    	}
    }
    
    func TestMaxFloat(t *testing.T) {
    	for _, tt := range tests {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 26 01:41:50 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  9. test/typeparam/graph.go

    func _SliceEqual[Elem comparable](s1, s2 []Elem) bool {
    	if len(s1) != len(s2) {
    		return false
    	}
    	for i, v1 := range s1 {
    		v2 := s2[i]
    		if v1 != v2 {
    			isNaN := func(f Elem) bool { return f != f }
    			if !isNaN(v1) || !isNaN(v2) {
    				return false
    			}
    		}
    	}
    	return true
    }
    
    // A Graph is a collection of nodes. A node may have an arbitrary number
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:28 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  10. src/slices/sort.go

    		} else {
    			j = h // preserves x[j] >= target
    		}
    	}
    	// i == j, x[i-1] < target, and x[j] (= x[i]) >= target  =>  answer is i.
    	return i, i < n && (x[i] == target || (isNaN(x[i]) && isNaN(target)))
    }
    
    // BinarySearchFunc works like [BinarySearch], but uses a custom comparison
    // function. The slice must be sorted in increasing order, where "increasing"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 07 23:54:41 UTC 2024
    - 5.8K bytes
    - Viewed (0)
Back to top