Commit e1fe0eed authored by Stefan Westerfeld's avatar Stefan Westerfeld

Slight improvements to QInterpolator accuracy.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 93da5ebd
...@@ -302,14 +302,14 @@ class QInterpolator // quadratic interpolation between three data values ...@@ -302,14 +302,14 @@ class QInterpolator // quadratic interpolation between three data values
public: public:
QInterpolator (double y1, double y2, double y3) QInterpolator (double y1, double y2, double y3)
{ {
a = (y1 + y3 - 2*y2) / 2; a = (y1 + y3) / 2 - y2;
b = (y3 - y1) / 2; b = (y3 - y1) / 2;
c = y2; c = y2;
} }
double double
eval (double x) eval (double x)
{ {
return a * x * x + b * x + c; return ((a * x) + b) * x + c;
} }
double double
x_max() x_max()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment