fix(helm.cpp): exp10(x) changed to pow(10, x)

epx10 is a extension to the c++ standard library from glibc which is not in libc. To provide support for llvm compilers alonw with gcc I have changed all calls to exp10(x) to pow(10, x).
This commit is contained in:
2025-03-13 14:08:21 -04:00
parent bb0ec4d341
commit cd32394d37

View File

@@ -10,6 +10,7 @@
#include <stdexcept>
#include <array>
#include <numbers>
#include <cerrno>
#include "helm.h"
@@ -111,14 +112,15 @@ namespace helmholtz {
int i, j;
//set T and Rho (d) arrays
for (j=0; j<table.jmax; j++) { table.t[j] = exp10(tlo + tstp*j); }
for (j=0; j<table.jmax; j++) { table.t[j] = pow(10, tlo + tstp*j); }
for (i=0; i<table.imax; i++) { table.d[i] = exp10(dlo + dstp*i); }
for (i=0; i<table.imax; i++) { table.d[i] = pow(10, dlo + dstp*i); }
ifstream helm_table(filename);
if (!helm_table) {
LOG_ERROR(logger, "read_helm_table : Error opening file {}", filename);
throw std::runtime_error("Error opening file " + filename);
int errorCode = errno;
LOG_ERROR(logger, "read_helm_table : Error ({}) opening file {}", errorCode, filename);
throw std::runtime_error("Error (" + std::to_string(errorCode) + ") opening file " + filename);
}
//read the Helmholtz free energy and its derivatives
for (j=0; j<table.jmax; j++) {
@@ -820,4 +822,4 @@ namespace helmholtz {
return eos;
// TODO: In future this might be made more preformant by avoiding the copy.
}
}
}