- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for equalNaN (0.08 sec)
-
src/maps/maps_test.go
if EqualFunc(mf, mf, equal[float64]) { t.Errorf("EqualFunc(%v, %v, equal) = true, want false", mf, mf) } // But it should succeed using equalNaN. if !EqualFunc(mf, mf, equalNaN[float64]) { t.Errorf("EqualFunc(%v, %v, equalNaN) = false, want true", mf, mf) } if !EqualFunc(m1, m2, equalIntStr) { t.Errorf("EqualFunc(%v, %v, equalIntStr) = false, want true", m1, m2) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Dec 05 17:05:56 UTC 2023 - 5.6K bytes - Viewed (0) -
src/slices/slices_test.go
} } } // equal is simply ==. 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.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Apr 26 13:32:06 UTC 2024 - 33.2K bytes - Viewed (0) -
test/typeparam/issue51840.go
lo uint64 z *byte } func EqualMap[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool { for k, v1 := range m1 { if v2, ok := m2[k]; !ok || v1 != v2 { return false } } return true } type Set[T comparable] map[T]struct{} func NewSet[T comparable](items ...T) Set[T] { return nil } func (s Set[T]) Equals(other Set[T]) bool { return EqualMap(s, other) } func main() {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 10 19:40:04 UTC 2022 - 635 bytes - Viewed (0)