Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for sqrtFloor (0.27 sec)

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

                    && sqrtFloor.pow(2).equals(x); // slow exact check
            return sqrtFloorIsExact ? sqrtFloor : sqrtFloor.add(BigInteger.ONE);
          case HALF_DOWN:
          case HALF_UP:
          case HALF_EVEN:
            BigInteger halfSquare = sqrtFloor.pow(2).add(sqrtFloor);
            /*
             * We wish to test whether or not x <= (sqrtFloor + 0.5)^2 = halfSquare + 0.25. Since both x
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 17:21:56 UTC 2024
    - 18.8K bytes
    - Viewed (0)
  2. guava/src/com/google/common/math/LongMath.java

             *            sqrtFloor^2 <= x < (sqrtFloor + 1)^2
             * halfSquare - sqrtFloor <= x < halfSquare + sqrtFloor + 1
             * so |x - halfSquare| <= sqrtFloor.  Therefore, it's safe to treat x - halfSquare as a
             * signed long, so lessThanBranchFree is safe for use.
             */
            return sqrtFloor + lessThanBranchFree(halfSquare, x);
        }
        throw new AssertionError();
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 09 16:39:37 UTC 2024
    - 45.2K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/math/LongMath.java

             *            sqrtFloor^2 <= x < (sqrtFloor + 1)^2
             * halfSquare - sqrtFloor <= x < halfSquare + sqrtFloor + 1
             * so |x - halfSquare| <= sqrtFloor.  Therefore, it's safe to treat x - halfSquare as a
             * signed long, so lessThanBranchFree is safe for use.
             */
            return sqrtFloor + lessThanBranchFree(halfSquare, x);
        }
        throw new AssertionError();
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 09 16:39:37 UTC 2024
    - 45.2K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/math/LongMathTest.java

      public void testSqrtExactMatchesFloorOrThrows() {
        for (long x : POSITIVE_LONG_CANDIDATES) {
          long sqrtFloor = LongMath.sqrt(x, FLOOR);
          // We only expect an exception if x was not a perfect square.
          boolean isPerfectSquare = (sqrtFloor * sqrtFloor == x);
          try {
            assertEquals(sqrtFloor, LongMath.sqrt(x, UNNECESSARY));
            assertTrue(isPerfectSquare);
          } catch (ArithmeticException e) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
Back to top