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)
| 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. |