Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for isChan (0.12 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. src/slices/sort_test.go

    	for i := 0; i < len(fs); i++ {
    		testfs := Clone(fs)
    		testfs[i] = math.NaN()
    
    		fmin := Min(testfs)
    		if !math.IsNaN(fmin) {
    			t.Errorf("got min %v, want NaN", fmin)
    		}
    
    		fmax := Max(testfs)
    		if !math.IsNaN(fmax) {
    			t.Errorf("got max %v, want NaN", fmax)
    		}
    	}
    }
    
    func TestMinMaxPanics(t *testing.T) {
    	intCmp := func(a, b int) int { return a - b }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 09 19:20:55 UTC 2024
    - 9.5K bytes
    - Viewed (0)
Back to top