Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 217 for newRat (0.18 sec)

  1. 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)
  2. 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)
  3. src/math/big/doc.go

    	y := new(Float)  // y is a *Float of value 0
    
    Alternatively, new values can be allocated and initialized with factory
    functions of the form:
    
    	func NewT(v V) *T
    
    For instance, [NewInt](x) returns an *[Int] set to the value of the int64
    argument x, [NewRat](a, b) returns a *[Rat] set to the fraction a/b where
    a and b are int64 values, and [NewFloat](f) returns a *[Float] initialized
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 11:59:09 UTC 2023
    - 3.8K 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/math/big/float_test.go

    }
    
    func BenchmarkFloatAdd(b *testing.B) {
    	x := new(Float)
    	y := new(Float)
    	z := new(Float)
    
    	for _, prec := range []uint{10, 1e2, 1e3, 1e4, 1e5} {
    		x.SetPrec(prec).SetRat(NewRat(1, 3))
    		y.SetPrec(prec).SetRat(NewRat(1, 6))
    		z.SetPrec(prec)
    
    		b.Run(fmt.Sprintf("%v", prec), func(b *testing.B) {
    			b.ReportAllocs()
    			for i := 0; i < b.N; i++ {
    				z.Add(x, y)
    			}
    		})
    	}
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 20:22:45 UTC 2024
    - 51.9K 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. pkg/apis/certificates/validation/validation_test.go

    	goodCert1 := mustMakeCertificate(t, &x509.Certificate{
    		SerialNumber: big.NewInt(0),
    		Subject: pkix.Name{
    			CommonName: "root1",
    		},
    		IsCA:                  true,
    		BasicConstraintsValid: true,
    	})
    
    	goodCert2 := mustMakeCertificate(t, &x509.Certificate{
    		SerialNumber: big.NewInt(0),
    		Subject: pkix.Name{
    			CommonName: "root2",
    		},
    		IsCA:                  true,
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 03 18:40:49 UTC 2023
    - 61K bytes
    - Viewed (0)
  10. 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)
Back to top