lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master f02f033 3/3: Improve documentation


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f02f033 3/3: Improve documentation
Date: Thu, 13 Apr 2017 08:04:38 -0400 (EDT)

branch: master
commit f02f03369da0add2d7436059bd7e82c152960454
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Improve documentation
---
 bourn_cast.hpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bourn_cast.hpp b/bourn_cast.hpp
index f1e6334..95db530 100644
--- a/bourn_cast.hpp
+++ b/bourn_cast.hpp
@@ -45,8 +45,10 @@
 /// Handle special cases first:
 ///  - infinities are interconvertible: no exception wanted;
 ///  - C++11 [4.8/1] doesn't require static_cast to DTRT for NaNs;
-/// then convert iff within range. Alternatively, a case could be
-/// made for converting out-of-range values to infinity, e.g.,
+/// then convert iff within range.
+///
+/// Alternatively, a case could be made for converting out-of-range
+/// values to infinity, e.g.,
 ///   (float)(DBL_MAX) --> INFINITY
 /// citing IEEE 754-2008 [5.4.2] "conversion ... to a narrower format
 /// ... shall be rounded as specified in Clause 4" and [4.3.1] "an
@@ -55,6 +57,12 @@
 /// types provide the IEC 60559 conversions between floating-point
 /// precisions"; however, C++11 [4.8.1] still says this is undefined
 /// behavior, and such a conversion is unlikely to be intentional.
+///
+/// IEEE 754-2008 [6.2] would return a NaN argument unchanged wherever
+/// possible. While a compiler could do that, this implementation in
+/// general cannot: even in the case of conversion to the same type,
+/// returning the argument would involve undefined behavior in the
+/// case of a signaling NaN [C99 F.2.1].
 
 template<typename To, typename From>
 #if 201402L < __cplusplus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]