ComputationalPhysiology / modelparameters

Library for declaring nested parameteres in Python
https://computationalphysiology.github.io/modelparameters/
GNU Lesser General Public License v3.0
0 stars 0 forks source link

C/C++: Use single-precision variants of math functions when appropriate #1

Closed KGHustad closed 3 years ago

KGHustad commented 3 years ago

This PR fixes a number of issues with generating single-precision code. The issues fall into two main categories:

I used https://en.wikipedia.org/wiki/C_mathematical_functions for an exhaustive list of math functions in C and filtered out those without single-precision variants.

Additionally, I have added a special case to rewrite (exp(a) - 1) as (expm1(a)) to increase the precision when this expression is near zero.