diff --git a/doc/cmath.qbk b/doc/cmath.qbk new file mode 100644 index 0000000..4e07217 --- /dev/null +++ b/doc/cmath.qbk @@ -0,0 +1,122 @@ +[/ + Copyright 2018 Peter Dimov + + Distributed under the Boost Software License, Version 1.0. + + See accompanying file LICENSE_1_0.txt + or copy at http://boost.org/LICENSE_1_0.txt +] + +[section:cmath cmath] + +[simplesect Authors] + +* Peter Dimov + +[endsimplesect] + +[section Header ] + +The header `` defines, in a portable way, the floating +point classification and sign manipulation functions from C++11. + +[section Synopsis] + +`` +namespace boost +{ +namespace core +{ + +// fpclassify return values + +int const fp_zero = /*unspecified*/; +int const fp_subnormal = /*unspecified*/; +int const fp_normal = /*unspecified*/; +int const fp_infinite = /*unspecified*/; +int const fp_nan = /*unspecified*/; + +// Classification functions + +template bool isfinite( T x ); +template bool isnan( T x ); +template bool isinf( T x ); +template bool isnormal( T x ); +template int fpclassify( T x ); + +// Sign manipulation functions + +template bool signbit( T x ); +template T copysign( T x, T y ); + +} // namespace core +} // namespace boost +`` + +[endsect] + +[section Classification Functions] + +[section template bool isfinite( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `true` when `x` is finite (not infinity or NaN), `false` otherwise. + +[endsect] + +[section template bool isnan( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `true` when `x` is NaN, `false` otherwise. + +[endsect] + +[section template bool isinf( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `true` when `x` is infinity, `false` otherwise. + +[endsect] + +[section template bool isnormal( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `true` when `x` is a normal number (not zero, subnormal, infinity, or NaN), `false` otherwise. + +[endsect] + +[section template int fpclassify( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* + * `fp_zero` when `x` is zero; + * `fp_subnormal` when `x` is subnormal; + * `fp_infinite` when `x` is infinity; + * `fp_nan` when `x` is NaN; + * `fp_normal` otherwise. + +[endsect] + +[endsect] + +[section Sign Manipulation Functions] + +[section template bool signbit( T x );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `true` when `x` is negative, `false` otherwise. + +[endsect] + +[section template bool copysign( T x, T y );] + +* *Requires:* `T` must be `float`, `double`, or `long double`. +* *Returns:* `x` with the sign copied from `y`. + +[endsect] + +[endsect] + +[endsect] + +[endsect] diff --git a/doc/core.qbk b/doc/core.qbk index a51d6f9..83a67f9 100644 --- a/doc/core.qbk +++ b/doc/core.qbk @@ -42,6 +42,7 @@ criteria for inclusion is that the utility component be: [include allocator_access.qbk] [include alloc_construct.qbk] [include checked_delete.qbk] +[include cmath.qbk] [include default_allocator.qbk] [include demangle.qbk] [include empty_value.qbk]