Adobe Source Libraries 1.49.0
A collection of C++ libraries.
|
Classes | |
class | nearest_cast_fn< A, R > |
Functions | |
template<typename R, typename A> | |
R | nearest_cast (const A &x) |
double | round_half_up (double x) |
float | round_half_up (float x) |
long | lround_half_up (double x) |
long | lround_half_up (float x) |
<adobe/cmath.hpp>
provides type definitions and functions based on the 1999 C Standard header <math.h>
wrapped in namespace adobe
. Currently, the set of provided types and functions is limited, please request extensions to this file as needed.
The C99/TR1 extensions supplied here for compatibility are:
- adobe::double_t - A type at least as wide as double. - adobe::float_t - A type at least as wide as float. - adobe::trunc - Returns the truncated integer value. - adobe::round - Returns nearest integer value in floating-point format, rounding halfway cases away from zero, regardless of the current rounding direction. - adobe::lround - Same as <code>round()</code>, but returns a long int.
The implementation may #include <math.h>
.
There are also additions in this file not related to the C99 but are nevertheless appropriate as cmath extensions.
R nearest_cast | ( | const A & | x | ) |
This function addresses the problem where a value of a floating-point type is to be converted to an unknown user-defined type. If the unknown type is an integral type, the argument should be rounded. If not, the argument should be cast directly to the return type. nearest_cast performs the rounding if necessary using round_half_up().
adobe::nearest_cast_fn is the function object form of adobe::nearest_cast and may be specialized to with a user defined type to customize adobe::nearest_cast.
double round_half_up | ( | double | x | ) |
float round_half_up | ( | float | x | ) |
long lround_half_up | ( | double | x | ) |
long lround_half_up | ( | float | x | ) |