- 
                Notifications
    You must be signed in to change notification settings 
- Fork 7
Description
I believe IEEE says that -inf + inf should produce NaN, but dfp produces garbage, e.g.
    auto inf = __bid64_from_string("INF", 0, &flags);
    std::cout << "inf: " << str(inf) << "  " << str(-inf + inf) <<  std::endl;
prints
inf: +Inf  +0E-398
for Decimal
template<typename T>
void nan_inf_add()
{
    using nl = std::numeric_limits<T>;
    auto inf = nl::infinity();
    std::println("{}, {}",inf,  -inf+inf);
}
prints
inf, -inf
while float and double print
inf, -nan
I am not sure how valuable is to check for this since addition is performance critical operation, but if this was not intentional then maybe Decimal should produce Nan(or -Nan).
Also I did not find the IEEE authoritative reference for inf addition, so if you have a document that specifies this result for FP numbers or decimal FP in particular feel free to correct my assumptions.
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working