|
Boost-Commit : |
From: john_at_[hidden]
Date: 2008-01-14 12:28:52
Author: johnmaddock
Date: 2008-01-14 12:28:52 EST (Mon, 14 Jan 2008)
New Revision: 42769
URL: http://svn.boost.org/trac/boost/changeset/42769
Log:
Added initial rounding function docs.
Added:
sandbox/math_toolkit/libs/math/doc/sf_and_dist/rounding_func.qbk (contents, props changed)
Text files modified:
sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
Modified: sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk
==============================================================================
--- sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk (original)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/math.qbk 2008-01-14 12:28:52 EST (Mon, 14 Jan 2008)
@@ -361,6 +361,7 @@
[include powers.qbk]
[include sinc.qbk]
[include inv_hyper.qbk]
+[include rounding_func.qbk]
[include fpclassify.qbk]
[endsect] [/section:special Special Functions]
Added: sandbox/math_toolkit/libs/math/doc/sf_and_dist/rounding_func.qbk
==============================================================================
--- (empty file)
+++ sandbox/math_toolkit/libs/math/doc/sf_and_dist/rounding_func.qbk 2008-01-14 12:28:52 EST (Mon, 14 Jan 2008)
@@ -0,0 +1,74 @@
+
+[section:rounding Rounding Truncation and Integer Conversion]
+
+[section:round Rounding Functions]
+
+ template <class T>
+ T round(const T& v);
+
+ template <class T>
+ int iround(const T& v);
+
+ template <class T>
+ long lround(const T& v);
+
+ template <class T>
+ long long llround(const T& v);
+
+These functions return the closest integer to the argument /v/.
+
+Halfway cases are rounded away from zero, regardless of the current rounding
+direction.
+
+[endsect]
+
+[section:trunc Truncation Functions]
+
+ template <class T>
+ T trunc(const T& v);
+
+ template <class T>
+ int itrunc(const T& v);
+
+ template <class T>
+ long ltrunc(const T& v);
+
+ template <class T>
+ long long lltrunc(const T& v);
+
+The trunc functions round their argument to the integer value,
+nearest to but no larger in magnitude than the argument.
+
+For example `itrunc(3.7)` would return `3` and `ltrunc(-4.6)`
+would return `-4`.
+
+[endsect]
+
+[section:modf Integer and Fractional Part Splitting (modf)]
+
+ template <class T>
+ T modf(const T& v, T* ipart);
+
+ template <class T>
+ T modf(const T& v, int* ipart);
+
+ template <class T>
+ T modf(const T& v, long* ipart);
+
+ template <class T>
+ T modf(const T& v, long long* ipart);
+
+The `modf` functions store the integer part of /v/ in `*ipart`
+and return the fractional part of /v/.
+
+[endsect]
+
+
+[endsect] [/section:rounding Rounding Truncation and Integer Conversion]
+
+[/
+ Copyright 2006 John Maddock and Paul A. Bristow.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt).
+]
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