| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 33160 |
(FPCore (F B x) :precision binary64 (+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))
(FPCore (F B x)
:precision binary64
(let* ((t_0 (/ x (tan B))))
(if (<= F -1.5e+154)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 5000000.0)
(- (/ (/ -1.0 (/ (sqrt (fma x 2.0 (fma F F 2.0))) F)) (- (sin B))) t_0)
(- (/ 1.0 (sin B)) t_0)))))double code(double F, double B, double x) {
return -(x * (1.0 / tan(B))) + ((F / sin(B)) * pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
double code(double F, double B, double x) {
double t_0 = x / tan(B);
double tmp;
if (F <= -1.5e+154) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 5000000.0) {
tmp = ((-1.0 / (sqrt(fma(x, 2.0, fma(F, F, 2.0))) / F)) / -sin(B)) - t_0;
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
function code(F, B, x) return Float64(Float64(-Float64(x * Float64(1.0 / tan(B)))) + Float64(Float64(F / sin(B)) * (Float64(Float64(Float64(F * F) + 2.0) + Float64(2.0 * x)) ^ Float64(-Float64(1.0 / 2.0))))) end
function code(F, B, x) t_0 = Float64(x / tan(B)) tmp = 0.0 if (F <= -1.5e+154) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 5000000.0) tmp = Float64(Float64(Float64(-1.0 / Float64(sqrt(fma(x, 2.0, fma(F, F, 2.0))) / F)) / Float64(-sin(B))) - t_0); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
code[F_, B_, x_] := N[((-N[(x * N[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) + N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + N[(2.0 * x), $MachinePrecision]), $MachinePrecision], (-N[(1.0 / 2.0), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[F_, B_, x_] := Block[{t$95$0 = N[(x / N[Tan[B], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -1.5e+154], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 5000000.0], N[(N[(N[(-1.0 / N[(N[Sqrt[N[(x * 2.0 + N[(F * F + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / F), $MachinePrecision]), $MachinePrecision] / (-N[Sin[B], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[(1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]]]]
\left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\begin{array}{l}
t_0 := \frac{x}{\tan B}\\
\mathbf{if}\;F \leq -1.5 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\
\mathbf{elif}\;F \leq 5000000:\\
\;\;\;\;\frac{\frac{-1}{\frac{\sqrt{\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)}}{F}}}{-\sin B} - t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t_0\\
\end{array}
if F < -1.50000000000000013e154Initial program 39.7
Simplified39.6
[Start]39.7 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
+-commutative [=>]39.7 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)}
\] |
unsub-neg [=>]39.7 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}}
\] |
+-commutative [=>]39.7 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(2 \cdot x + \left(F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
*-commutative [=>]39.7 | \[ \frac{F}{\sin B} \cdot {\left(\color{blue}{x \cdot 2} + \left(F \cdot F + 2\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(\mathsf{fma}\left(x, 2, F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{0.5}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{-0.5}} - x \cdot \frac{1}{\tan B}
\] |
associate-*r/ [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \color{blue}{\frac{x \cdot 1}{\tan B}}
\] |
*-rgt-identity [=>]39.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{\color{blue}{x}}{\tan B}
\] |
Taylor expanded in F around -inf 0.2
if -1.50000000000000013e154 < F < 5e6Initial program 1.7
Simplified1.6
[Start]1.7 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
+-commutative [=>]1.7 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)}
\] |
unsub-neg [=>]1.7 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}}
\] |
+-commutative [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(2 \cdot x + \left(F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
*-commutative [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\left(\color{blue}{x \cdot 2} + \left(F \cdot F + 2\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(\mathsf{fma}\left(x, 2, F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{0.5}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]1.7 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{-0.5}} - x \cdot \frac{1}{\tan B}
\] |
associate-*r/ [=>]1.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \color{blue}{\frac{x \cdot 1}{\tan B}}
\] |
*-rgt-identity [=>]1.6 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{\color{blue}{x}}{\tan B}
\] |
Applied egg-rr0.3
Applied egg-rr0.3
Applied egg-rr0.3
if 5e6 < F Initial program 25.5
Simplified25.5
[Start]25.5 | \[ \left(-x \cdot \frac{1}{\tan B}\right) + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}
\] |
|---|---|
+-commutative [=>]25.5 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \left(-x \cdot \frac{1}{\tan B}\right)}
\] |
unsub-neg [=>]25.5 | \[ \color{blue}{\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}}
\] |
+-commutative [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(2 \cdot x + \left(F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
*-commutative [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\color{blue}{x \cdot 2} + \left(F \cdot F + 2\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\color{blue}{\left(\mathsf{fma}\left(x, 2, F \cdot F + 2\right)\right)}}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
fma-def [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \color{blue}{\mathsf{fma}\left(F, F, 2\right)}\right)\right)}^{\left(-\frac{1}{2}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\left(-\color{blue}{0.5}\right)} - x \cdot \frac{1}{\tan B}
\] |
metadata-eval [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{\color{blue}{-0.5}} - x \cdot \frac{1}{\tan B}
\] |
associate-*r/ [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \color{blue}{\frac{x \cdot 1}{\tan B}}
\] |
*-rgt-identity [=>]25.5 | \[ \frac{F}{\sin B} \cdot {\left(\mathsf{fma}\left(x, 2, \mathsf{fma}\left(F, F, 2\right)\right)\right)}^{-0.5} - \frac{\color{blue}{x}}{\tan B}
\] |
Taylor expanded in F around inf 0.1
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 33160 |
| Alternative 2 | |
|---|---|
| Error | 0.3 |
| Cost | 33096 |
| Alternative 3 | |
|---|---|
| Error | 0.6 |
| Cost | 20680 |
| Alternative 4 | |
|---|---|
| Error | 0.3 |
| Cost | 20616 |
| Alternative 5 | |
|---|---|
| Error | 0.6 |
| Cost | 20424 |
| Alternative 6 | |
|---|---|
| Error | 0.6 |
| Cost | 20424 |
| Alternative 7 | |
|---|---|
| Error | 0.6 |
| Cost | 20040 |
| Alternative 8 | |
|---|---|
| Error | 7.4 |
| Cost | 14480 |
| Alternative 9 | |
|---|---|
| Error | 7.9 |
| Cost | 14288 |
| Alternative 10 | |
|---|---|
| Error | 7.6 |
| Cost | 14288 |
| Alternative 11 | |
|---|---|
| Error | 10.3 |
| Cost | 14040 |
| Alternative 12 | |
|---|---|
| Error | 10.4 |
| Cost | 14040 |
| Alternative 13 | |
|---|---|
| Error | 26.0 |
| Cost | 13912 |
| Alternative 14 | |
|---|---|
| Error | 15.8 |
| Cost | 13912 |
| Alternative 15 | |
|---|---|
| Error | 21.6 |
| Cost | 13780 |
| Alternative 16 | |
|---|---|
| Error | 21.6 |
| Cost | 13780 |
| Alternative 17 | |
|---|---|
| Error | 30.9 |
| Cost | 8036 |
| Alternative 18 | |
|---|---|
| Error | 30.6 |
| Cost | 7774 |
| Alternative 19 | |
|---|---|
| Error | 28.0 |
| Cost | 7244 |
| Alternative 20 | |
|---|---|
| Error | 35.9 |
| Cost | 6988 |
| Alternative 21 | |
|---|---|
| Error | 38.5 |
| Cost | 6856 |
| Alternative 22 | |
|---|---|
| Error | 40.2 |
| Cost | 1608 |
| Alternative 23 | |
|---|---|
| Error | 40.2 |
| Cost | 1224 |
| Alternative 24 | |
|---|---|
| Error | 45.3 |
| Cost | 964 |
| Alternative 25 | |
|---|---|
| Error | 45.2 |
| Cost | 580 |
| Alternative 26 | |
|---|---|
| Error | 49.0 |
| Cost | 521 |
| Alternative 27 | |
|---|---|
| Error | 45.2 |
| Cost | 452 |
| Alternative 28 | |
|---|---|
| Error | 57.2 |
| Cost | 192 |
herbie shell --seed 2022356
(FPCore (F B x)
:name "VandenBroeck and Keller, Equation (23)"
:precision binary64
(+ (- (* x (/ 1.0 (tan B)))) (* (/ F (sin B)) (pow (+ (+ (* F F) 2.0) (* 2.0 x)) (- (/ 1.0 2.0))))))