Merge pull request #22 from tboudreaux/fix/exp10-libc++

fix(helm.cpp): exp10(x) changed to pow(10, x)
This commit is contained in:
2025-03-13 14:16:37 -04:00
committed by GitHub

View File

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