Skip to content

consider switch to expm1 #34

Description

@tcaduser

For your Bernoulli function

inline double bern ( double x )

The C++ math libraries, have an expm1 function that is easier to use when calculating exp(x)-1.

Please see:
https://en.cppreference.com/w/cpp/numeric/math/expm1

So that the Bernoulli function can be something like this:

y = expm1(x);
if (y != x)
{
    bern = x / expm(x);
}
else
{
    bern = 1.0/(1.0 + 0.5*x);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions