propagateNaN method

FloatingPoint propagateNaN(
  1. FloatingPoint first,
  2. FloatingPoint second
)

Propagate the first signaling NaN, otherwise the first quiet NaN.

Implementation

FloatingPoint propagateNaN(FloatingPoint first, FloatingPoint second) {
  final selectSecond = (~first.isSignalingNaN &
          (second.isSignalingNaN | (~first.isNaN & second.isNaN)))
      .named('selectSecondNaN');
  final selected = first.clone(name: 'selectedNaN')
    ..gets(mux(selectSecond, second, first));
  return quietNaNFrom(selected);
}