Mercurial > octave
diff libinterp/corefcn/__gammainc__.cc @ 32626:395ab2ffb0c2
maint: Use constexpr where possible for performance.
* libinterp/corefcn/__betainc__.cc, libinterp/corefcn/__expint__.cc,
libinterp/corefcn/__gammainc__.cc, libinterp/corefcn/dlmread.cc,
libinterp/corefcn/gl2ps-print.cc, libinterp/corefcn/graphics.cc,
libinterp/corefcn/input.cc, libinterp/corefcn/oct-stream.cc,
libinterp/corefcn/quadcc.cc, libinterp/corefcn/xpow.cc,
libinterp/octave-value/ov-base-int.cc, libinterp/octave-value/ov-base.cc,
libinterp/octave-value/ov.cc, libinterp/operators/op-mi.cc,
liboctave/array/Array-base.cc, liboctave/array/Sparse.cc,
liboctave/array/idx-vector.cc, liboctave/numeric/lo-mappers.cc,
liboctave/util/oct-inttypes.cc, liboctave/util/oct-inttypes.h,
liboctave/util/oct-string.cc:
Use "static constexpr" rather than "static const" where possible so that
compiler may move some optimizations into compile stage, rather than runtime
initialization. Capitalize constant expression names.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 20 Dec 2023 20:02:42 -0800 |
parents | 597f3ee61a48 |
children | 4b601ca024d5 |
line wrap: on
line diff
--- a/libinterp/corefcn/__gammainc__.cc Wed Dec 20 18:24:41 2023 -0800 +++ b/libinterp/corefcn/__gammainc__.cc Wed Dec 20 20:02:42 2023 -0800 @@ -71,7 +71,7 @@ // Initialize variables used in algorithm static const float tiny = math::exp2 (-50.0f); - static const float eps = std::numeric_limits<float>::epsilon(); + static constexpr float eps = std::numeric_limits<float>::epsilon(); float y, Cj, Dj, bj, aj, Deltaj; int j, maxit; maxit = 200; @@ -126,7 +126,7 @@ // Initialize variables used in algorithm static const double tiny = math::exp2 (-100.0); - static const double eps = std::numeric_limits<double>::epsilon(); + static constexpr double eps = std::numeric_limits<double>::epsilon(); double y, Cj, Dj, bj, aj, Deltaj; int j, maxit; maxit = 200;