- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 21 for IsNan (0.14 sec)
-
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) -
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) -
src/syscall/js/js_test.go
} if dummys.Get("someFloat").Equal(dummys.Get("someInt")) { t.Errorf("different values are not unequal") } } func TestNaN(t *testing.T) { if !dummys.Get("NaN").IsNaN() { t.Errorf("JS NaN is not NaN") } if !js.ValueOf(math.NaN()).IsNaN() { t.Errorf("Go NaN is not NaN") } if dummys.Get("NaN").Equal(dummys.Get("NaN")) { t.Errorf("NaN is equal to NaN") } } func TestUndefined(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 19 14:35:26 UTC 2024 - 17.7K bytes - Viewed (0) -
src/syscall/js/js.go
func Null() Value { return valueNull } // IsNull reports whether v is the JavaScript value "null". func (v Value) IsNull() bool { return v.ref == valueNull.ref } // IsNaN reports whether v is the JavaScript value "NaN". func (v Value) IsNaN() bool { return v.ref == valueNaN.ref } // Global returns the JavaScript global object, usually "window" or "global". func Global() Value { return valueGlobal }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 19 14:35:26 UTC 2024 - 19.5K bytes - Viewed (0) -
src/slices/slices_test.go
func equal[T comparable](v1, v2 T) bool { return v1 == v2 } // equalNaN is like == except that all NaNs are equal. func equalNaN[T comparable](v1, v2 T) bool { isNaN := func(f T) bool { return f != f } return v1 == v2 || (isNaN(v1) && isNaN(v2)) } // offByOne returns true if integers v1 and v2 differ by 1. func offByOne(v1, v2 int) bool { return v1 == v2+1 || v1 == v2-1 } func TestEqualFunc(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 26 13:32:06 UTC 2024 - 33.2K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/telemetry/internal/upload/reports.go
_, err := rand.Read(b) if err != nil { panic(fmt.Sprintf("rand.Read failed: %v", err)) } // and turn it into a float64 x := math.Float64frombits(binary.LittleEndian.Uint64(b)) if math.IsNaN(x) || math.IsInf(x, 0) { continue } x = math.Abs(x) if x < 0x1p-1000 { // avoid underflow patterns continue } frac, _ := math.Frexp(x) // 52 bits of randomness return frac*2 - 1 }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Jun 04 14:52:56 UTC 2024 - 10.3K bytes - Viewed (0) -
tensorflow/cc/framework/gradient_checker.cc
auto cur_error = std::fabs(jac_t(r, c) - jac_n(r, c)); // Treat any NaN as max_error and immediately return. // (Note that std::max may ignore NaN arguments.) if (std::isnan(cur_error)) { *max_error = cur_error; return absl::OkStatus(); } *max_error = std::max(*max_error, cur_error); } } } return absl::OkStatus(); }
Registered: Sun Jun 16 05:45:23 UTC 2024 - Last Modified: Sat Apr 13 05:57:22 UTC 2024 - 18.2K bytes - Viewed (0) -
src/math/big/float.go
} // NewFloat allocates and returns a new [Float] set to x, // with precision 53 and rounding mode [ToNearestEven]. // NewFloat panics with [ErrNaN] if x is a NaN. func NewFloat(x float64) *Float { if math.IsNaN(x) { panic(ErrNaN{"NewFloat(NaN)"}) } return new(Float).SetFloat64(x) } // Exponent and precision limits. const ( MaxExp = math.MaxInt32 // largest supported exponent
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jun 06 15:46:54 UTC 2024 - 44.5K bytes - Viewed (0) -
src/runtime/mgcscavenge.go
// Compute the raw output value. prop := c.kp * (setpoint - input) rawOutput := prop + c.errIntegral // Clamp rawOutput into output. output := rawOutput if isInf(output) || isNaN(output) { // The input had a large enough magnitude that either it was already // overflowed, or some operation with it overflowed. // Set a flag and reset. That's the safest thing to do. c.reset()
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 08 17:48:45 UTC 2024 - 52.3K bytes - Viewed (0) -
src/internal/trace/gc.go
c.mmu(window, &acc) // Evaluate the quantiles on the accumulated MUD. out := make([]float64, len(quantiles)) for i := range out { mu, _ := acc.mud.invCumulativeSum(float64(duration) * quantiles[i]) if math.IsNaN(mu) { // There are a few legitimate ways this can // happen: // // 1. If the window is the full trace // duration, then the windowed MU function is // only defined at a single point, so the MU
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 17 18:48:18 UTC 2024 - 26K bytes - Viewed (0)