| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14464 |
\[\frac{1 + \left(v \cdot v\right) \cdot -5}{\sqrt{2 + 2 \cdot \left(\left(v \cdot v\right) \cdot -3\right)} \cdot \left(\left(t \cdot \pi\right) \cdot \left(1 - v \cdot v\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 (/ (/ (+ -1.0 (* 5.0 (* v v))) (sqrt (fma v (* v -6.0) 2.0))) (* (* t PI) (+ -1.0 (* v v)))))
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 ((-1.0 + (5.0 * (v * v))) / sqrt(fma(v, (v * -6.0), 2.0))) / ((t * ((double) M_PI)) * (-1.0 + (v * v)));
}
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(-1.0 + Float64(5.0 * Float64(v * v))) / sqrt(fma(v, Float64(v * -6.0), 2.0))) / Float64(Float64(t * pi) * Float64(-1.0 + Float64(v * v)))) 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[(-1.0 + N[(5.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(v * N[(v * -6.0), $MachinePrecision] + 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(t * Pi), $MachinePrecision] * N[(-1.0 + N[(v * v), $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{-1 + 5 \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \pi\right) \cdot \left(-1 + v \cdot v\right)}
Initial program 0.4
Simplified0.4
[Start]0.4 | \[ \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.4 | \[ \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)}
\] |
+-commutative [=>]0.4 | \[ \frac{\color{blue}{\left(-5\right) \cdot \left(v \cdot v\right) + 1}}{\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)}
\] |
*-commutative [=>]0.4 | \[ \frac{\color{blue}{\left(v \cdot v\right) \cdot \left(-5\right)} + 1}{\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)}
\] |
fma-def [=>]0.4 | \[ \frac{\color{blue}{\mathsf{fma}\left(v \cdot v, -5, 1\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.4 | \[ \frac{\mathsf{fma}\left(v \cdot v, \color{blue}{-5}, 1\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)}
\] |
associate-*l* [=>]0.4 | \[ \frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\color{blue}{\left(\pi \cdot \left(t \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right)\right)} \cdot \left(1 - v \cdot v\right)}
\] |
associate-*l* [=>]0.4 | \[ \frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\color{blue}{\pi \cdot \left(\left(t \cdot \sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)}\right) \cdot \left(1 - v \cdot v\right)\right)}}
\] |
*-commutative [=>]0.4 | \[ \frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\pi \cdot \left(\color{blue}{\left(\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot t\right)} \cdot \left(1 - v \cdot v\right)\right)}
\] |
associate-*l* [=>]0.4 | \[ \frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\pi \cdot \color{blue}{\left(\sqrt{2 \cdot \left(1 - 3 \cdot \left(v \cdot v\right)\right)} \cdot \left(t \cdot \left(1 - v \cdot v\right)\right)\right)}}
\] |
Applied egg-rr0.4
Simplified0.4
[Start]0.4 | \[ \left(-1 - v \cdot \left(v \cdot -5\right)\right) \cdot \frac{1}{\left(\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)} \cdot \left(t \cdot \left(1 - v \cdot v\right)\right)\right) \cdot \left(-\pi\right)}
\] |
|---|---|
*-commutative [=>]0.4 | \[ \color{blue}{\frac{1}{\left(\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)} \cdot \left(t \cdot \left(1 - v \cdot v\right)\right)\right) \cdot \left(-\pi\right)} \cdot \left(-1 - v \cdot \left(v \cdot -5\right)\right)}
\] |
associate-*l/ [=>]0.4 | \[ \color{blue}{\frac{1 \cdot \left(-1 - v \cdot \left(v \cdot -5\right)\right)}{\left(\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)} \cdot \left(t \cdot \left(1 - v \cdot v\right)\right)\right) \cdot \left(-\pi\right)}}
\] |
associate-*l* [=>]0.4 | \[ \frac{1 \cdot \left(-1 - v \cdot \left(v \cdot -5\right)\right)}{\color{blue}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)} \cdot \left(\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)\right)}}
\] |
associate-/r* [=>]0.4 | \[ \color{blue}{\frac{\frac{1 \cdot \left(-1 - v \cdot \left(v \cdot -5\right)\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}}
\] |
*-lft-identity [=>]0.4 | \[ \frac{\frac{\color{blue}{-1 - v \cdot \left(v \cdot -5\right)}}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}
\] |
associate-*r* [=>]0.4 | \[ \frac{\frac{-1 - \color{blue}{\left(v \cdot v\right) \cdot -5}}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}
\] |
*-commutative [<=]0.4 | \[ \frac{\frac{-1 - \color{blue}{-5 \cdot \left(v \cdot v\right)}}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}
\] |
cancel-sign-sub-inv [=>]0.4 | \[ \frac{\frac{\color{blue}{-1 + \left(--5\right) \cdot \left(v \cdot v\right)}}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}
\] |
metadata-eval [=>]0.4 | \[ \frac{\frac{-1 + \color{blue}{5} \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \left(1 - v \cdot v\right)\right) \cdot \left(-\pi\right)}
\] |
associate-*l* [=>]0.4 | \[ \frac{\frac{-1 + 5 \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\color{blue}{t \cdot \left(\left(1 - v \cdot v\right) \cdot \left(-\pi\right)\right)}}
\] |
Taylor expanded in v around 0 0.4
Simplified0.4
[Start]0.4 | \[ \frac{\frac{-1 + 5 \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{{v}^{2} \cdot \left(t \cdot \pi\right) + -1 \cdot \left(t \cdot \pi\right)}
\] |
|---|---|
distribute-rgt-out [=>]0.4 | \[ \frac{\frac{-1 + 5 \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\color{blue}{\left(t \cdot \pi\right) \cdot \left({v}^{2} + -1\right)}}
\] |
unpow2 [=>]0.4 | \[ \frac{\frac{-1 + 5 \cdot \left(v \cdot v\right)}{\sqrt{\mathsf{fma}\left(v, v \cdot -6, 2\right)}}}{\left(t \cdot \pi\right) \cdot \left(\color{blue}{v \cdot v} + -1\right)}
\] |
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 14464 |
| Alternative 2 | |
|---|---|
| Error | 1.0 |
| Cost | 13312 |
| Alternative 3 | |
|---|---|
| Error | 1.1 |
| Cost | 13184 |
| Alternative 4 | |
|---|---|
| Error | 1.0 |
| Cost | 13184 |
| Alternative 5 | |
|---|---|
| Error | 1.4 |
| Cost | 13056 |
| Alternative 6 | |
|---|---|
| Error | 1.3 |
| Cost | 13056 |
herbie shell --seed 2023012
(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)))))