Skip to content
This repository has been archived by the owner on Nov 14, 2023. It is now read-only.

fix double to float conversion #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions butteraugli/butteraugli.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ struct RationalPolynomial {
}

// Evaluates the polynomial at x (in [min_value, max_value]).
inline double operator()(const float x) const {
inline double operator()(const double x) const {
// First normalize to [0, 1].
const double x01 = (x - min_value) / (max_value - min_value);
// And then to [-1, 1] domain of Chebyshev polynomials.
Expand All @@ -527,7 +527,7 @@ struct RationalPolynomial {
const double yp = EvaluatePolynomial(xc, p);
const double yq = EvaluatePolynomial(xc, q);
if (yq == 0.0) return 0.0;
return static_cast<float>(yp / yq);
return yp / yq;
}

// Domain of the polynomials; they are undefined elsewhere.
Expand All @@ -540,7 +540,7 @@ struct RationalPolynomial {
double q[5 + 1];
};

static inline float GammaPolynomial(float value) {
static inline double GammaPolynomial(double value) {
// Generated by gamma_polynomial.m from equispaced x/gamma(x) samples.
static const RationalPolynomial r = {
0.770000000000000, 274.579999999999984,
Expand Down