Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 2 of 2 for testSqrtOfPerfectSquareAsDoubleIsPerfect (0.61 seconds)

  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);
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Oct 30 14:15:36 GMT 2025
    - 31.4K bytes
    - Click Count (0)
  2. android/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;
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Mon Mar 09 23:01:02 GMT 2026
    - 46.8K bytes
    - Click Count (0)
Back to Top