Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 22 for copysignSC (0.12 sec)

  1. src/math/copysign.go

    // Copyright 2010 The Go Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package math
    
    // Copysign returns a value with the magnitude of f
    // and the sign of sign.
    func Copysign(f, sign float64) float64 {
    	const signBit = 1 << 63
    	return Float64frombits(Float64bits(f)&^signBit | Float64bits(sign)&signBit)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 14 17:42:53 UTC 2022
    - 396 bytes
    - Viewed (0)
  2. src/math/atan2.go

    		if x >= 0 && !Signbit(x) {
    			return Copysign(0, y)
    		}
    		return Copysign(Pi, y)
    	case x == 0:
    		return Copysign(Pi/2, y)
    	case IsInf(x, 0):
    		if IsInf(x, 1) {
    			switch {
    			case IsInf(y, 0):
    				return Copysign(Pi/4, y)
    			default:
    				return Copysign(0, y)
    			}
    		}
    		switch {
    		case IsInf(y, 0):
    			return Copysign(3*Pi/4, y)
    		default:
    			return Copysign(Pi, y)
    		}
    	case IsInf(y, 0):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 1.5K bytes
    - Viewed (0)
  3. test/fixedbugs/issue23522.go

    	n int32
    }
    
    func F1(f float64) *S {
    	s := f
    	pf := math.Copysign(f, 1)
    	u := math.Floor(pf)
    	return &S{
    		u: int64(math.Copysign(u, s)),
    		n: int32(math.Copysign((pf-u)*1e9, s)),
    	}
    }
    
    func F2(f float64) *S {
    	s := f
    	f = math.Copysign(f, 1)
    	u := math.Floor(f)
    	return &S{
    		u: int64(math.Copysign(u, s)),
    		n: int32(math.Copysign((f-u)*1e9, s)),
    	}
    }
    
    func main() {
    	s1 := F1(-1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 23 21:51:55 UTC 2018
    - 724 bytes
    - Viewed (0)
  4. src/math/cmplx/asin.go

    		}
    	case math.IsInf(im, 0):
    		switch {
    		case math.IsNaN(re):
    			return x
    		case math.IsInf(re, 0):
    			return complex(math.Copysign(math.Pi/4, re), im)
    		default:
    			return complex(math.Copysign(0, re), im)
    		}
    	case math.IsInf(re, 0):
    		return complex(math.Copysign(math.Pi/2, re), math.Copysign(re, im))
    	}
    	ct := complex(-imag(x), real(x)) // i * x
    	xx := x * x
    	x1 := complex(1-real(xx), -imag(xx)) // 1 - x*x
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 03:16:37 UTC 2020
    - 5.9K bytes
    - Viewed (0)
  5. src/runtime/complex.go

    		// 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
    
    		case (isInf(a) || isInf(b)) && isFinite(c) && isFinite(d):
    			a = inf2one(a)
    			b = inf2one(b)
    			e = inf * (a*c + b*d)
    			f = inf * (b*c - a*d)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 15 22:45:17 UTC 2017
    - 1.6K bytes
    - Viewed (0)
  6. src/math/cmplx/tan.go

    	switch re, im := real(x), imag(x); {
    	case math.IsInf(im, 0):
    		switch {
    		case math.IsInf(re, 0) || math.IsNaN(re):
    			return complex(math.Copysign(0, re), math.Copysign(1, im))
    		}
    		return complex(math.Copysign(0, math.Sin(2*re)), math.Copysign(1, im))
    	case re == 0 && math.IsNaN(im):
    		return x
    	}
    	d := math.Cos(2*real(x)) + math.Cosh(2*imag(x))
    	if math.Abs(d) < 0.25 {
    		d = tanSeries(x)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 03:16:37 UTC 2020
    - 8.5K bytes
    - Viewed (0)
  7. src/math/cmplx/sin.go

    func Cos(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*math.Copysign(0, re))
    	case math.IsInf(im, 0):
    		switch {
    		case re == 0:
    			return complex(math.Inf(1), -re*math.Copysign(0, im))
    		case math.IsInf(re, 0) || math.IsNaN(re):
    			return complex(math.Inf(1), math.NaN())
    		}
    	case re == 0 && math.IsNaN(im):
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  8. src/math/floor.go

    //	Round(NaN) = NaN
    func Round(x float64) float64 {
    	// Round is a faster implementation of:
    	//
    	// func Round(x float64) float64 {
    	//   t := Trunc(x)
    	//   if Abs(x-t) >= 0.5 {
    	//     return t + Copysign(1, x)
    	//   }
    	//   return t
    	// }
    	bits := Float64bits(x)
    	e := uint(bits>>shift) & mask
    	if e < bias {
    		// Round abs(x) < 1 including denormals.
    		bits &= signMask // +-0
    		if e == bias-1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  9. test/codegen/math.go

    	// riscv64:"FSGNJD"
    	// arm64:"ORR", -"AND"
    	sink64[1] = math.Copysign(c, -1)
    
    	// Like math.Copysign(c, -1), but with integer operations. Useful
    	// for platforms that have a copysign opcode to see if it's detected.
    	// s390x:"LNDFR\t",-"MOVD\t"     (no integer load/store)
    	sink64[2] = math.Float64frombits(math.Float64bits(a) | 1<<63)
    
    	// amd64:"ANDQ","ORQ"
    	// s390x:"CPSDR\t",-"MOVD\t"     (no integer load/store)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 15:24:29 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  10. src/runtime/softfloat64_test.go

    		err(t, "cmp(%g, %g) = sw %v, %v, hw %v, %v\n", f, g, scmp, sisnan, hcmp, hisnan)
    	}
    }
    
    func same(f, g float64) bool {
    	if math.IsNaN(f) && math.IsNaN(g) {
    		return true
    	}
    	if math.Copysign(1, f) != math.Copysign(1, g) {
    		return false
    	}
    	return f == g
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 4K bytes
    - Viewed (0)
Back to top