| Alternative 1 | |
|---|---|
| Accuracy | 91.7% |
| Cost | 10704 |
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- y z) (/ (- t x) (- a z)) x))
(t_2 (+ x (* (- z y) (/ (- x t) (- a z)))))
(t_3 (* (- y z) (- t x))))
(if (<= t_2 (- INFINITY))
(fma (sqrt x) (sqrt x) (/ t_3 (- a z)))
(if (<= t_2 -5e-294)
t_1
(if (<= t_2 1e-272)
(+ t (/ (- x t) (/ z (- y a))))
(if (<= t_2 1e-94) (+ x (* (/ 1.0 (- a z)) t_3)) t_1))))))double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((y - z), ((t - x) / (a - z)), x);
double t_2 = x + ((z - y) * ((x - t) / (a - z)));
double t_3 = (y - z) * (t - x);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(sqrt(x), sqrt(x), (t_3 / (a - z)));
} else if (t_2 <= -5e-294) {
tmp = t_1;
} else if (t_2 <= 1e-272) {
tmp = t + ((x - t) / (z / (y - a)));
} else if (t_2 <= 1e-94) {
tmp = x + ((1.0 / (a - z)) * t_3);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function code(x, y, z, t, a) t_1 = fma(Float64(y - z), Float64(Float64(t - x) / Float64(a - z)), x) t_2 = Float64(x + Float64(Float64(z - y) * Float64(Float64(x - t) / Float64(a - z)))) t_3 = Float64(Float64(y - z) * Float64(t - x)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = fma(sqrt(x), sqrt(x), Float64(t_3 / Float64(a - z))); elseif (t_2 <= -5e-294) tmp = t_1; elseif (t_2 <= 1e-272) tmp = Float64(t + Float64(Float64(x - t) / Float64(z / Float64(y - a)))); elseif (t_2 <= 1e-94) tmp = Float64(x + Float64(Float64(1.0 / Float64(a - z)) * t_3)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(z - y), $MachinePrecision] * N[(N[(x - t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[Sqrt[x], $MachinePrecision] * N[Sqrt[x], $MachinePrecision] + N[(t$95$3 / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e-294], t$95$1, If[LessEqual[t$95$2, 1e-272], N[(t + N[(N[(x - t), $MachinePrecision] / N[(z / N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-94], N[(x + N[(N[(1.0 / N[(a - z), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)\\
t_2 := x + \left(z - y\right) \cdot \frac{x - t}{a - z}\\
t_3 := \left(y - z\right) \cdot \left(t - x\right)\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{t_3}{a - z}\right)\\
\mathbf{elif}\;t_2 \leq -5 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 10^{-272}:\\
\;\;\;\;t + \frac{x - t}{\frac{z}{y - a}}\\
\mathbf{elif}\;t_2 \leq 10^{-94}:\\
\;\;\;\;x + \frac{1}{a - z} \cdot t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -inf.0Initial program 0.0%
Simplified86.2%
[Start]0.0 | \[ x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\] |
|---|---|
associate-*r/ [=>]86.2 | \[ x + \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}}
\] |
Applied egg-rr41.1%
[Start]86.2 | \[ x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\] |
|---|---|
add-sqr-sqrt [=>]41.0 | \[ \color{blue}{\sqrt{x} \cdot \sqrt{x}} + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\] |
fma-def [=>]41.2 | \[ \color{blue}{\mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\right)}
\] |
*-commutative [=>]41.2 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{\color{blue}{\left(t - x\right) \cdot \left(y - z\right)}}{a - z}\right)
\] |
*-un-lft-identity [=>]41.2 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{\left(t - x\right) \cdot \left(y - z\right)}{\color{blue}{1 \cdot \left(a - z\right)}}\right)
\] |
times-frac [=>]41.1 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \color{blue}{\frac{t - x}{1} \cdot \frac{y - z}{a - z}}\right)
\] |
flip-- [=>]5.3 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{\color{blue}{\frac{t \cdot t - x \cdot x}{t + x}}}{1} \cdot \frac{y - z}{a - z}\right)
\] |
associate-/l/ [=>]5.3 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \color{blue}{\frac{t \cdot t - x \cdot x}{1 \cdot \left(t + x\right)}} \cdot \frac{y - z}{a - z}\right)
\] |
*-un-lft-identity [<=]5.3 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \frac{t \cdot t - x \cdot x}{\color{blue}{t + x}} \cdot \frac{y - z}{a - z}\right)
\] |
flip-- [<=]41.1 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \color{blue}{\left(t - x\right)} \cdot \frac{y - z}{a - z}\right)
\] |
Simplified41.2%
[Start]41.1 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \left(t - x\right) \cdot \frac{y - z}{a - z}\right)
\] |
|---|---|
associate-*r/ [=>]41.2 | \[ \mathsf{fma}\left(\sqrt{x}, \sqrt{x}, \color{blue}{\frac{\left(t - x\right) \cdot \left(y - z\right)}{a - z}}\right)
\] |
if -inf.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.0000000000000003e-294 or 9.9999999999999996e-95 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.9%
Simplified91.9%
[Start]91.9 | \[ x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\] |
|---|---|
+-commutative [=>]91.9 | \[ \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x}
\] |
fma-def [=>]91.9 | \[ \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}
\] |
if -5.0000000000000003e-294 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999993e-273Initial program 6.5%
Simplified7.0%
[Start]6.5 | \[ x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\] |
|---|---|
+-commutative [=>]6.5 | \[ \color{blue}{\left(y - z\right) \cdot \frac{t - x}{a - z} + x}
\] |
fma-def [=>]7.0 | \[ \color{blue}{\mathsf{fma}\left(y - z, \frac{t - x}{a - z}, x\right)}
\] |
Taylor expanded in z around -inf 79.9%
Simplified93.7%
[Start]79.9 | \[ -1 \cdot \frac{-1 \cdot \left(a \cdot \left(t - x\right)\right) + y \cdot \left(t - x\right)}{z} + t
\] |
|---|---|
+-commutative [=>]79.9 | \[ \color{blue}{t + -1 \cdot \frac{-1 \cdot \left(a \cdot \left(t - x\right)\right) + y \cdot \left(t - x\right)}{z}}
\] |
mul-1-neg [=>]79.9 | \[ t + \color{blue}{\left(-\frac{-1 \cdot \left(a \cdot \left(t - x\right)\right) + y \cdot \left(t - x\right)}{z}\right)}
\] |
unsub-neg [=>]79.9 | \[ \color{blue}{t - \frac{-1 \cdot \left(a \cdot \left(t - x\right)\right) + y \cdot \left(t - x\right)}{z}}
\] |
associate-*r* [=>]79.9 | \[ t - \frac{\color{blue}{\left(-1 \cdot a\right) \cdot \left(t - x\right)} + y \cdot \left(t - x\right)}{z}
\] |
distribute-rgt-out [=>]79.9 | \[ t - \frac{\color{blue}{\left(t - x\right) \cdot \left(-1 \cdot a + y\right)}}{z}
\] |
associate-/l* [=>]93.7 | \[ t - \color{blue}{\frac{t - x}{\frac{z}{-1 \cdot a + y}}}
\] |
+-commutative [=>]93.7 | \[ t - \frac{t - x}{\frac{z}{\color{blue}{y + -1 \cdot a}}}
\] |
mul-1-neg [=>]93.7 | \[ t - \frac{t - x}{\frac{z}{y + \color{blue}{\left(-a\right)}}}
\] |
if 9.9999999999999993e-273 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 9.9999999999999996e-95Initial program 70.9%
Simplified86.5%
[Start]70.9 | \[ x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\] |
|---|---|
associate-*r/ [=>]86.5 | \[ x + \color{blue}{\frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}}
\] |
Applied egg-rr86.3%
[Start]86.5 | \[ x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\] |
|---|---|
div-inv [=>]86.3 | \[ x + \color{blue}{\left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z}}
\] |
*-commutative [=>]86.3 | \[ x + \color{blue}{\frac{1}{a - z} \cdot \left(\left(y - z\right) \cdot \left(t - x\right)\right)}
\] |
Final simplification91.2%
| Alternative 1 | |
|---|---|
| Accuracy | 91.7% |
| Cost | 10704 |
| Alternative 2 | |
|---|---|
| Accuracy | 91.7% |
| Cost | 4560 |
| Alternative 3 | |
|---|---|
| Accuracy | 92.1% |
| Cost | 4432 |
| Alternative 4 | |
|---|---|
| Accuracy | 90.6% |
| Cost | 3533 |
| Alternative 5 | |
|---|---|
| Accuracy | 49.9% |
| Cost | 2033 |
| Alternative 6 | |
|---|---|
| Accuracy | 50.3% |
| Cost | 1900 |
| Alternative 7 | |
|---|---|
| Accuracy | 50.1% |
| Cost | 1900 |
| Alternative 8 | |
|---|---|
| Accuracy | 50.1% |
| Cost | 1900 |
| Alternative 9 | |
|---|---|
| Accuracy | 51.3% |
| Cost | 1764 |
| Alternative 10 | |
|---|---|
| Accuracy | 50.7% |
| Cost | 1636 |
| Alternative 11 | |
|---|---|
| Accuracy | 53.6% |
| Cost | 1636 |
| Alternative 12 | |
|---|---|
| Accuracy | 53.3% |
| Cost | 1636 |
| Alternative 13 | |
|---|---|
| Accuracy | 60.2% |
| Cost | 1368 |
| Alternative 14 | |
|---|---|
| Accuracy | 62.3% |
| Cost | 1368 |
| Alternative 15 | |
|---|---|
| Accuracy | 63.0% |
| Cost | 1368 |
| Alternative 16 | |
|---|---|
| Accuracy | 45.1% |
| Cost | 1116 |
| Alternative 17 | |
|---|---|
| Accuracy | 45.2% |
| Cost | 1116 |
| Alternative 18 | |
|---|---|
| Accuracy | 69.3% |
| Cost | 1104 |
| Alternative 19 | |
|---|---|
| Accuracy | 69.0% |
| Cost | 1104 |
| Alternative 20 | |
|---|---|
| Accuracy | 77.1% |
| Cost | 1100 |
| Alternative 21 | |
|---|---|
| Accuracy | 78.1% |
| Cost | 1100 |
| Alternative 22 | |
|---|---|
| Accuracy | 77.7% |
| Cost | 969 |
| Alternative 23 | |
|---|---|
| Accuracy | 43.9% |
| Cost | 844 |
| Alternative 24 | |
|---|---|
| Accuracy | 44.4% |
| Cost | 328 |
| Alternative 25 | |
|---|---|
| Accuracy | 29.5% |
| Cost | 64 |
herbie shell --seed 2023135
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))