Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 161 for IsNaN (0.1 sec)

  1. src/math/cmplx/isnan.go

    // license that can be found in the LICENSE file.
    
    package cmplx
    
    import "math"
    
    // IsNaN reports whether either real(x) or imag(x) is NaN
    // and neither is an infinity.
    func IsNaN(x complex128) bool {
    	switch {
    	case math.IsInf(real(x), 0) || math.IsInf(imag(x), 0):
    		return false
    	case math.IsNaN(real(x)) || math.IsNaN(imag(x)):
    		return true
    	}
    	return false
    }
    
    // NaN returns a complex “not-a-number” value.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 05 17:52:29 UTC 2022
    - 598 bytes
    - Viewed (0)
  2. src/math/cmplx/cmath_test.go

    		}
    		if math.IsNaN(imag(v.in)) || math.IsNaN(imag(v.want)) {
    			// Negating NaN is undefined with regard to the sign bit produced.
    			continue
    		}
    		// Asin(Conj(z))  == Asin(Sinh(z))
    		if f := Asin(Conj(v.in)); !cAlike(Conj(v.want), f) && !cAlike(v.in, Conj(v.in)) {
    			t.Errorf("Asin(%g) = %g, want %g", Conj(v.in), f, Conj(v.want))
    		}
    		if math.IsNaN(real(v.in)) || math.IsNaN(real(v.want)) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 03:16:37 UTC 2020
    - 48.1K bytes
    - Viewed (0)
  3. test/cmplxdivide.go

    package main
    
    import (
    	"fmt"
    	"math"
    )
    
    func calike(a, b complex128) bool {
    	if imag(a) != imag(b) && !(math.IsNaN(imag(a)) && math.IsNaN(imag(b))) {
    		return false
    	}
    
    	if real(a) != real(b) && !(math.IsNaN(real(a)) && math.IsNaN(real(b))) {
    		return false
    	}
    
    	return true
    }
    
    func main() {
    	bad := false
    	for _, t := range tests {
    		x := t.f / t.g
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 15 22:45:17 UTC 2017
    - 868 bytes
    - Viewed (0)
  4. src/math/cmplx/sin.go

    func Sin(x complex128) complex128 {
    	switch re, im := real(x), imag(x); {
    	case im == 0 && (math.IsInf(re, 0) || math.IsNaN(re)):
    		return complex(math.NaN(), im)
    	case math.IsInf(im, 0):
    		switch {
    		case re == 0:
    			return x
    		case math.IsInf(re, 0) || math.IsNaN(re):
    			return complex(math.NaN(), im)
    		}
    	case re == 0 && math.IsNaN(im):
    		return x
    	}
    	s, c := math.Sincos(real(x))
    	sh, ch := sinhcosh(imag(x))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  5. src/runtime/float.go

    package runtime
    
    import "unsafe"
    
    var inf = float64frombits(0x7FF0000000000000)
    
    // 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.
    	return f != f
    }
    
    // isFinite reports whether f is neither NaN nor an infinity.
    func isFinite(f float64) bool {
    	return !isNaN(f - f)
    }
    
    // isInf reports whether f is an infinity.
    func isInf(f float64) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 26 02:39:39 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  6. test/typeparam/ordered.go

    type orderedSlice[Elem Ordered] []Elem
    
    func (s orderedSlice[Elem]) Len() int { return len(s) }
    func (s orderedSlice[Elem]) Less(i, j int) bool {
    	if s[i] < s[j] {
    		return true
    	}
    	isNaN := func(f Elem) bool { return f != f }
    	if isNaN(s[i]) && !isNaN(s[j]) {
    		return true
    	}
    	return false
    }
    func (s orderedSlice[Elem]) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
    
    func _OrderedSlice[Elem Ordered](s []Elem) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 01 19:45:34 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  7. src/runtime/complex.go

    		f = (imag(n)*ratio - real(n)) / denom
    	}
    
    	if isNaN(e) && isNaN(f) {
    		// Correct final result to infinities and zeros if applicable.
    		// Matches C99: ISO/IEC 9899:1999 - G.5.1  Multiplicative operators.
    
    		a, b := real(n), imag(n)
    		c, d := real(m), imag(m)
    
    		switch {
    		case m == 0 && (!isNaN(a) || !isNaN(b)):
    			e = copysign(inf, c) * a
    			f = copysign(inf, c) * b
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 15 22:45:17 UTC 2017
    - 1.6K bytes
    - Viewed (0)
  8. 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)
  9. src/math/nextafter.go

    //
    // Special cases are:
    //
    //	Nextafter32(x, x)   = x
    //	Nextafter32(NaN, y) = NaN
    //	Nextafter32(x, NaN) = NaN
    func Nextafter32(x, y float32) (r float32) {
    	switch {
    	case IsNaN(float64(x)) || IsNaN(float64(y)): // special case
    		r = float32(NaN())
    	case x == y:
    		r = x
    	case x == 0:
    		r = float32(Copysign(float64(Float32frombits(1)), float64(y)))
    	case (y > x) == (x > 0):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.2K bytes
    - Viewed (0)
  10. src/math/floor_amd64.s

    // func archFloor(x float64) float64
    TEXT ·archFloor(SB),NOSPLIT,$0
    	MOVQ	x+0(FP), AX
    	MOVQ	$~(1<<63), DX // sign bit mask
    	ANDQ	AX,DX // DX = |x|
    	SUBQ	$1,DX
    	MOVQ    $(Big - 1), CX // if |x| >= 2**52-1 or IsNaN(x) or |x| == 0, return x
    	CMPQ	DX,CX
    	JAE     isBig_floor
    	MOVQ	AX, X0 // X0 = x
    	CVTTSD2SQ	X0, AX
    	CVTSQ2SD	AX, X1 // X1 = float(int(x))
    	CMPSD	X1, X0, 1 // compare LT; X0 = 0xffffffffffffffff or 0
    	MOVSD	$(-1.0), X2
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 15 15:48:19 UTC 2021
    - 2K bytes
    - Viewed (0)
Back to top