Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for checkedSubtract (0.05 sec)

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

            boolean expectedSuccess = fitsInLong(expectedResult);
            try {
              assertEquals(a - b, LongMath.checkedSubtract(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              if (expectedSuccess) {
                failFormat(
                    "expected checkedSubtract(%s, %s) = %s; got ArithmeticException",
                    a, b, expectedResult);
              }
            }
          }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/math/IntMathTest.java

            BigInteger expectedResult = valueOf(a).subtract(valueOf(b));
            boolean expectedSuccess = fitsInInt(expectedResult);
            try {
              assertEquals(a - b, IntMath.checkedSubtract(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              assertFalse(expectedSuccess);
            }
          }
        }
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  3. guava/src/com/google/common/math/LongMath.java

       */
      // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, ||
      @SuppressWarnings("ShortCircuitBoolean")
      public static long checkedSubtract(long a, long b) {
        long result = a - b;
        checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0, "checkedSubtract", a, b);
        return result;
      }
    
      /**
       * Returns the product of {@code a} and {@code b}, provided it does not overflow.
       *
    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. android/guava-tests/test/com/google/common/math/IntMathTest.java

            BigInteger expectedResult = valueOf(a).subtract(valueOf(b));
            boolean expectedSuccess = fitsInInt(expectedResult);
            try {
              assertEquals(a - b, IntMath.checkedSubtract(a, b));
              assertTrue(expectedSuccess);
            } catch (ArithmeticException e) {
              assertFalse(expectedSuccess);
            }
          }
        }
      }
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  5. android/guava/src/com/google/common/math/LongMath.java

       */
      // Whenever both tests are cheap and functional, it's faster to use &, | instead of &&, ||
      @SuppressWarnings("ShortCircuitBoolean")
      public static long checkedSubtract(long a, long b) {
        long result = a - b;
        checkNoOverflow((a ^ b) >= 0 | (a ^ result) >= 0, "checkedSubtract", a, b);
        return result;
      }
    
      /**
       * Returns the product of {@code a} and {@code b}, provided it does not overflow.
       *
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 09 16:39:37 UTC 2024
    - 45.2K bytes
    - Viewed (0)
Back to top