Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for expNN (0.04 sec)

  1. src/math/big/ratconv.go

    				// -1 << 63, which is still negative.
    				return nil, false
    			}
    		}
    		if n > 1e6 {
    			return nil, false // avoid excessively large exponents
    		}
    		pow5 := z.b.abs.expNN(natFive, nat(nil).setWord(Word(n)), nil, false) // use underlying array of z.b.abs
    		if exp5 > 0 {
    			z.a.abs = z.a.abs.mul(z.a.abs, pow5)
    			z.b.abs = z.b.abs.setWord(1)
    		} else {
    			z.b.abs = pow5
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 22:16:34 UTC 2023
    - 12.3K bytes
    - Viewed (0)
  2. src/math/big/nat.go

    		}
    		z[len(limit)-1] &= mask
    		if z.cmp(limit) < 0 {
    			break
    		}
    	}
    
    	return z.norm()
    }
    
    // If m != 0 (i.e., len(m) != 0), expNN sets z to x**y mod m;
    // otherwise it sets z to x**y. The result is the value of z.
    func (z nat) expNN(x, y, m nat, slow bool) nat {
    	if alias(z, x) || alias(z, y) {
    		// We cannot allow in-place modification of x or y.
    		z = nil
    	}
    
    	// x**y mod 1 == 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 31.7K bytes
    - Viewed (0)
  3. src/math/big/prime.go

    	nm3Len := nm3.bitLen()
    
    NextRandom:
    	for i := 0; i < reps; i++ {
    		if i == reps-1 && force2 {
    			x = x.set(natTwo)
    		} else {
    			x = x.random(rand, nm3, nm3Len)
    			x = x.add(x, natTwo)
    		}
    		y = y.expNN(x, q, n, false)
    		if y.cmp(natOne) == 0 || y.cmp(nm1) == 0 {
    			continue
    		}
    		for j := uint(1); j < k; j++ {
    			y = y.sqr(y)
    			quotient, y = quotient.div(y, y, n)
    			if y.cmp(nm1) == 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 02 14:43:52 UTC 2022
    - 10.4K bytes
    - Viewed (0)
  4. src/math/big/natconv.go

    }
    
    var cacheBase10 struct {
    	sync.Mutex
    	table [64]divisor // cached divisors for base 10
    }
    
    // expWW computes x**y
    func (z nat) expWW(x, y Word) nat {
    	return z.expNN(nat(nil).setWord(x), nat(nil).setWord(y), nil, false)
    }
    
    // construct table of powers of bb*leafSize to use in subdivisions.
    func divisors(m int, b Word, ndigits int, bb Word) []divisor {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 14.6K bytes
    - Viewed (0)
  5. src/math/big/nat_test.go

    		x := natFromString(test.x)
    		y := natFromString(test.y)
    		out := natFromString(test.out)
    
    		var m nat
    		if len(test.m) > 0 {
    			m = natFromString(test.m)
    		}
    
    		z := nat(nil).expNN(x, y, m, false)
    		if z.cmp(out) != 0 {
    			t.Errorf("#%d got %s want %s", i, z.utoa(10), out.utoa(10))
    		}
    	}
    }
    
    func FuzzExpMont(f *testing.F) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 09 15:29:36 UTC 2024
    - 26.2K bytes
    - Viewed (0)
  6. src/math/big/arith_test.go

    	}
    
    	for _, a := range argshrVU {
    		arg := a
    		testShiftFunc(t, shrVU, arg)
    	}
    }
    
    func TestIssue31084(t *testing.T) {
    	// compute 10^n via 5^n << n.
    	const n = 165
    	p := nat(nil).expNN(nat{5}, nat{n}, nil, false)
    	p = p.shl(p, n)
    	got := string(p.utoa(10))
    	want := "1" + strings.Repeat("0", n)
    	if got != want {
    		t.Errorf("shl(%v, %v)\n\tgot  %s\n\twant %s", p, n, got, want)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 02 14:43:52 UTC 2022
    - 19.9K bytes
    - Viewed (0)
  7. src/math/big/int.go

    	}
    	yWords := y.abs
    
    	var mWords nat
    	if m != nil {
    		if z == m || alias(z.abs, m.abs) {
    			m = new(Int).Set(m)
    		}
    		mWords = m.abs // m.abs may be nil for m == 0
    	}
    
    	z.abs = z.abs.expNN(xWords, yWords, mWords, slow)
    	z.neg = len(z.abs) > 0 && x.neg && len(yWords) > 0 && yWords[0]&1 == 1 // 0 has no sign
    	if z.neg && len(mWords) > 0 {
    		// make modulus result positive
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 14 17:02:38 UTC 2024
    - 33.1K bytes
    - Viewed (0)
Back to top