Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 143 for newRat (0.13 sec)

  1. src/math/big/rat_test.go

    func TestIssue820(t *testing.T) {
    	x := NewRat(3, 1)
    	y := NewRat(2, 1)
    	z := y.Quo(x, y)
    	q := NewRat(3, 2)
    	if z.Cmp(q) != 0 {
    		t.Errorf("got %s want %s", z, q)
    	}
    
    	y = NewRat(3, 1)
    	x = NewRat(2, 1)
    	z = y.Quo(x, y)
    	q = NewRat(2, 3)
    	if z.Cmp(q) != 0 {
    		t.Errorf("got %s want %s", z, q)
    	}
    
    	x = NewRat(3, 1)
    	z = x.Quo(x, x)
    	q = NewRat(3, 3)
    	if z.Cmp(q) != 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 07 00:15:59 UTC 2022
    - 18.9K bytes
    - Viewed (0)
  2. src/go/constant/value.go

    			if !is63bit(a) || !is63bit(b) {
    				return makeInt(newInt().Add(big.NewInt(a), big.NewInt(b)))
    			}
    			c = a + b
    		case token.SUB:
    			if !is63bit(a) || !is63bit(b) {
    				return makeInt(newInt().Sub(big.NewInt(a), big.NewInt(b)))
    			}
    			c = a - b
    		case token.MUL:
    			if !is32bit(a) || !is32bit(b) {
    				return makeInt(newInt().Mul(big.NewInt(a), big.NewInt(b)))
    			}
    			c = a * b
    		case token.QUO:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 34K bytes
    - Viewed (0)
  3. src/crypto/internal/mlkem768/mlkem768_test.go

    }
    
    func TestZetas(t *testing.T) {
    	ζ := big.NewInt(17)
    	q := big.NewInt(q)
    	for k, zeta := range zetas {
    		// ζ^BitRev7(k) mod q
    		exp := new(big.Int).Exp(ζ, big.NewInt(int64(BitRev7(uint8(k)))), q)
    		if big.NewInt(int64(zeta)).Cmp(exp) != 0 {
    			t.Errorf("zetas[%d] = %v, expected %v", k, zeta, exp)
    		}
    	}
    }
    
    func TestGammas(t *testing.T) {
    	ζ := big.NewInt(17)
    	q := big.NewInt(q)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 06 15:27:18 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  4. src/math/big/rat.go

    	// is made), such uninitialized denominators are set to 1.
    	// a.neg determines the sign of the Rat, b.neg is ignored.
    	a, b Int
    }
    
    // NewRat creates a new [Rat] with numerator a and denominator b.
    func NewRat(a, b int64) *Rat {
    	return new(Rat).SetFrac64(a, b)
    }
    
    // SetFloat64 sets z to exactly f and returns z.
    // If f is not finite, SetFloat returns nil.
    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. src/go/constant/value_test.go

    		{Bool, false, false},
    		{String, "hello", "hello"},
    
    		{Int, int64(1), int64(1)},
    		{Int, big.NewInt(10), int64(10)},
    		{Int, new(big.Int).Lsh(big.NewInt(1), 62), int64(1 << 62)},
    		dup(Int, new(big.Int).Lsh(big.NewInt(1), 63)),
    
    		{Float, big.NewFloat(0), floatVal0.val},
    		dup(Float, big.NewFloat(2.0)),
    		dup(Float, big.NewRat(1, 3)),
    	} {
    		val := Make(test.arg)
    		got := Val(val)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 15.6K bytes
    - Viewed (0)
  6. src/crypto/rsa/rsa.go

    		Qinv, err := bigmod.NewNat().SetBytes(priv.Precomputed.Qinv.Bytes(), P)
    		if err != nil {
    			return nil, ErrDecryption
    		}
    		c, err = bigmod.NewNat().SetBytes(ciphertext, N)
    		if err != nil {
    			return nil, ErrDecryption
    		}
    
    		// m = c ^ Dp mod p
    		m = bigmod.NewNat().Exp(t0.Mod(c, P), priv.Precomputed.Dp.Bytes(), P)
    		// m2 = c ^ Dq mod q
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 23.4K bytes
    - Viewed (0)
  7. src/crypto/ecdsa/ecdsa.go

    	}
    
    	// SEC 1, Version 2.0, Section 4.1.4
    
    	r, err := bigmod.NewNat().SetBytes(rBytes, c.N)
    	if err != nil || r.IsZero() == 1 {
    		return false
    	}
    	s, err := bigmod.NewNat().SetBytes(sBytes, c.N)
    	if err != nil || s.IsZero() == 1 {
    		return false
    	}
    
    	e := bigmod.NewNat()
    	hashToNat(c, e, hash)
    
    	// w = s⁻¹
    	w := bigmod.NewNat()
    	inverse(c, w, s)
    
    	// p₁ = [e * s⁻¹]G
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  8. src/crypto/internal/bigmod/nat.go

    	// are likely to be more efficient if necessary.
    
    	table := [(1 << 4) - 1]*Nat{ // table[i] = x ^ (i+1)
    		// newNat calls are unrolled so they are allocated on the stack.
    		NewNat(), NewNat(), NewNat(), NewNat(), NewNat(),
    		NewNat(), NewNat(), NewNat(), NewNat(), NewNat(),
    		NewNat(), NewNat(), NewNat(), NewNat(), NewNat(),
    	}
    	table[0].set(x).montgomeryRepresentation(m)
    	for i := 1; i < len(table); i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 24K bytes
    - Viewed (0)
  9. src/crypto/internal/bigmod/nat_test.go

    	N, _ := NewModulusFromBig(n)
    	A := NewNat().setBig(a).ExpandFor(N)
    	B := NewNat().setBig(b).ExpandFor(N)
    
    	if A.Mul(B, N).IsZero() != 1 {
    		t.Error("a * b mod (a * b) != 0")
    	}
    
    	i := new(big.Int).ModInverse(a, b)
    	N, _ = NewModulusFromBig(b)
    	A = NewNat().setBig(a).ExpandFor(N)
    	I := NewNat().setBig(i).ExpandFor(N)
    	one := NewNat().setBig(big.NewInt(1)).ExpandFor(N)
    
    	if A.Mul(I, N).Equal(one) != 1 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Jan 12 00:56:20 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  10. src/runtime/slice.go

    		// gives a smooth-ish transition between the two.
    		newcap += (newcap + 3*threshold) >> 2
    
    		// We need to check `newcap >= newLen` and whether `newcap` overflowed.
    		// newLen is guaranteed to be larger than zero, hence
    		// when newcap overflows then `uint(newcap) > uint(newLen)`.
    		// This allows to check for both with the same comparison.
    		if uint(newcap) >= uint(newLen) {
    			break
    		}
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 12.2K bytes
    - Viewed (0)
Back to top