Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 38 for Log2 (0.04 sec)

  1. android/guava-tests/test/com/google/common/math/LongMathTest.java

      /* Relies on the correctness of BigIntegerMath.log2 for all modes except UNNECESSARY. */
      public void testLog2MatchesBigInteger() {
        for (long x : POSITIVE_LONG_CANDIDATES) {
          for (RoundingMode mode : ALL_SAFE_ROUNDING_MODES) {
            // The BigInteger implementation is tested separately, use it as the reference.
            assertEquals(BigIntegerMath.log2(valueOf(x), mode), LongMath.log2(x, mode));
          }
        }
      }
    
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Mar 04 20:15:57 UTC 2024
    - 32.5K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/math/LongMath.java

         *
         * The key idea is that based on the number of leading zeros (equivalently, floor(log2(x))), we
         * can narrow the possible floor(log10(x)) values to two. For example, if floor(log2(x)) is 6,
         * then 64 <= x < 128, so floor(log10(x)) is either 1 or 2.
         */
        int y = maxLog10ForLeadingZeros[Long.numberOfLeadingZeros(x)];
        /*
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  3. src/math/big/natconv_test.go

    	"testing"
    )
    
    func TestMaxBase(t *testing.T) {
    	if MaxBase != len(digits) {
    		t.Fatalf("%d != %d", MaxBase, len(digits))
    	}
    }
    
    // log2 computes the integer binary logarithm of x.
    // The result is the integer n for which 2^n <= x < 2^(n+1).
    // If x == 0, the result is -1.
    func log2(x Word) int {
    	return bits.Len(uint(x)) - 1
    }
    
    func itoa(x nat, base int) []byte {
    	// special cases
    	switch {
    	case base < 2:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 12:54:00 UTC 2019
    - 16.8K bytes
    - Viewed (0)
  4. guava/src/com/google/common/math/LongMath.java

         *
         * The key idea is that based on the number of leading zeros (equivalently, floor(log2(x))), we
         * can narrow the possible floor(log10(x)) values to two. For example, if floor(log2(x)) is 6,
         * then 64 <= x < 128, so floor(log10(x)) is either 1 or 2.
         */
        int y = maxLog10ForLeadingZeros[Long.numberOfLeadingZeros(x)];
        /*
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 44.6K bytes
    - Viewed (0)
  5. src/strconv/decimal.go

    	// Go up to 60 to be large enough for 32bit and 64bit platforms.
    	/*
    		seq 60 | sed 's/^/5^/' | bc |
    		awk 'BEGIN{ print "\t{ 0, \"\" }," }
    		{
    			log2 = log(2)/log(10)
    			printf("\t{ %d, \"%s\" },\t// * %d\n",
    				int(log2*NR+1), $0, 2**NR)
    		}'
    	*/
    	{0, ""},
    	{1, "5"},                                           // * 2
    	{1, "25"},                                          // * 4
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Jul 15 19:41:25 UTC 2017
    - 11K bytes
    - Viewed (0)
  6. src/math/big/natconv.go

    		var r nat
    		index := len(table) - 1
    		for len(q) > leafSize {
    			// find divisor close to sqrt(q) if possible, but in any case < q
    			maxLength := q.bitLen()     // ~= log2 q, or at of least largest possible q of this bit length
    			minLength := maxLength >> 1 // ~= log2 sqrt(q)
    			for index > 0 && table[index-1].nbits > minLength {
    				index-- // desired
    			}
    			if table[index].nbits >= maxLength && table[index].bbb.cmp(q) >= 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 18 17:59:44 UTC 2022
    - 14.6K bytes
    - Viewed (0)
  7. src/image/gif/writer.go

    	"image/draw"
    	"internal/byteorder"
    	"io"
    )
    
    // Graphic control extension fields.
    const (
    	gcLabel     = 0xF9
    	gcBlockSize = 0x04
    )
    
    var log2Lookup = [8]int{2, 4, 8, 16, 32, 64, 128, 256}
    
    func log2(x int) int {
    	for i, v := range log2Lookup {
    		if x <= v {
    			return i
    		}
    	}
    	return -1
    }
    
    // writer is a buffered writer.
    type writer interface {
    	Flush() error
    	io.Writer
    	io.ByteWriter
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:38:09 UTC 2024
    - 11.9K bytes
    - Viewed (0)
  8. src/cmd/compile/internal/ssa/magic.go

    // Rearranging,
    //   2^e > x * delta * c
    // x can be at most 2^n-1 and delta can be at most 1.
    // So it is sufficient to have 2^e >= 2^n*c.
    // So we'll choose e = n + s, with s = ⎡log2(c)⎤.
    //
    // An additional complication arises because m has n+1 bits in it.
    // Hardware restricts us to n bit by n bit multiplies.
    // We divide into 3 cases:
    //
    // Case 1: m is even.
    //   ⎣x / c⎦ = ⎣x * m / 2^(n+s)⎦
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Mar 26 19:58:25 UTC 2024
    - 15.8K bytes
    - Viewed (0)
  9. src/internal/trace/summary_test.go

    				// which makes regenerating this test very annoying, since it will
    				// likely break this test. Resolve this by making the order not matter.
    				{Task: 12, Category: "log2", Message: "do"},
    				{Task: 12, Category: "log", Message: "fanout region4"},
    				{Task: 12, Category: "log", Message: "fanout region0"},
    				{Task: 12, Category: "log", Message: "fanout region1"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 13.4K bytes
    - Viewed (0)
  10. src/strconv/ftoa.go

    	// at most 2^(exp-mantbits).
    	//
    	// So the number is already shortest if 10^(dp-nd) > 2^(exp-mantbits),
    	// or equivalently log2(10)*(dp-nd) > exp-mantbits.
    	// It is true if 332/100*(dp-nd) >= exp-mantbits (log2(10) > 3.32).
    	minexp := flt.bias + 1 // minimum possible exponent
    	if exp > minexp && 332*(d.dp-d.nd) >= 100*(exp-int(flt.mantbits)) {
    		// The number is already shortest.
    		return
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 14:21:28 UTC 2024
    - 13.9K bytes
    - Viewed (0)
Back to top