| 1 |
// |
| 2 |
// SPDX-License-Identifier: BSD-3-Clause |
| 3 |
// Copyright Contributors to the OpenEXR Project. |
| 4 |
// |
| 5 |
|
| 6 |
#include "ImathFun.h" |
| 7 |
#include <cmath> |
| 8 |
|
| 9 |
IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER |
| 10 |
|
| 11 |
float succf(float f) IMATH_NOEXCEPT |
| 12 |
{ |
| 13 |
return std::isfinite(f) ? |
| 14 |
std::nextafter(f, std::numeric_limits<float>::infinity()) : f; |
| 15 |
} |
| 16 |
|
| 17 |
float predf(float f) IMATH_NOEXCEPT |
| 18 |
{ |
| 19 |
return std::isfinite(f) ? |
| 20 |
std::nextafter(f, -std::numeric_limits<float>::infinity()) : f; |
| 21 |
} |
| 22 |
|
| 23 |
double succd(double d) IMATH_NOEXCEPT |
| 24 |
{ |
| 25 |
return std::isfinite(d) ? |
| 26 |
std::nextafter(d, std::numeric_limits<double>::infinity()) : d; |
| 27 |
} |
| 28 |
|
| 29 |
double predd(double d) IMATH_NOEXCEPT |
| 30 |
{ |
| 31 |
return std::isfinite(d) ? |
| 32 |
std::nextafter(d, -std::numeric_limits<double>::infinity()) : d; |
| 33 |
} |
| 34 |
|
| 35 |
IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT |