| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20744 |
(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 (/ 1.0 (tan B)))))
(if (<= F -3.95e+46)
(- (/ -1.0 (sin B)) t_0)
(if (<= F 5e+34)
(-
(* (/ F (sin B)) (pow (+ x (+ (+ (* F F) 2.0) x)) -0.5))
(/ (* (cos B) x) (sin B)))
(- (/ 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 * (1.0 / tan(B));
double tmp;
if (F <= -3.95e+46) {
tmp = (-1.0 / sin(B)) - t_0;
} else if (F <= 5e+34) {
tmp = ((F / sin(B)) * pow((x + (((F * F) + 2.0) + x)), -0.5)) - ((cos(B) * x) / sin(B));
} else {
tmp = (1.0 / sin(B)) - t_0;
}
return tmp;
}
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
code = -(x * (1.0d0 / tan(b))) + ((f / sin(b)) * ((((f * f) + 2.0d0) + (2.0d0 * x)) ** -(1.0d0 / 2.0d0)))
end function
real(8) function code(f, b, x)
real(8), intent (in) :: f
real(8), intent (in) :: b
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = x * (1.0d0 / tan(b))
if (f <= (-3.95d+46)) then
tmp = ((-1.0d0) / sin(b)) - t_0
else if (f <= 5d+34) then
tmp = ((f / sin(b)) * ((x + (((f * f) + 2.0d0) + x)) ** (-0.5d0))) - ((cos(b) * x) / sin(b))
else
tmp = (1.0d0 / sin(b)) - t_0
end if
code = tmp
end function
public static double code(double F, double B, double x) {
return -(x * (1.0 / Math.tan(B))) + ((F / Math.sin(B)) * Math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)));
}
public static double code(double F, double B, double x) {
double t_0 = x * (1.0 / Math.tan(B));
double tmp;
if (F <= -3.95e+46) {
tmp = (-1.0 / Math.sin(B)) - t_0;
} else if (F <= 5e+34) {
tmp = ((F / Math.sin(B)) * Math.pow((x + (((F * F) + 2.0) + x)), -0.5)) - ((Math.cos(B) * x) / Math.sin(B));
} else {
tmp = (1.0 / Math.sin(B)) - t_0;
}
return tmp;
}
def code(F, B, x): return -(x * (1.0 / math.tan(B))) + ((F / math.sin(B)) * math.pow((((F * F) + 2.0) + (2.0 * x)), -(1.0 / 2.0)))
def code(F, B, x): t_0 = x * (1.0 / math.tan(B)) tmp = 0 if F <= -3.95e+46: tmp = (-1.0 / math.sin(B)) - t_0 elif F <= 5e+34: tmp = ((F / math.sin(B)) * math.pow((x + (((F * F) + 2.0) + x)), -0.5)) - ((math.cos(B) * x) / math.sin(B)) else: tmp = (1.0 / math.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 * Float64(1.0 / tan(B))) tmp = 0.0 if (F <= -3.95e+46) tmp = Float64(Float64(-1.0 / sin(B)) - t_0); elseif (F <= 5e+34) tmp = Float64(Float64(Float64(F / sin(B)) * (Float64(x + Float64(Float64(Float64(F * F) + 2.0) + x)) ^ -0.5)) - Float64(Float64(cos(B) * x) / sin(B))); else tmp = Float64(Float64(1.0 / sin(B)) - t_0); end return tmp end
function tmp = code(F, B, x) tmp = -(x * (1.0 / tan(B))) + ((F / sin(B)) * ((((F * F) + 2.0) + (2.0 * x)) ^ -(1.0 / 2.0))); end
function tmp_2 = code(F, B, x) t_0 = x * (1.0 / tan(B)); tmp = 0.0; if (F <= -3.95e+46) tmp = (-1.0 / sin(B)) - t_0; elseif (F <= 5e+34) tmp = ((F / sin(B)) * ((x + (((F * F) + 2.0) + x)) ^ -0.5)) - ((cos(B) * x) / sin(B)); else tmp = (1.0 / sin(B)) - t_0; end tmp_2 = 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[(1.0 / N[Tan[B], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[F, -3.95e+46], N[(N[(-1.0 / N[Sin[B], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision], If[LessEqual[F, 5e+34], N[(N[(N[(F / N[Sin[B], $MachinePrecision]), $MachinePrecision] * N[Power[N[(x + N[(N[(N[(F * F), $MachinePrecision] + 2.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[B], $MachinePrecision] * x), $MachinePrecision] / N[Sin[B], $MachinePrecision]), $MachinePrecision]), $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 := x \cdot \frac{1}{\tan B}\\
\mathbf{if}\;F \leq -3.95 \cdot 10^{+46}:\\
\;\;\;\;\frac{-1}{\sin B} - t_0\\
\mathbf{elif}\;F \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\frac{F}{\sin B} \cdot {\left(x + \left(\left(F \cdot F + 2\right) + x\right)\right)}^{-0.5} - \frac{\cos B \cdot x}{\sin B}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sin B} - t_0\\
\end{array}
Results
if F < -3.9500000000000002e46Initial program 29.6
Simplified29.6
[Start]29.6 | \[ \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)}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-35 [=>]29.6 | \[ \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)}
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]29.6 | \[ \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-108 [=>]29.6 | \[ \color{blue}{\left(0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right) - x \cdot \frac{1}{\tan B}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]29.6 | \[ \color{blue}{\left(\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + 0\right)} - x \cdot \frac{1}{\tan B}
\] |
rational_best_oopsla_all_46_json_45_simplify-85 [=>]29.6 | \[ \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}
\] |
Taylor expanded in F around -inf 0.2
if -3.9500000000000002e46 < F < 4.9999999999999998e34Initial program 0.6
Simplified0.6
[Start]0.6 | \[ \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)}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.6 | \[ \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)}
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]0.6 | \[ \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-108 [=>]0.6 | \[ \color{blue}{\left(0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right) - x \cdot \frac{1}{\tan B}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]0.6 | \[ \color{blue}{\left(\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + 0\right)} - x \cdot \frac{1}{\tan B}
\] |
rational_best_oopsla_all_46_json_45_simplify-85 [=>]0.6 | \[ \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}
\] |
Taylor expanded in x around 0 0.5
if 4.9999999999999998e34 < F Initial program 26.9
Simplified26.9
[Start]26.9 | \[ \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)}
\] |
|---|---|
rational_best_oopsla_all_46_json_45_simplify-35 [=>]26.9 | \[ \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)}
\] |
rational_best_oopsla_all_46_json_45_simplify-97 [=>]26.9 | \[ \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + \color{blue}{\left(0 - x \cdot \frac{1}{\tan B}\right)}
\] |
rational_best_oopsla_all_46_json_45_simplify-108 [=>]26.9 | \[ \color{blue}{\left(0 + \frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)}\right) - x \cdot \frac{1}{\tan B}}
\] |
rational_best_oopsla_all_46_json_45_simplify-35 [=>]26.9 | \[ \color{blue}{\left(\frac{F}{\sin B} \cdot {\left(\left(F \cdot F + 2\right) + 2 \cdot x\right)}^{\left(-\frac{1}{2}\right)} + 0\right)} - x \cdot \frac{1}{\tan B}
\] |
rational_best_oopsla_all_46_json_45_simplify-85 [=>]26.9 | \[ \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}
\] |
Taylor expanded in F around inf 0.2
Final simplification0.4
| Alternative 1 | |
|---|---|
| Error | 0.4 |
| Cost | 20744 |
| Alternative 2 | |
|---|---|
| Error | 1.4 |
| Cost | 20552 |
| Alternative 3 | |
|---|---|
| Error | 1.4 |
| Cost | 20168 |
| Alternative 4 | |
|---|---|
| Error | 5.5 |
| Cost | 14480 |
| Alternative 5 | |
|---|---|
| Error | 6.4 |
| Cost | 14348 |
| Alternative 6 | |
|---|---|
| Error | 6.6 |
| Cost | 14152 |
| Alternative 7 | |
|---|---|
| Error | 8.2 |
| Cost | 13904 |
| Alternative 8 | |
|---|---|
| Error | 11.2 |
| Cost | 13772 |
| Alternative 9 | |
|---|---|
| Error | 6.6 |
| Cost | 13768 |
| Alternative 10 | |
|---|---|
| Error | 20.8 |
| Cost | 13580 |
| Alternative 11 | |
|---|---|
| Error | 15.8 |
| Cost | 13580 |
| Alternative 12 | |
|---|---|
| Error | 26.7 |
| Cost | 8200 |
| Alternative 13 | |
|---|---|
| Error | 27.1 |
| Cost | 7892 |
| Alternative 14 | |
|---|---|
| Error | 27.0 |
| Cost | 7892 |
| Alternative 15 | |
|---|---|
| Error | 26.7 |
| Cost | 7892 |
| Alternative 16 | |
|---|---|
| Error | 27.0 |
| Cost | 7628 |
| Alternative 17 | |
|---|---|
| Error | 27.3 |
| Cost | 7372 |
| Alternative 18 | |
|---|---|
| Error | 28.8 |
| Cost | 7112 |
| Alternative 19 | |
|---|---|
| Error | 35.9 |
| Cost | 6988 |
| Alternative 20 | |
|---|---|
| Error | 31.3 |
| Cost | 6980 |
| Alternative 21 | |
|---|---|
| Error | 35.3 |
| Cost | 6920 |
| Alternative 22 | |
|---|---|
| Error | 38.2 |
| Cost | 6724 |
| Alternative 23 | |
|---|---|
| Error | 39.5 |
| Cost | 968 |
| Alternative 24 | |
|---|---|
| Error | 39.5 |
| Cost | 584 |
| Alternative 25 | |
|---|---|
| Error | 44.7 |
| Cost | 452 |
| Alternative 26 | |
|---|---|
| Error | 47.4 |
| Cost | 388 |
| Alternative 27 | |
|---|---|
| Error | 56.9 |
| Cost | 192 |
herbie shell --seed 2023090
(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))))))