| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14336 |
\[\frac{1 + -5 \cdot \left(v \cdot v\right)}{t \cdot \left(\pi \cdot \left(\left(1 - v \cdot v\right) \cdot \sqrt{2 + \left(v \cdot v\right) \cdot -6}\right)\right)}
\]
(FPCore (v t) :precision binary64 (/ (- 1.0 (* 5.0 (* v v))) (* (* (* PI t) (sqrt (* 2.0 (- 1.0 (* 3.0 (* v v)))))) (- 1.0 (* v v)))))
(FPCore (v t) :precision binary64 (/ (/ (- (fma v (* v -5.0) 1.0)) PI) (* (* t (+ (* v v) -1.0)) (sqrt (+ 2.0 (* (* v v) -6.0))))))
double code(double v, double t) {
return (1.0 - (5.0 * (v * v))) / (((((double) M_PI) * t) * sqrt((2.0 * (1.0 - (3.0 * (v * v)))))) * (1.0 - (v * v)));
}
double code(double v, double t) {
return (-fma(v, (v * -5.0), 1.0) / ((double) M_PI)) / ((t * ((v * v) + -1.0)) * sqrt((2.0 + ((v * v) * -6.0))));
}
function code(v, t) return Float64(Float64(1.0 - Float64(5.0 * Float64(v * v))) / Float64(Float64(Float64(pi * t) * sqrt(Float64(2.0 * Float64(1.0 - Float64(3.0 * Float64(v * v)))))) * Float64(1.0 - Float64(v * v)))) end
function code(v, t) return Float64(Float64(Float64(-fma(v, Float64(v * -5.0), 1.0)) / pi) / Float64(Float64(t * Float64(Float64(v * v) + -1.0)) * sqrt(Float64(2.0 + Float64(Float64(v * v) * -6.0))))) end
code[v_, t_] := N[(N[(1.0 - N[(5.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(Pi * t), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(1.0 - N[(3.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[v_, t_] := N[(N[((-N[(v * N[(v * -5.0), $MachinePrecision] + 1.0), $MachinePrecision]) / Pi), $MachinePrecision] / N[(N[(t * N[(N[(v * v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(2.0 + N[(N[(v * v), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1 - 5 \cdot \left(v \cdot v\right)}{\left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(1 - v \cdot v\right)}
\frac{\frac{-\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\pi}}{\left(t \cdot \left(v \cdot v + -1\right)\right) \cdot \sqrt{2 + \left(v \cdot v\right) \cdot -6}}
Initial program 0.5
Simplified0.5
[Start]0.5 | \[ \frac{1 - 5 \cdot \left(v \cdot v\right)}{\left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(1 - v \cdot v\right)}
\] |
|---|---|
cancel-sign-sub-inv [=>]0.5 | \[ \frac{\color{blue}{1 + \left(-5\right) \cdot \left(v \cdot v\right)}}{\left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(1 - v \cdot v\right)}
\] |
metadata-eval [=>]0.5 | \[ \frac{1 + \color{blue}{-5} \cdot \left(v \cdot v\right)}{\left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(1 - v \cdot v\right)}
\] |
distribute-rgt-out-- [<=]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\color{blue}{1 \cdot \left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) - \left(v \cdot v\right) \cdot \left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right)}}
\] |
*-lft-identity [=>]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\color{blue}{\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}} - \left(v \cdot v\right) \cdot \left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right)}
\] |
*-commutative [=>]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\color{blue}{\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot \left(\pi \cdot t\right)} - \left(v \cdot v\right) \cdot \left(\left(\pi \cdot t\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right)}
\] |
*-commutative [=>]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot \left(\pi \cdot t\right) - \left(v \cdot v\right) \cdot \color{blue}{\left(\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot \left(\pi \cdot t\right)\right)}}
\] |
associate-*r* [=>]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot \left(\pi \cdot t\right) - \color{blue}{\left(\left(v \cdot v\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(\pi \cdot t\right)}}
\] |
distribute-rgt-out-- [=>]0.5 | \[ \frac{1 + -5 \cdot \left(v \cdot v\right)}{\color{blue}{\left(\pi \cdot t\right) \cdot \left(\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} - \left(v \cdot v\right) \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right)}}
\] |
Applied egg-rr0.5
Simplified0.3
[Start]0.5 | \[ \left(-1 - v \cdot \left(v \cdot -5\right)\right) \cdot \frac{1}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
|---|---|
associate-*r/ [=>]0.5 | \[ \color{blue}{\frac{\left(-1 - v \cdot \left(v \cdot -5\right)\right) \cdot 1}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}}
\] |
*-rgt-identity [=>]0.5 | \[ \frac{\color{blue}{-1 - v \cdot \left(v \cdot -5\right)}}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
sub-neg [=>]0.5 | \[ \frac{\color{blue}{-1 + \left(-v \cdot \left(v \cdot -5\right)\right)}}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
metadata-eval [<=]0.5 | \[ \frac{\color{blue}{\left(-1\right)} + \left(-v \cdot \left(v \cdot -5\right)\right)}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
distribute-neg-in [<=]0.5 | \[ \frac{\color{blue}{-\left(1 + v \cdot \left(v \cdot -5\right)\right)}}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
+-commutative [=>]0.5 | \[ \frac{-\color{blue}{\left(v \cdot \left(v \cdot -5\right) + 1\right)}}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
associate-*r* [=>]0.5 | \[ \frac{-\left(\color{blue}{\left(v \cdot v\right) \cdot -5} + 1\right)}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
unpow2 [<=]0.5 | \[ \frac{-\left(\color{blue}{{v}^{2}} \cdot -5 + 1\right)}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
fma-udef [<=]0.5 | \[ \frac{-\color{blue}{\mathsf{fma}\left({v}^{2}, -5, 1\right)}}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
unpow2 [=>]0.5 | \[ \frac{-\mathsf{fma}\left(\color{blue}{v \cdot v}, -5, 1\right)}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}
\] |
distribute-frac-neg [=>]0.5 | \[ \color{blue}{-\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\pi \cdot \left(-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)\right)}}
\] |
associate-/r* [=>]0.3 | \[ -\color{blue}{\frac{\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\pi}}{-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)}}
\] |
distribute-neg-frac [=>]0.3 | \[ \color{blue}{\frac{-\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\pi}}{-t \cdot \left(\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(1 - v \cdot v\right)\right)}}
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14336 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 13184 |
| Alternative 3 | |
|---|---|
| Error | 1.0 |
| Cost | 13184 |
| Alternative 4 | |
|---|---|
| Error | 0.7 |
| Cost | 13184 |
| Alternative 5 | |
|---|---|
| Error | 1.3 |
| Cost | 13056 |
| Alternative 6 | |
|---|---|
| Error | 1.3 |
| Cost | 13056 |
herbie shell --seed 2023046
(FPCore (v t)
:name "Falkner and Boettcher, Equation (20:1,3)"
:precision binary64
(/ (- 1.0 (* 5.0 (* v v))) (* (* (* PI t) (sqrt (* 2.0 (- 1.0 (* 3.0 (* v v)))))) (- 1.0 (* v v)))))