Opened 6 years ago

Closed 6 years ago

#12227 closed Feature Requests (fixed)

cpp_bin_float: sqrt(+inf) inconsistent with IEEE-754

Reported by: Michael Shatz Owned by: John Maddock
Milestone: Boost 1.62.0 Component: multiprecision
Version: Boost 1.61.0 Severity: Problem
Keywords: Cc:

Description

cpp_bin_float sqrt(+inf) returns NaN. IEEE-754 appears to recommend +inf which is also the most logical result. The requirement is not very clear from the wording of Standard, but asked a member of committee and he has no doubt that it was an intention.

It's not a bug, because cpp_bin_float was never advertised as fully compliant with IEEE-754, but I see no reason why it can't be as close as possible to IEEE binary floating point. Especially in cases like that where consistency with IEEE is almost free in terms of performance.

Change History (1)

comment:1 by John Maddock, 6 years ago

Milestone: To Be DeterminedBoost 1.62.0
Resolution: fixed
Status: newclosed

Fixed in https://github.com/boostorg/multiprecision/commit/9c7210e85918ae29ef06a7162d3e7435a73100ab

Thanks!

Aside: it seems wrong to me that sqrt(numeric_limits<>::max() + 1) is infinity, but never mind...

Note: See TracTickets for help on using tickets.