MCPcopy Create free account
hub / github.com/questdb/questdb / fromDouble

Method fromDouble

core/src/main/java/io/questdb/std/Decimal256.java:576–580  ·  view source on GitHub ↗

Create Decimal256 from a double value with specified scale. @param value the double value @param scale the desired scale @return new Decimal256 instance @throws NumericException if scale is invalid

(double value, int scale)

Source from the content-addressed store, hash-verified

574 * @throws NumericException if scale is invalid
575 */
576 public static Decimal256 fromDouble(double value, int scale) {
577 validateScale(scale);
578 BigDecimal bd = new BigDecimal(value).setScale(scale, RoundingMode.HALF_UP);
579 return fromBigDecimal(bd);
580 }
581
582 /**
583 * Create Decimal256 from a long value with specified scale.

Callers 15

testCopyFromMethod · 0.95
testDivide64Method · 0.95
testDivideLargeMethod · 0.95
testDivideLargeScaleMethod · 0.95
testDivideOverflowMethod · 0.95
testDivisionByZeroMethod · 0.95
testDivisionScaledMethod · 0.95
testFromDoubleMethod · 0.95
testInPlaceAdditionMethod · 0.95
testInPlaceDivisionMethod · 0.95
testInPlaceModuloMethod · 0.95

Calls 3

validateScaleMethod · 0.95
fromBigDecimalMethod · 0.95
setScaleMethod · 0.65

Tested by 15

testCopyFromMethod · 0.76
testDivide64Method · 0.76
testDivideLargeMethod · 0.76
testDivideLargeScaleMethod · 0.76
testDivideOverflowMethod · 0.76
testDivisionByZeroMethod · 0.76
testDivisionScaledMethod · 0.76
testFromDoubleMethod · 0.76
testInPlaceAdditionMethod · 0.76
testInPlaceDivisionMethod · 0.76
testInPlaceModuloMethod · 0.76