Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 326 for ABS (0.03 sec)

  1. src/math/abs.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package math
    
    // Abs returns the absolute value of x.
    //
    // Special cases are:
    //
    //	Abs(±Inf) = +Inf
    //	Abs(NaN) = NaN
    func Abs(x float64) float64 {
    	return Float64frombits(Float64bits(x) &^ (1 << 63))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 366 bytes
    - Viewed (0)
  2. src/math/cmplx/abs.go

    // complex numbers. Special case handling conforms to the C99 standard
    // Annex G IEC 60559-compatible complex arithmetic.
    package cmplx
    
    import "math"
    
    // Abs returns the absolute value (also called the modulus) of x.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 01 03:16:37 UTC 2020
    - 523 bytes
    - Viewed (0)
  3. src/math/big/int.go

    	if x.neg == y.neg {
    		// x + y == x + y
    		// (-x) + (-y) == -(x + y)
    		z.abs = z.abs.add(x.abs, y.abs)
    	} else {
    		// x + (-y) == x - y == -(y - x)
    		// (-x) + y == y - x == -(x - y)
    		if x.abs.cmp(y.abs) >= 0 {
    			z.abs = z.abs.sub(x.abs, y.abs)
    		} else {
    			neg = !neg
    			z.abs = z.abs.sub(y.abs, x.abs)
    		}
    	}
    	z.neg = len(z.abs) > 0 && neg // 0 has no sign
    	return z
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 14 17:02:38 UTC 2024
    - 33.1K bytes
    - Viewed (0)
  4. src/math/big/rat.go

    		// a squared Rat is positive and can't be reduced (no need to call norm())
    		z.a.neg = false
    		z.a.abs = z.a.abs.sqr(x.a.abs)
    		if len(x.b.abs) == 0 {
    			z.b.abs = z.b.abs.setWord(1)
    		} else {
    			z.b.abs = z.b.abs.sqr(x.b.abs)
    		}
    		return z
    	}
    	z.a.Mul(&x.a, &y.a)
    	z.b.abs = mulDenom(z.b.abs, x.b.abs, y.b.abs)
    	return z.norm()
    }
    
    // Quo sets z to the quotient x/y and returns z.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 13.5K bytes
    - Viewed (0)
  5. test/typeparam/mdempsky/13.go

    func (MyMer) String() string {
    	return "aa"
    }
    
    // Parameterized interface
    type Abs[T any] interface {
    	Abs() T
    }
    
    func G[T Abs[U], U any](t T) {
    	T.Abs(t)
    	t.Abs()
    }
    
    type MyInt int
    func (m MyInt) Abs() MyInt {
    	if m < 0 {
    		return -m
    	}
    	return m
    }
    
    type Abs2 interface {
    	Abs() MyInt
    }
    
    
    func main() {
    	mm := MyMer(3)
    	ms := struct{ Mer }{Mer: mm }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 14 17:55:47 UTC 2022
    - 1.4K bytes
    - Viewed (0)
  6. src/image/png/paeth.go

    	// For example, the sample code starts with:
    	//	p := int(a) + int(b) - int(c)
    	//	pa := abs(p - int(a))
    	// but the optimized form uses fewer arithmetic operations:
    	//	pa := int(b) - int(c)
    	//	pa = abs(pa)
    	pc := int(c)
    	pa := int(b) - pc
    	pb := int(a) - pc
    	pc = abs(pa + pb)
    	pa = abs(pa)
    	pb = abs(pb)
    	if pa <= pb && pa <= pc {
    		return a
    	} else if pb <= pc {
    		return b
    	}
    	return c
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 08 04:08:51 UTC 2014
    - 1.7K bytes
    - Viewed (0)
  7. src/cmd/internal/objabi/line.go

    func AbsFile(dir, file, rewrites string) string {
    	abs := file
    	if dir != "" && !filepath.IsAbs(file) {
    		abs = filepath.Join(dir, file)
    	}
    
    	abs, rewritten := ApplyRewrites(abs, rewrites)
    	if !rewritten && buildcfg.GOROOT != "" && hasPathPrefix(abs, buildcfg.GOROOT) {
    		abs = "$GOROOT" + abs[len(buildcfg.GOROOT):]
    	}
    
    	// Rewrite paths to match the slash convention of the target.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 23:10:31 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  8. src/go/parser/testdata/linalg.go2

    	}
    	return r
    }
    
    // NumericAbs matches numeric types with an Abs method.
    type NumericAbs[T any] interface {
    	Numeric
    
    	Abs() T
    }
    
    // AbsDifference computes the absolute value of the difference of
    // a and b, where the absolute value is determined by the Abs method.
    func AbsDifference[T NumericAbs](a, b T) T {
    	d := a - b
    	return d.Abs()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 28 15:34:22 UTC 2021
    - 2K bytes
    - Viewed (0)
  9. src/math/big/ratmarsh.go

    func (x *Rat) GobEncode() ([]byte, error) {
    	if x == nil {
    		return nil, nil
    	}
    	buf := make([]byte, 1+4+(len(x.a.abs)+len(x.b.abs))*_S) // extra bytes for version and sign bit (1), and numerator length (4)
    	i := x.b.abs.bytes(buf)
    	j := x.a.abs.bytes(buf[:i])
    	n := i - j
    	if int(uint32(n)) != n {
    		// this should never happen
    		return nil, errors.New("Rat.GobEncode: numerator too large")
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/syntax/testdata/linalg.go

    	}
    	return r
    }
    
    // NumericAbs matches numeric types with an Abs method.
    type NumericAbs[T any] interface {
    	Numeric
    
    	Abs() T
    }
    
    // AbsDifference computes the absolute value of the difference of
    // a and b, where the absolute value is determined by the Abs method.
    func AbsDifference[T NumericAbs[T]](a, b T) T {
    	d := a - b
    	return d.Abs()
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:18 UTC 2022
    - 2.1K bytes
    - Viewed (0)
Back to top