Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 78 for Log2 (0.04 sec)

  1. guava/src/com/google/common/math/DoubleMath.java

       * </ul>
       *
       * <p>The computed result is within 1 ulp of the exact result.
       *
       * <p>If the result of this method will be immediately rounded to an {@code int}, {@link
       * #log2(double, RoundingMode)} is faster.
       */
      public static double log2(double x) {
        return log(x) / LN_2; // surprisingly within 1 ulp according to tests
      }
    
      /**
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 18.9K bytes
    - Viewed (0)
  2. guava/src/com/google/common/math/IntMath.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[Integer.numberOfLeadingZeros(x)];
        /*
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  3. src/internal/trace/testdata/testprog/annotations-stress.go

    	trace.Stop()
    	t2.End()
    	t0.End()
    }
    
    func do(ctx context.Context, k int) {
    	trace.Log(ctx, "log", "before do")
    
    	var t *trace.Task
    	ctx, t = trace.NewTask(ctx, "do")
    	defer t.End()
    
    	trace.Log(ctx, "log2", "do")
    
    	// Create a region and spawn more tasks and more workers.
    	trace.WithRegion(ctx, "fanout", func() {
    		for i := 0; i < k; i++ {
    			go func(i int) {
    				trace.WithRegion(ctx, fmt.Sprintf("region%d", i), func() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 18:48:18 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/math/IntMath.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[Integer.numberOfLeadingZeros(x)];
        /*
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 23.5K bytes
    - Viewed (0)
  5. tensorflow/compiler/mlir/quantization/stablehlo/cc/calibration/calibration_parameters.h

    inline float CalculateBinWidth(const float min_value, const float max_value,
                                   const int32_t num_bins) {
      const float raw_bin_width = (max_value - min_value) / num_bins;
      return std::pow(2, std::ceil(std::log2(raw_bin_width)));
    }
    
    // Calculates the lower bound of the histogram. The lower bound is in form of
    // `N * bin_width`.
    inline float CalculateLowerBound(const float min_value, const float bin_width) {
    Registered: Sun Jun 16 05:45:23 UTC 2024
    - Last Modified: Thu Apr 25 01:09:50 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  6. 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)
  7. 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)
  8. 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)
  9. android/guava-tests/benchmark/com/google/common/math/DoubleMathRoundingBenchmark.java

        }
        return tmp;
      }
    
      @Benchmark
      int log2Round(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += DoubleMath.log2(positiveDoubles[j], mode);
        }
        return tmp;
      }
    Registered: Wed Jun 12 16:38:11 UTC 2024
    - Last Modified: Mon Dec 04 17:37:03 UTC 2017
    - 2.6K bytes
    - Viewed (0)
  10. 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)
Back to top