Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
Limits.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Limits.h (C) 2000-2024 */
9/* */
10/* Fichiers encapsulant <limits> et associés. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_LIMITS_H
13#define ARCANE_UTILS_LIMITS_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/StdHeader.h"
18
19// Comme <limits> definit min, max, abs, ... et que certains logiciels
20// en font des macros, on les supprime
21#ifdef min
22#undef min
23#endif
24#ifdef max
25#undef max
26#endif
27#ifdef abs
28#undef abs
29#endif
30#include <limits>
31
32#include <float.h>
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37namespace Arcane
38{
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
46template<typename T>
48{
49 public:
52};
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
59template<>
61{
62 public:
65 public:
66 ARCCORE_HOST_DEVICE static constexpr unsigned int precision() { return 1; }
67 ARCCORE_HOST_DEVICE static constexpr unsigned int maxDigit() { return FLT_DIG; }
68 ARCCORE_HOST_DEVICE static constexpr float epsilon() { return FLT_EPSILON; }
69 ARCCORE_HOST_DEVICE static constexpr float nearlyEpsilon() { return FLT_EPSILON*10.0f; }
70 ARCCORE_HOST_DEVICE static constexpr float maxValue() { return FLT_MAX; }
71 ARCCORE_HOST_DEVICE static constexpr float zero() { return 0.0f; }
72};
73
74/*---------------------------------------------------------------------------*/
75/*---------------------------------------------------------------------------*/
79template<>
81{
82 public:
85 public:
86 ARCCORE_HOST_DEVICE static constexpr unsigned int precision() { return 2; }
87 ARCCORE_HOST_DEVICE static constexpr unsigned int maxDigit() { return DBL_DIG; }
88 ARCCORE_HOST_DEVICE static constexpr double epsilon() { return DBL_EPSILON; }
89 ARCCORE_HOST_DEVICE static constexpr double nearlyEpsilon() { return DBL_EPSILON*10.0; }
90 ARCCORE_HOST_DEVICE static constexpr double maxValue() { return DBL_MAX; }
91 ARCCORE_HOST_DEVICE static constexpr double zero() { return 0.0; }
92};
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
102template<>
104{
105 public:
108 public:
109 ARCCORE_HOST_DEVICE static constexpr unsigned int precision() { return 3; }
110 ARCCORE_HOST_DEVICE static constexpr unsigned int maxDigit() { return LDBL_DIG; }
111 ARCCORE_HOST_DEVICE static constexpr long double epsilon() { return LDBL_EPSILON; }
112 ARCCORE_HOST_DEVICE static constexpr long double nearlyEpsilon() { return LDBL_EPSILON*10.0; }
113 ARCCORE_HOST_DEVICE static constexpr long double maxValue() { return LDBL_MAX; }
114 ARCCORE_HOST_DEVICE static constexpr long double zero() { return 0.0l; }
115};
116
117#ifdef ARCANE_REAL_USE_APFLOAT
118/*---------------------------------------------------------------------------*/
119/*---------------------------------------------------------------------------*/
126template<>
127class FloatInfo<apfloat>
128{
129 public:
131 typedef TrueType _IsFloatType;
132 public:
133 ARCCORE_HOST_DEVICE static constexpr unsigned int precision() { return 3; }
134 ARCCORE_HOST_DEVICE static constexpr unsigned int maxDigit() { return 35; }
135 ARCCORE_HOST_DEVICE static constexpr apfloat epsilon() { return 1e-30; }
136 ARCCORE_HOST_DEVICE static constexpr apfloat nearlyEpsilon() { return 1e-28; }
137 ARCCORE_HOST_DEVICE static constexpr apfloat maxValue() { return apfloat("1e1000"); }
138 ARCCORE_HOST_DEVICE static constexpr apfloat zero() { return apfloat("0.0"); }
139};
140#endif
141
142/*---------------------------------------------------------------------------*/
143/*---------------------------------------------------------------------------*/
144
145} // End namespace Arcane
146
147/*---------------------------------------------------------------------------*/
148/*---------------------------------------------------------------------------*/
149
150#endif
TrueType _IsFloatType
Indique que l'instantiation est pour un type flottant.
Definition Limits.h:84
TrueType _IsFloatType
Indique que l'instantiation est pour un type flottant.
Definition Limits.h:64
TrueType _IsFloatType
Indique que l'instantiation est pour un type flottant.
Definition Limits.h:107
Informations sur le type flottant.
Definition Limits.h:48
FalseType _IsFloatType
Indique si l'instantiation est pour un type flottant.
Definition Limits.h:51
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Structure équivalente à la valeur booléenne vrai.
Structure équivalente à la valeur booléenne vrai.