Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for roundToDouble (0.13 sec)

  1. android/guava-tests/benchmark/com/google/common/math/BigIntegerMathRoundingBenchmark.java

          tmp += BigIntegerMath.divide(nonzero1[j], nonzero2[j], mode).intValue();
        }
        return tmp;
      }
    
      @Benchmark
      long roundToDouble(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += Double.doubleToRawLongBits(BigIntegerMath.roundToDouble(nonzero1[j], mode));
        }
        return tmp;
      }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Jun 30 13:06:20 UTC 2020
    - 2.8K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/math/BigDecimalMath.java

       *     is not precisely representable as a {@code double}
       * @since 30.0
       */
      public static double roundToDouble(BigDecimal x, RoundingMode mode) {
        return BigDecimalToDoubleRounder.INSTANCE.roundToDouble(x, mode);
      }
    
      private static class BigDecimalToDoubleRounder extends ToDoubleRounder<BigDecimal> {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Feb 23 18:45:50 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  3. guava/src/com/google/common/math/BigDecimalMath.java

       *     is not precisely representable as a {@code double}
       * @since 30.0
       */
      public static double roundToDouble(BigDecimal x, RoundingMode mode) {
        return BigDecimalToDoubleRounder.INSTANCE.roundToDouble(x, mode);
      }
    
      private static class BigDecimalToDoubleRounder extends ToDoubleRounder<BigDecimal> {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Feb 23 18:45:50 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/math/BigDecimalMathTest.java

            RoundingMode mode = entry.getKey();
            Double expectation = entry.getValue();
            assertWithMessage("roundToDouble(" + input + ", " + mode + ")")
                .that(BigDecimalMath.roundToDouble(input, mode))
                .isEqualTo(expectation);
          }
    
          if (!expectedValues.containsKey(UNNECESSARY)) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Sep 06 17:04:31 UTC 2023
    - 10.6K bytes
    - Viewed (0)
  5. guava-tests/benchmark/com/google/common/math/BigIntegerMathRoundingBenchmark.java

          tmp += BigIntegerMath.divide(nonzero1[j], nonzero2[j], mode).intValue();
        }
        return tmp;
      }
    
      @Benchmark
      long roundToDouble(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
          tmp += Double.doubleToRawLongBits(BigIntegerMath.roundToDouble(nonzero1[j], mode));
        }
        return tmp;
      }
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Jun 30 13:06:20 UTC 2020
    - 2.8K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/math/LongMathTest.java

        for (RoundingMode roundingMode : EnumSet.complementOf(EnumSet.of(UNNECESSARY))) {
          for (long candidate : roundToDoubleTestCandidates) {
            assertThat(LongMath.roundToDouble(candidate, roundingMode))
                .isEqualTo(BigIntegerMath.roundToDouble(BigInteger.valueOf(candidate), roundingMode));
          }
        }
      }
    
      @GwtIncompatible
      public void testRoundToDoubleAgainstBigIntegerUnnecessary() {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Fri Oct 18 15:00:32 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  7. guava/src/com/google/common/math/ToDoubleRounder.java

      abstract X toX(double d, RoundingMode mode);
    
      /** Returns a - b, guaranteed that both arguments are nonnegative. */
      abstract X minus(X a, X b);
    
      /** Rounds {@code x} to a {@code double}. */
      final double roundToDouble(X x, RoundingMode mode) {
        checkNotNull(x, "x");
        checkNotNull(mode, "mode");
        double roundArbitrarily = roundToDoubleArbitrarily(x);
        if (Double.isInfinite(roundArbitrarily)) {
          switch (mode) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  8. guava/src/com/google/common/math/BigIntegerMath.java

       *     is not precisely representable as a {@code double}
       * @since 30.0
       */
      @GwtIncompatible
      public static double roundToDouble(BigInteger x, RoundingMode mode) {
        return BigIntegerToDoubleRounder.INSTANCE.roundToDouble(x, mode);
      }
    
      @GwtIncompatible
      private static class BigIntegerToDoubleRounder extends ToDoubleRounder<BigInteger> {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Oct 16 17:21:56 UTC 2024
    - 18.8K bytes
    - Viewed (0)
  9. android/guava/src/com/google/common/math/ToDoubleRounder.java

      abstract X toX(double d, RoundingMode mode);
    
      /** Returns a - b, guaranteed that both arguments are nonnegative. */
      abstract X minus(X a, X b);
    
      /** Rounds {@code x} to a {@code double}. */
      final double roundToDouble(X x, RoundingMode mode) {
        checkNotNull(x, "x");
        checkNotNull(mode, "mode");
        double roundArbitrarily = roundToDoubleArbitrarily(x);
        if (Double.isInfinite(roundArbitrarily)) {
          switch (mode) {
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Wed Feb 07 17:50:39 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  10. guava/src/com/google/common/math/LongMath.java

       *     is not precisely representable as a {@code double}
       * @since 30.0
       */
      @SuppressWarnings("deprecation")
      @GwtIncompatible
      public static double roundToDouble(long x, RoundingMode mode) {
        // Logic adapted from ToDoubleRounder.
        double roundArbitrarily = (double) x;
        long roundArbitrarilyAsLong = (long) roundArbitrarily;
        int cmpXToRoundArbitrarily;
    
    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