FloatingPoint8E4M3Value.ofDouble constructor

FloatingPoint8E4M3Value.ofDouble(
  1. double inDouble
)

Numeric conversion of a FloatingPoint8E4M3Value from a host double

Implementation

factory FloatingPoint8E4M3Value.ofDouble(double inDouble) {
  if ((inDouble.abs() > maxValue) |
      ((inDouble != 0) & (inDouble.abs() < minValue))) {
    throw RohdHclException('Number exceeds E4M3 range');
  }
  final fpv = FloatingPointValue.ofDouble(inDouble,
      exponentWidth: exponentWidth, mantissaWidth: mantissaWidth);
  return FloatingPoint8E4M3Value(
      sign: fpv.sign, exponent: fpv.exponent, mantissa: fpv.mantissa);
}