@@ -60,7 +60,7 @@ ValueWithRealFlags<Real<W, P, IM>> Real<W, P, IM>::Add(
60
60
const Real &y, Rounding rounding) const {
61
61
ValueWithRealFlags<Real> result;
62
62
if (IsNotANumber () || y.IsNotANumber ()) {
63
- result.value = NaN (); // NaN + x -> NaN
63
+ result.value = NotANumber (); // NaN + x -> NaN
64
64
if (IsSignalingNaN () || y.IsSignalingNaN ()) {
65
65
result.flags .set (RealFlag::InvalidArgument);
66
66
}
@@ -73,7 +73,7 @@ ValueWithRealFlags<Real<W, P, IM>> Real<W, P, IM>::Add(
73
73
if (isNegative == yIsNegative) {
74
74
result.value = *this ; // +/-Inf + +/-Inf -> +/-Inf
75
75
} else {
76
- result.value = NaN (); // +/-Inf + -/+Inf -> NaN
76
+ result.value = NotANumber (); // +/-Inf + -/+Inf -> NaN
77
77
result.flags .set (RealFlag::InvalidArgument);
78
78
}
79
79
} else {
@@ -140,15 +140,15 @@ ValueWithRealFlags<Real<W, P, IM>> Real<W, P, IM>::Multiply(
140
140
const Real &y, Rounding rounding) const {
141
141
ValueWithRealFlags<Real> result;
142
142
if (IsNotANumber () || y.IsNotANumber ()) {
143
- result.value = NaN (); // NaN * x -> NaN
143
+ result.value = NotANumber (); // NaN * x -> NaN
144
144
if (IsSignalingNaN () || y.IsSignalingNaN ()) {
145
145
result.flags .set (RealFlag::InvalidArgument);
146
146
}
147
147
} else {
148
148
bool isNegative{IsNegative () != y.IsNegative ()};
149
149
if (IsInfinite () || y.IsInfinite ()) {
150
150
if (IsZero () || y.IsZero ()) {
151
- result.value = NaN (); // 0 * Inf -> NaN
151
+ result.value = NotANumber (); // 0 * Inf -> NaN
152
152
result.flags .set (RealFlag::InvalidArgument);
153
153
} else {
154
154
result.value = Infinity (isNegative);
@@ -200,22 +200,22 @@ ValueWithRealFlags<Real<W, P, IM>> Real<W, P, IM>::Divide(
200
200
const Real &y, Rounding rounding) const {
201
201
ValueWithRealFlags<Real> result;
202
202
if (IsNotANumber () || y.IsNotANumber ()) {
203
- result.value = NaN (); // NaN / x -> NaN, x / NaN -> NaN
203
+ result.value = NotANumber (); // NaN / x -> NaN, x / NaN -> NaN
204
204
if (IsSignalingNaN () || y.IsSignalingNaN ()) {
205
205
result.flags .set (RealFlag::InvalidArgument);
206
206
}
207
207
} else {
208
208
bool isNegative{IsNegative () != y.IsNegative ()};
209
209
if (IsInfinite ()) {
210
210
if (y.IsInfinite ()) {
211
- result.value = NaN (); // Inf/Inf -> NaN
211
+ result.value = NotANumber (); // Inf/Inf -> NaN
212
212
result.flags .set (RealFlag::InvalidArgument);
213
213
} else { // Inf/x -> Inf, Inf/0 -> Inf
214
214
result.value = Infinity (isNegative);
215
215
}
216
216
} else if (y.IsZero ()) {
217
217
if (IsZero ()) { // 0/0 -> NaN
218
- result.value = NaN ();
218
+ result.value = NotANumber ();
219
219
result.flags .set (RealFlag::InvalidArgument);
220
220
} else { // x/0 -> Inf, Inf/0 -> Inf
221
221
result.value = Infinity (isNegative);
0 commit comments