Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79721 - trunk/libs/math/doc/sf_and_dist
From: pbristow_at_[hidden]
Date: 2012-07-24 07:32:18


Author: pbristow
Date: 2012-07-24 07:32:17 EDT (Tue, 24 Jul 2012)
New Revision: 79721
URL: http://svn.boost.org/trac/boost/changeset/79721

Log:
Added Warning and tip about using nextafter etc.
Text files modified:
   trunk/libs/math/doc/sf_and_dist/float_next.qbk | 10 ++++++++--
   1 files changed, 8 insertions(+), 2 deletions(-)

Modified: trunk/libs/math/doc/sf_and_dist/float_next.qbk
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/float_next.qbk (original)
+++ trunk/libs/math/doc/sf_and_dist/float_next.qbk 2012-07-24 07:32:17 EDT (Tue, 24 Jul 2012)
@@ -49,6 +49,12 @@
 a __domain_error. If there is no such value in the direction of /y/ then
 returns an __overflow_error.
 
+[warning The template parameter FTP must be a floating-point type.
+An integer type, for example, will produce an unhelpful error message.]
+
+[tip Nearly always, you just want the next or prior representable value,
+so instead use `float_next` or `float_prior` below.]
+
 [h4 Examples - nextafter]
 
 The two representations using a 32-bit float either side of unity are:
@@ -88,7 +94,7 @@
 
 Has the same effect as
 
- nextafter(val, std::numeric_limits<FPT>::max());
+ nextafter(val, (std::numeric_limits<FPT>::max)());
 
 [endsect] [/section:float_next Finding the Next Greater Representable Value (float_prior)]
 
@@ -117,7 +123,7 @@
 
 Has the same effect as
 
- nextafter(val, -std::numeric_limits<FPT>::max()); // Note most negative value -max.
+ nextafter(val, -(std::numeric_limits<FPT>::max)()); // Note most negative value -max.
 
 [endsect] [/section:float_prior Finding the Next Smaller Representable Value (float_prior)]
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk