Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for testSqrtOfPerfectSquareAsDoubleIsPerfect (0.42 sec)

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

        }
      }
    
    
      @J2ktIncompatible // slow enough to cause flakiness
      @GwtIncompatible // far too slow
      public void testSqrtOfPerfectSquareAsDoubleIsPerfect() {
        // This takes just over a minute on my machine.
        for (long n = 0; n <= LongMath.FLOOR_SQRT_MAX_LONG; n++) {
          long actual = (long) Math.sqrt((double) (n * n));
          assertTrue(actual == n);
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Mon Aug 11 19:31:30 UTC 2025
    - 31.4K bytes
    - Viewed (0)
  2. guava/src/com/google/common/math/LongMath.java

         *          since casting to long is monotonic
         * k <= (long) Math.sqrt(x) <= k + 1
         *          since (long) Math.sqrt(k * k) == k, as checked exhaustively in
         *          {@link LongMathTest#testSqrtOfPerfectSquareAsDoubleIsPerfect}
         */
        long guess = (long) Math.sqrt((double) x);
        // Note: guess is always <= FLOOR_SQRT_MAX_LONG.
        long guessSquared = guess * guess;
    Registered: Fri Sep 05 12:43:10 UTC 2025
    - Last Modified: Fri Aug 29 16:20:07 UTC 2025
    - 46.8K bytes
    - Viewed (0)
Back to top