Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 72 for IsNan (0.04 sec)

  1. 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)
  2. src/math/cmplx/asin.go

    	case re == 0 && math.Abs(im) <= 1:
    		return complex(re, math.Atanh(im))
    	case math.IsInf(im, 0) || math.IsInf(re, 0):
    		if math.IsNaN(re) {
    			return complex(math.NaN(), math.Copysign(0, im))
    		}
    		return complex(math.Copysign(math.Pi/2, re), math.Copysign(0, im))
    	case math.IsNaN(re) || math.IsNaN(im):
    		return NaN()
    	}
    	x2 := real(x) * real(x)
    	a := 1 - x2 - imag(x)*imag(x)
    	if a == 0 {
    		return NaN()
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 03:16:37 UTC 2020
    - 5.9K bytes
    - Viewed (0)
  3. test/typeparam/mapsimp.dir/a.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
    }
    
    // Keys returns the keys of the map m.
    // The keys will be an indeterminate order.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 24 22:17:33 UTC 2021
    - 2.5K bytes
    - Viewed (0)
  4. 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)
  5. 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)
  6. src/math/mod.go

    //	Mod(x, ±Inf) = x
    //	Mod(x, NaN) = NaN
    func Mod(x, y float64) float64 {
    	if haveArchMod {
    		return archMod(x, y)
    	}
    	return mod(x, y)
    }
    
    func mod(x, y float64) float64 {
    	if y == 0 || IsInf(x, 0) || IsNaN(x) || IsNaN(y) {
    		return NaN()
    	}
    	y = Abs(y)
    
    	yfr, yexp := Frexp(y)
    	r := x
    	if x < 0 {
    		r = -x
    	}
    
    	for r >= y {
    		rfr, rexp := Frexp(r)
    		if rfr < yfr {
    			rexp = rexp - 1
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 903 bytes
    - Viewed (0)
  7. src/math/bits.go

    	} else {
    		v = uvneginf
    	}
    	return Float64frombits(v)
    }
    
    // NaN returns an IEEE 754 “not-a-number” value.
    func NaN() float64 { return Float64frombits(uvnan) }
    
    // 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.
    	// To avoid the floating-point hardware, could use:
    	//	x := Float64bits(f);
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:52:29 UTC 2022
    - 1.9K bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. test/typeparam/setsimp.dir/a.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 Set is a set of elements of some type.
    type Set[Elem comparable] struct {
    	m map[Elem]struct{}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 26 21:39:54 UTC 2021
    - 2.7K bytes
    - Viewed (0)
Back to top