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

Method toBigDecimal

core/src/main/java/io/questdb/std/Decimal256.java:745–756  ·  view source on GitHub ↗
(long hh, long hl, long lh, long ll, int scale)

Source from the content-addressed store, hash-verified

743 }
744
745 public static @NotNull BigDecimal toBigDecimal(long hh, long hl, long lh, long ll, int scale) {
746 // Convert 256-bit value to BigInteger
747 byte[] bytes = new byte[32]; // 256 bits = 32 bytes
748 // Fill bytes in big-endian order
749 putLongIntoBytes(bytes, 0, hh);
750 putLongIntoBytes(bytes, 8, hl);
751 putLongIntoBytes(bytes, 16, lh);
752 putLongIntoBytes(bytes, 24, ll);
753
754 BigInteger unscaledValue = new BigInteger(bytes);
755 return new BigDecimal(unscaledValue, scale);
756 }
757
758 /**
759 * Writes the string representation of the given Decimal256 to the specified CharSink.

Callers 15

testCompareToFuzzMethod · 0.95
testDivide64Method · 0.95
testDivideAddBackMethod · 0.95
testDivideLargeMethod · 0.95
testDivideLargeScaleMethod · 0.95
testDivideOverflowMethod · 0.95
testDivisionDivWordMethod · 0.95
testEndMethod · 0.95
testRoundMethod · 0.95
testRoundFuzzMethod · 0.95
testStaticNegateMethod · 0.95

Calls 2

putLongIntoBytesMethod · 0.95
isZeroMethod · 0.95

Tested by 15

testCompareToFuzzMethod · 0.76
testDivide64Method · 0.76
testDivideAddBackMethod · 0.76
testDivideLargeMethod · 0.76
testDivideLargeScaleMethod · 0.76
testDivideOverflowMethod · 0.76
testDivisionDivWordMethod · 0.76
testEndMethod · 0.76
testRoundMethod · 0.76
testRoundFuzzMethod · 0.76
testStaticNegateMethod · 0.76