ofFloatingPointValue method

FxvType ofFloatingPointValue(
  1. FloatingPointValue fpv, {
  2. FloatingPointRoundingMode roundingMode = FloatingPointRoundingMode.truncate,
})

Converts fpv directly into this fixed-point format.

NaN and infinity cannot be represented and cause an exception.

Implementation

FxvType ofFloatingPointValue(FloatingPointValue fpv,
    {FloatingPointRoundingMode roundingMode =
        FloatingPointRoundingMode.truncate}) {
  final exact = fpv.toScaledBigInt();
  return ofScaledBigInt(exact.significand, exact.exponent,
      roundingMode: roundingMode);
}