14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/Math.h"
17#include "arcane/utils/ArrayView.h"
32 unsigned long long intVal;
33 explicit DoubleInt(
const double x) : dblVal(x) {}
37int digit_to_bits[] = { 0, 0, 0, 0, 0, 0, 0, 0, 41, 31, 26, 21, 16, 12, 11 };
39inline double _doTruncate(
double x,
unsigned int numDiscardBits)
42 if (numDiscardBits>0){
43 unsigned long long halfBit = (1ULL << (numDiscardBits -1));
44 unsigned long long mantissaDiscardMask = ~(halfBit-1) ^ 0xfff0000000000000ULL;
45 unsigned long long test = num.intVal & mantissaDiscardMask;
46 num.intVal &= 0xfff0000000000000ULL;
48 if (test== 0x0010000000000000ULL){
52 num.intVal |= test & ~halfBit;
58inline double _doTruncateDigit(
double x,
int nb_digit)
66 int nb_bit = digit_to_bits[nb_digit];
69 return _doTruncate(x,nb_bit);
78truncateDouble(
double v,Integer nb_digit)
80 return _doTruncateDigit(v,nb_digit);
89 Integer n = values.
size();
96 for( Integer i=0; i<n; ++i )
97 values[i] = (
float)values[i];
102 int nb_bit = digit_to_bits[nb_digit];
105 for( Integer i=0; i<n; ++i )
106 values[i] = _doTruncate(values[i],nb_bit);
Vue modifiable d'un tableau d'un type T.
constexpr Integer size() const noexcept
Retourne la taille du tableau.