12#ifndef ARCANE_DATATYPE_NUMERIC_H
13#define ARCANE_DATATYPE_NUMERIC_H
17#include "arcane/utils/Limits.h"
18#include "arcane/utils/Math.h"
64 constexpr ARCCORE_HOST_DEVICE
static bool isZero(
const T& a)
74 constexpr ARCCORE_HOST_DEVICE
static bool isNearlyEqual(
const T& a,
const T& b)
94 constexpr ARCCORE_HOST_DEVICE
static bool isEqual(
const T& a,
const T& b)
119 constexpr ARCCORE_HOST_DEVICE
static bool isNearlyZero(T a)
121 return ((a < 0.) ? a > -nepsilon() : a < nepsilon());
134 return ((a < 0.) ? a > -epsilon : a < epsilon);
141 return ((a < 0.) ? a > -(b * nepsilon()) : a < (b * nepsilon()));
144 constexpr ARCCORE_HOST_DEVICE
static bool isTrueZero(T a) {
return (a ==
FloatInfo<T>::zero()); }
145 constexpr ARCCORE_HOST_DEVICE
static bool isZero(T a) {
return (a == FloatInfo<T>::zero()); }
146 constexpr ARCCORE_HOST_DEVICE
static bool isNearlyEqual(T a, T b)
148 T s = math::abs(a) + math::abs(b);
150 return (d == FloatInfo<T>::zero()) ? true : isNearlyZero(d / s);
152 constexpr ARCCORE_HOST_DEVICE
static bool isNearlyEqualWithEpsilon(T a, T b, T epsilon)
154 T s = math::abs(a) + math::abs(b);
158 constexpr ARCCORE_HOST_DEVICE
static bool isEqual(T a, T b)
191#ifdef ARCANE_REAL_NOT_BUILTIN
218 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
225 constexpr ARCCORE_HOST_DEVICE
inline bool
241 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
248 ARCCORE_HOST_DEVICE
constexpr inline bool
259 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
266 ARCCORE_HOST_DEVICE
constexpr inline bool
282 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
295 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
296 isNearlyZero(
const _Type& a)
306 template <
class _Type>
constexpr ARCCORE_HOST_DEVICE
inline bool
constexpr __host__ static __device__ bool isNearlyZeroWithEpsilon(T a, T epsilon)
Compares a to zero within epsilon.
__host__ static __device__ bool isNearlyZero(T a, T b)
Compares with b*epsilon.
Information about the floating-point type.
constexpr __host__ static __device__ bool isNearlyZero(const T &a)
Compares a to zero.
constexpr __host__ static __device__ bool isZero(const T &a)
Compares a to zero.
constexpr __host__ static __device__ bool isEqual(const T &a, const T &b)
Compares a to b.
constexpr __host__ static __device__ bool isNearlyEqual(const T &a, const T &b)
Compares a to b.
constexpr __host__ static __device__ bool isNearlyEqualWithEpsilon(const T &a, const T &b, const T &)
Compares a to b.
constexpr __host__ __device__ bool isNearlyZeroWithEpsilon(const _Type &a, const _Type &epsilon)
Tests if a value is approximately equal to zero within an epsilon.
constexpr __host__ __device__ bool isNearlyEqualWithEpsilon(const _Type &a, const _Type &b, const _Type &epsilon)
Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqua...
constexpr __host__ __device__ bool isNearlyEqual(const _Type &a, const _Type &b)
Tests if two values are approximately equal. For integer types, this function is equivalent to IsEqua...
bool isZero(const BuiltInProxy< _Type > &a)
Tests if a value is exactly equal to zero.
constexpr __host__ __device__ bool isEqual(const _Type &a, const _Type &b)
Tests the bit-by-bit equality between two values.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
double Real
Type representing a real number.