[apps] Operations in double when precision required

Change-Id: I7168a861a76178f0bf81841e9378f7399f67914a
This commit is contained in:
Émilie Feral
2017-08-04 18:24:09 +02:00
parent 82e212e771
commit f0a776a670
82 changed files with 494 additions and 463 deletions

View File

@@ -12,12 +12,12 @@ FloatPairStore::FloatPairStore() :
{
}
float FloatPairStore::get(int i, int j) {
double FloatPairStore::get(int i, int j) {
assert(j < m_numberOfPairs);
return m_data[i][j];
}
void FloatPairStore::set(float f, int i, int j) {
void FloatPairStore::set(double f, int i, int j) {
if (j >= k_maxNumberOfPairs) {
return;
}
@@ -51,8 +51,8 @@ void FloatPairStore::resetColumn(int i) {
}
}
float FloatPairStore::sumOfColumn(int i) {
float result = 0;
double FloatPairStore::sumOfColumn(int i) {
double result = 0;
for (int k = 0; k < m_numberOfPairs; k++) {
result += m_data[i][k];
}
@@ -60,13 +60,13 @@ float FloatPairStore::sumOfColumn(int i) {
}
uint32_t FloatPairStore::storeChecksum() {
size_t dataLengthInBytes = k_maxNumberOfPairs*2*sizeof(float);
size_t dataLengthInBytes = k_maxNumberOfPairs*2*sizeof(double);
assert((dataLengthInBytes & 0x3) == 0); // Assert that dataLengthInBytes is a multiple of 4
return Ion::crc32((uint32_t *)m_data, dataLengthInBytes>>2);
}
float FloatPairStore::defaultValue(int i) {
return 0.0f;
double FloatPairStore::defaultValue(int i) {
return 0.0;
}
}