Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 68 for IsNaN (0.29 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. android/guava-tests/test/com/google/common/math/StatsTest.java

        assertThat(ONE_VALUE_STATS.populationVariance()).isWithin(0.0).of(0.0);
        assertThat(Stats.of(POSITIVE_INFINITY).populationVariance()).isNaN();
        assertThat(Stats.of(NEGATIVE_INFINITY).populationVariance()).isNaN();
        assertThat(Stats.of(NaN).populationVariance()).isNaN();
        assertThat(TWO_VALUES_STATS.populationVariance())
            .isWithin(ALLOWED_ERROR)
            .of(TWO_VALUES_SUM_OF_SQUARES_OF_DELTAS / 2);
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 28.4K bytes
    - Viewed (0)
  3. 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)
  4. android/guava-tests/test/com/google/common/math/StatsAccumulatorTest.java

            assertWithMessage("mean of " + values).that(mean).isNaN();
            assertWithMessage("mean by addAll(Stats) of " + values).that(meanByAddAllStats).isNaN();
          } else if (values.hasAnyPositiveInfinity() && values.hasAnyNegativeInfinity()) {
            assertWithMessage("mean of " + values).that(mean).isNaN();
            assertWithMessage("mean by addAll(Stats) of " + values).that(meanByAddAllStats).isNaN();
          } else if (values.hasAnyPositiveInfinity()) {
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 34K bytes
    - Viewed (0)
  5. 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)
  6. src/sort/sort.go

    //
    //	x[i] < x[j] || (math.IsNaN(x[i]) && !math.IsNaN(x[j]))
    func (x Float64Slice) Less(i, j int) bool { return x[i] < x[j] || (isNaN(x[i]) && !isNaN(x[j])) }
    func (x Float64Slice) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }
    
    // isNaN is a copy of math.IsNaN to avoid a dependency on the math package.
    func isNaN(f float64) bool {
    	return f != f
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 28 16:40:32 UTC 2023
    - 10.1K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/math/PairedStatsTest.java

        assertThat(createSingleStats(Double.POSITIVE_INFINITY, 1.23).populationCovariance()).isNaN();
        assertThat(createSingleStats(Double.NEGATIVE_INFINITY, 1.23).populationCovariance()).isNaN();
        assertThat(createSingleStats(Double.NaN, 1.23).populationCovariance()).isNaN();
        assertThat(TWO_VALUES_PAIRED_STATS.populationCovariance())
            .isWithin(ALLOWED_ERROR)
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 14K bytes
    - Viewed (0)
  8. 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)
  9. 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)
  10. android/guava-tests/test/com/google/common/math/PairedStatsAccumulatorTest.java

          if (values.hasAnyNonFinite()) {
            assertWithMessage("population covariance of " + values).that(populationCovariance).isNaN();
            assertWithMessage("population covariance by addAll(PairedStats) of " + values)
                .that(populationCovarianceByAddAllPartitionedPairedStats)
                .isNaN();
          } else {
            assertWithMessage("population covariance of " + values)
                .that(populationCovariance)
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 23.4K bytes
    - Viewed (0)
Back to top