| Alternative 1 | |
|---|---|
| Accuracy | 66.0% |
| Cost | 1225 |
(FPCore (c0 w h D d M)
:precision binary64
(*
(/ c0 (* 2.0 w))
(+
(/ (* c0 (* d d)) (* (* w h) (* D D)))
(sqrt
(-
(*
(/ (* c0 (* d d)) (* (* w h) (* D D)))
(/ (* c0 (* d d)) (* (* w h) (* D D))))
(* M M))))))(FPCore (c0 w h D d M)
:precision binary64
(let* ((t_0 (* c0 (* d d)))
(t_1 (* (* w h) (* D D)))
(t_2 (/ c0 (* 2.0 w)))
(t_3 (/ t_0 t_1))
(t_4 (* t_2 (+ t_3 (sqrt (- (* t_3 t_3) (* M M)))))))
(if (<= t_4 -1e+74)
(* t_2 (* 2.0 (pow (* (/ d D) (sqrt (/ c0 (* w h)))) 2.0)))
(if (<= t_4 0.0)
(* h (* (/ D d) (* (/ M (/ d M)) (* D 0.25))))
(if (<= t_4 1e+228)
(* t_2 (/ (* 2.0 t_0) t_1))
(* 0.25 (* (/ D (/ d M)) (* h (* D (/ M d))))))))))double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = (w * h) * (D * D);
double t_2 = c0 / (2.0 * w);
double t_3 = t_0 / t_1;
double t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M))));
double tmp;
if (t_4 <= -1e+74) {
tmp = t_2 * (2.0 * pow(((d / D) * sqrt((c0 / (w * h)))), 2.0));
} else if (t_4 <= 0.0) {
tmp = h * ((D / d) * ((M / (d / M)) * (D * 0.25)));
} else if (t_4 <= 1e+228) {
tmp = t_2 * ((2.0 * t_0) / t_1);
} else {
tmp = 0.25 * ((D / (d / M)) * (h * (D * (M / d))));
}
return tmp;
}
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
code = (c0 / (2.0d0 * w)) * (((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) + sqrt(((((c0 * (d_1 * d_1)) / ((w * h) * (d * d))) * ((c0 * (d_1 * d_1)) / ((w * h) * (d * d)))) - (m * m))))
end function
real(8) function code(c0, w, h, d, d_1, m)
real(8), intent (in) :: c0
real(8), intent (in) :: w
real(8), intent (in) :: h
real(8), intent (in) :: d
real(8), intent (in) :: d_1
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = c0 * (d_1 * d_1)
t_1 = (w * h) * (d * d)
t_2 = c0 / (2.0d0 * w)
t_3 = t_0 / t_1
t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (m * m))))
if (t_4 <= (-1d+74)) then
tmp = t_2 * (2.0d0 * (((d_1 / d) * sqrt((c0 / (w * h)))) ** 2.0d0))
else if (t_4 <= 0.0d0) then
tmp = h * ((d / d_1) * ((m / (d_1 / m)) * (d * 0.25d0)))
else if (t_4 <= 1d+228) then
tmp = t_2 * ((2.0d0 * t_0) / t_1)
else
tmp = 0.25d0 * ((d / (d_1 / m)) * (h * (d * (m / d_1))))
end if
code = tmp
end function
public static double code(double c0, double w, double h, double D, double d, double M) {
return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + Math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))));
}
public static double code(double c0, double w, double h, double D, double d, double M) {
double t_0 = c0 * (d * d);
double t_1 = (w * h) * (D * D);
double t_2 = c0 / (2.0 * w);
double t_3 = t_0 / t_1;
double t_4 = t_2 * (t_3 + Math.sqrt(((t_3 * t_3) - (M * M))));
double tmp;
if (t_4 <= -1e+74) {
tmp = t_2 * (2.0 * Math.pow(((d / D) * Math.sqrt((c0 / (w * h)))), 2.0));
} else if (t_4 <= 0.0) {
tmp = h * ((D / d) * ((M / (d / M)) * (D * 0.25)));
} else if (t_4 <= 1e+228) {
tmp = t_2 * ((2.0 * t_0) / t_1);
} else {
tmp = 0.25 * ((D / (d / M)) * (h * (D * (M / d))));
}
return tmp;
}
def code(c0, w, h, D, d, M): return (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + math.sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M))))
def code(c0, w, h, D, d, M): t_0 = c0 * (d * d) t_1 = (w * h) * (D * D) t_2 = c0 / (2.0 * w) t_3 = t_0 / t_1 t_4 = t_2 * (t_3 + math.sqrt(((t_3 * t_3) - (M * M)))) tmp = 0 if t_4 <= -1e+74: tmp = t_2 * (2.0 * math.pow(((d / D) * math.sqrt((c0 / (w * h)))), 2.0)) elif t_4 <= 0.0: tmp = h * ((D / d) * ((M / (d / M)) * (D * 0.25))) elif t_4 <= 1e+228: tmp = t_2 * ((2.0 * t_0) / t_1) else: tmp = 0.25 * ((D / (d / M)) * (h * (D * (M / d)))) return tmp
function code(c0, w, h, D, d, M) return Float64(Float64(c0 / Float64(2.0 * w)) * Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) + sqrt(Float64(Float64(Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) * Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D)))) - Float64(M * M))))) end
function code(c0, w, h, D, d, M) t_0 = Float64(c0 * Float64(d * d)) t_1 = Float64(Float64(w * h) * Float64(D * D)) t_2 = Float64(c0 / Float64(2.0 * w)) t_3 = Float64(t_0 / t_1) t_4 = Float64(t_2 * Float64(t_3 + sqrt(Float64(Float64(t_3 * t_3) - Float64(M * M))))) tmp = 0.0 if (t_4 <= -1e+74) tmp = Float64(t_2 * Float64(2.0 * (Float64(Float64(d / D) * sqrt(Float64(c0 / Float64(w * h)))) ^ 2.0))); elseif (t_4 <= 0.0) tmp = Float64(h * Float64(Float64(D / d) * Float64(Float64(M / Float64(d / M)) * Float64(D * 0.25)))); elseif (t_4 <= 1e+228) tmp = Float64(t_2 * Float64(Float64(2.0 * t_0) / t_1)); else tmp = Float64(0.25 * Float64(Float64(D / Float64(d / M)) * Float64(h * Float64(D * Float64(M / d))))); end return tmp end
function tmp = code(c0, w, h, D, d, M) tmp = (c0 / (2.0 * w)) * (((c0 * (d * d)) / ((w * h) * (D * D))) + sqrt(((((c0 * (d * d)) / ((w * h) * (D * D))) * ((c0 * (d * d)) / ((w * h) * (D * D)))) - (M * M)))); end
function tmp_2 = code(c0, w, h, D, d, M) t_0 = c0 * (d * d); t_1 = (w * h) * (D * D); t_2 = c0 / (2.0 * w); t_3 = t_0 / t_1; t_4 = t_2 * (t_3 + sqrt(((t_3 * t_3) - (M * M)))); tmp = 0.0; if (t_4 <= -1e+74) tmp = t_2 * (2.0 * (((d / D) * sqrt((c0 / (w * h)))) ^ 2.0)); elseif (t_4 <= 0.0) tmp = h * ((D / d) * ((M / (d / M)) * (D * 0.25))); elseif (t_4 <= 1e+228) tmp = t_2 * ((2.0 * t_0) / t_1); else tmp = 0.25 * ((D / (d / M)) * (h * (D * (M / d)))); end tmp_2 = tmp; end
code[c0_, w_, h_, D_, d_, M_] := N[(N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Sqrt[N[(N[(N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[c0_, w_, h_, D_, d_, M_] := Block[{t$95$0 = N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c0 / N[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 * N[(t$95$3 + N[Sqrt[N[(N[(t$95$3 * t$95$3), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -1e+74], N[(t$95$2 * N[(2.0 * N[Power[N[(N[(d / D), $MachinePrecision] * N[Sqrt[N[(c0 / N[(w * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[(h * N[(N[(D / d), $MachinePrecision] * N[(N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(D * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 1e+228], N[(t$95$2 * N[(N[(2.0 * t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(D / N[(d / M), $MachinePrecision]), $MachinePrecision] * N[(h * N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\begin{array}{l}
t_0 := c0 \cdot \left(d \cdot d\right)\\
t_1 := \left(w \cdot h\right) \cdot \left(D \cdot D\right)\\
t_2 := \frac{c0}{2 \cdot w}\\
t_3 := \frac{t_0}{t_1}\\
t_4 := t_2 \cdot \left(t_3 + \sqrt{t_3 \cdot t_3 - M \cdot M}\right)\\
\mathbf{if}\;t_4 \leq -1 \cdot 10^{+74}:\\
\;\;\;\;t_2 \cdot \left(2 \cdot {\left(\frac{d}{D} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)}^{2}\right)\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;h \cdot \left(\frac{D}{d} \cdot \left(\frac{M}{\frac{d}{M}} \cdot \left(D \cdot 0.25\right)\right)\right)\\
\mathbf{elif}\;t_4 \leq 10^{+228}:\\
\;\;\;\;t_2 \cdot \frac{2 \cdot t_0}{t_1}\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \left(h \cdot \left(D \cdot \frac{M}{d}\right)\right)\right)\\
\end{array}
Results
if (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -9.99999999999999952e73Initial program 10.3%
Simplified14.4%
[Start]10.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
times-frac [=>]8.2 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{w \cdot h} \cdot \frac{d \cdot d}{D \cdot D}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
fma-def [=>]8.1 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{d \cdot d}{D \cdot D}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)}
\] |
associate-/r* [=>]8.2 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \color{blue}{\frac{\frac{d \cdot d}{D}}{D}}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
difference-of-squares [=>]8.2 | \[ \frac{c0}{2 \cdot w} \cdot \mathsf{fma}\left(\frac{c0}{w \cdot h}, \frac{\frac{d \cdot d}{D}}{D}, \sqrt{\color{blue}{\left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + M\right) \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M\right)}}\right)
\] |
Taylor expanded in c0 around inf 18.6%
Simplified31.5%
[Start]18.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
times-frac [=>]19.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{d}^{2}}{{D}^{2}} \cdot \frac{c0}{w \cdot h}\right)}\right)
\] |
associate-/r* [=>]22.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{{d}^{2}}{{D}^{2}} \cdot \color{blue}{\frac{\frac{c0}{w}}{h}}\right)\right)
\] |
times-frac [<=]23.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{d}^{2} \cdot \frac{c0}{w}}{{D}^{2} \cdot h}}\right)
\] |
*-commutative [<=]23.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\frac{c0}{w} \cdot {d}^{2}}}{{D}^{2} \cdot h}\right)
\] |
*-commutative [<=]23.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot {d}^{2}}{\color{blue}{h \cdot {D}^{2}}}\right)
\] |
unpow2 [=>]23.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\frac{c0}{w} \cdot {d}^{2}}{h \cdot \color{blue}{\left(D \cdot D\right)}}\right)
\] |
associate-/l* [=>]21.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{c0}{w}}{\frac{h \cdot \left(D \cdot D\right)}{{d}^{2}}}}\right)
\] |
associate-*r/ [=>]21.3 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{2 \cdot \frac{c0}{w}}{\frac{h \cdot \left(D \cdot D\right)}{{d}^{2}}}}
\] |
associate-*r* [=>]24.8 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \frac{c0}{w}}{\frac{\color{blue}{\left(h \cdot D\right) \cdot D}}{{d}^{2}}}
\] |
associate-*r/ [<=]29.4 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \frac{c0}{w}}{\color{blue}{\left(h \cdot D\right) \cdot \frac{D}{{d}^{2}}}}
\] |
unpow2 [=>]29.4 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \frac{c0}{w}}{\left(h \cdot D\right) \cdot \frac{D}{\color{blue}{d \cdot d}}}
\] |
associate-*r* [<=]25.4 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \frac{c0}{w}}{\color{blue}{h \cdot \left(D \cdot \frac{D}{d \cdot d}\right)}}
\] |
associate-*r/ [<=]25.4 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{\frac{c0}{w}}{h \cdot \left(D \cdot \frac{D}{d \cdot d}\right)}\right)}
\] |
associate-/r* [=>]28.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{\frac{\frac{c0}{w}}{h}}{D \cdot \frac{D}{d \cdot d}}}\right)
\] |
associate-/r* [<=]25.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{\color{blue}{\frac{c0}{w \cdot h}}}{D \cdot \frac{D}{d \cdot d}}\right)
\] |
Applied egg-rr44.4%
[Start]31.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}\right)\right)
\] |
|---|---|
add-sqr-sqrt [=>]31.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}} \cdot \sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}}\right)}\right)
\] |
pow2 [=>]31.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{{\left(\sqrt{\frac{c0}{w \cdot h} \cdot {\left(\frac{d}{D}\right)}^{2}}\right)}^{2}}\right)
\] |
*-commutative [=>]31.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\sqrt{\color{blue}{{\left(\frac{d}{D}\right)}^{2} \cdot \frac{c0}{w \cdot h}}}\right)}^{2}\right)
\] |
sqrt-prod [=>]31.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\color{blue}{\left(\sqrt{{\left(\frac{d}{D}\right)}^{2}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)}}^{2}\right)
\] |
unpow2 [=>]31.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\sqrt{\color{blue}{\frac{d}{D} \cdot \frac{d}{D}}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)}^{2}\right)
\] |
sqrt-prod [=>]23.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\color{blue}{\left(\sqrt{\frac{d}{D}} \cdot \sqrt{\frac{d}{D}}\right)} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)}^{2}\right)
\] |
add-sqr-sqrt [<=]44.4 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot {\left(\color{blue}{\frac{d}{D}} \cdot \sqrt{\frac{c0}{w \cdot h}}\right)}^{2}\right)
\] |
if -9.99999999999999952e73 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < -0.0Initial program 59.7%
Applied egg-rr55.1%
[Start]59.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
distribute-rgt-in [=>]59.1 | \[ \color{blue}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}}
\] |
associate-*r* [=>]54.2 | \[ \frac{\color{blue}{\left(c0 \cdot d\right) \cdot d}}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
associate-*l* [=>]43.5 | \[ \frac{\left(c0 \cdot d\right) \cdot d}{\color{blue}{w \cdot \left(h \cdot \left(D \cdot D\right)\right)}} \cdot \frac{c0}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
times-frac [=>]40.3 | \[ \color{blue}{\left(\frac{c0 \cdot d}{w} \cdot \frac{d}{h \cdot \left(D \cdot D\right)}\right)} \cdot \frac{c0}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
associate-*r* [=>]38.1 | \[ \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{\color{blue}{\left(h \cdot D\right) \cdot D}}\right) \cdot \frac{c0}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
*-un-lft-identity [=>]38.1 | \[ \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{\left(h \cdot D\right) \cdot D}\right) \cdot \frac{\color{blue}{1 \cdot c0}}{2 \cdot w} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
times-frac [=>]37.9 | \[ \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{\left(h \cdot D\right) \cdot D}\right) \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{c0}{w}\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
metadata-eval [=>]37.9 | \[ \left(\frac{c0 \cdot d}{w} \cdot \frac{d}{\left(h \cdot D\right) \cdot D}\right) \cdot \left(\color{blue}{0.5} \cdot \frac{c0}{w}\right) + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \frac{c0}{2 \cdot w}
\] |
Taylor expanded in c0 around -inf 35.7%
Simplified46.1%
[Start]35.7 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}} + \left(0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} + -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}\right) \cdot {c0}^{2}
\] |
|---|---|
+-commutative [=>]35.7 | \[ \color{blue}{\left(0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} + -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}\right) \cdot {c0}^{2} + 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}}
\] |
*-commutative [=>]35.7 | \[ \color{blue}{{c0}^{2} \cdot \left(0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} + -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}\right)} + 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
fma-def [=>]35.7 | \[ \color{blue}{\mathsf{fma}\left({c0}^{2}, 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} + -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\right)}
\] |
unpow2 [=>]35.7 | \[ \mathsf{fma}\left(\color{blue}{c0 \cdot c0}, 0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} + -0.5 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\right)
\] |
distribute-rgt-out [=>]35.7 | \[ \mathsf{fma}\left(c0 \cdot c0, \color{blue}{\frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \cdot \left(0.5 + -0.5\right)}, 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\right)
\] |
metadata-eval [=>]35.7 | \[ \mathsf{fma}\left(c0 \cdot c0, \frac{{d}^{2}}{{D}^{2} \cdot \left({w}^{2} \cdot h\right)} \cdot \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\right)
\] |
mul0-rgt [=>]44.6 | \[ \mathsf{fma}\left(c0 \cdot c0, \color{blue}{0}, 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}\right)
\] |
associate-/l* [=>]44.1 | \[ \mathsf{fma}\left(c0 \cdot c0, 0, 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{h \cdot {M}^{2}}}}\right)
\] |
*-commutative [<=]44.1 | \[ \mathsf{fma}\left(c0 \cdot c0, 0, 0.25 \cdot \frac{{D}^{2}}{\frac{{d}^{2}}{\color{blue}{{M}^{2} \cdot h}}}\right)
\] |
Taylor expanded in c0 around 0 50.9%
Simplified59.5%
[Start]50.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
unpow2 [=>]50.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot \color{blue}{\left(M \cdot M\right)}\right)}{{d}^{2}}
\] |
*-commutative [=>]50.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(\left(M \cdot M\right) \cdot h\right)}}{{d}^{2}}
\] |
unpow2 [<=]50.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(\color{blue}{{M}^{2}} \cdot h\right)}{{d}^{2}}
\] |
unpow2 [=>]50.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{\color{blue}{d \cdot d}}
\] |
associate-*r/ [=>]50.9 | \[ \color{blue}{\frac{0.25 \cdot \left({D}^{2} \cdot \left({M}^{2} \cdot h\right)\right)}{d \cdot d}}
\] |
unpow2 [=>]50.9 | \[ \frac{0.25 \cdot \left(\color{blue}{\left(D \cdot D\right)} \cdot \left({M}^{2} \cdot h\right)\right)}{d \cdot d}
\] |
unpow2 [=>]50.9 | \[ \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)\right)}{d \cdot d}
\] |
*-commutative [<=]50.9 | \[ \frac{0.25 \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}\right)}{d \cdot d}
\] |
associate-*r* [=>]50.9 | \[ \frac{\color{blue}{\left(0.25 \cdot \left(D \cdot D\right)\right) \cdot \left(h \cdot \left(M \cdot M\right)\right)}}{d \cdot d}
\] |
*-commutative [<=]50.9 | \[ \frac{\color{blue}{\left(\left(D \cdot D\right) \cdot 0.25\right)} \cdot \left(h \cdot \left(M \cdot M\right)\right)}{d \cdot d}
\] |
times-frac [=>]54.8 | \[ \color{blue}{\frac{\left(D \cdot D\right) \cdot 0.25}{d} \cdot \frac{h \cdot \left(M \cdot M\right)}{d}}
\] |
associate-/l* [=>]55.1 | \[ \frac{\left(D \cdot D\right) \cdot 0.25}{d} \cdot \color{blue}{\frac{h}{\frac{d}{M \cdot M}}}
\] |
associate-/l/ [<=]57.4 | \[ \frac{\left(D \cdot D\right) \cdot 0.25}{d} \cdot \frac{h}{\color{blue}{\frac{\frac{d}{M}}{M}}}
\] |
times-frac [<=]56.3 | \[ \color{blue}{\frac{\left(\left(D \cdot D\right) \cdot 0.25\right) \cdot h}{d \cdot \frac{\frac{d}{M}}{M}}}
\] |
associate-*l/ [<=]56.5 | \[ \color{blue}{\frac{\left(D \cdot D\right) \cdot 0.25}{d \cdot \frac{\frac{d}{M}}{M}} \cdot h}
\] |
if -0.0 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) < 9.9999999999999992e227Initial program 83.9%
Taylor expanded in c0 around inf 87.5%
Simplified87.5%
[Start]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(w \cdot h\right)}\right)
\] |
|---|---|
associate-*r/ [=>]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{2 \cdot \left({d}^{2} \cdot c0\right)}{{D}^{2} \cdot \left(w \cdot h\right)}}
\] |
unpow2 [=>]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(\color{blue}{\left(d \cdot d\right)} \cdot c0\right)}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
*-commutative [<=]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \color{blue}{\left(c0 \cdot \left(d \cdot d\right)\right)}}{{D}^{2} \cdot \left(w \cdot h\right)}
\] |
unpow2 [=>]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\color{blue}{\left(D \cdot D\right)} \cdot \left(w \cdot h\right)}
\] |
*-commutative [=>]87.5 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\color{blue}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}
\] |
if 9.9999999999999992e227 < (*.f64 (/.f64 c0 (*.f64 2 w)) (+.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (sqrt.f64 (-.f64 (*.f64 (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D))) (/.f64 (*.f64 c0 (*.f64 d d)) (*.f64 (*.f64 w h) (*.f64 D D)))) (*.f64 M M))))) Initial program 0.1%
Simplified0.4%
[Start]0.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
|---|---|
associate-*l/ [<=]0.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \left(d \cdot d\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
*-commutative [=>]0.1 | \[ \frac{c0}{2 \cdot w} \cdot \left(\color{blue}{\left(d \cdot d\right) \cdot \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)
\] |
fma-def [=>]0.1 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(d \cdot d, \frac{c0}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}, \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)}
\] |
Taylor expanded in c0 around -inf 1.8%
Simplified46.7%
[Start]1.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(0.5 \cdot \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0} + -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)
\] |
|---|---|
fma-def [=>]1.8 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\mathsf{fma}\left(0.5, \frac{{D}^{2} \cdot \left(w \cdot \left({M}^{2} \cdot h\right)\right)}{{d}^{2} \cdot c0}, -1 \cdot \left(\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} + -1 \cdot \frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)}\right) \cdot c0\right)\right)}
\] |
Taylor expanded in c0 around 0 45.2%
Simplified48.5%
[Start]45.2 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left({M}^{2} \cdot h\right)}{{d}^{2}}
\] |
|---|---|
unpow2 [=>]45.2 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(\color{blue}{\left(M \cdot M\right)} \cdot h\right)}{{d}^{2}}
\] |
associate-*r* [<=]48.3 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left(M \cdot \left(M \cdot h\right)\right)}}{{d}^{2}}
\] |
associate-/l* [=>]48.5 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{M \cdot \left(M \cdot h\right)}}}
\] |
unpow2 [=>]48.5 | \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{M \cdot \left(M \cdot h\right)}}
\] |
unpow2 [=>]48.5 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{M \cdot \left(M \cdot h\right)}}
\] |
Applied egg-rr70.6%
[Start]48.5 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{M \cdot \left(M \cdot h\right)}}
\] |
|---|---|
times-frac [=>]58.6 | \[ 0.25 \cdot \frac{D \cdot D}{\color{blue}{\frac{d}{M} \cdot \frac{d}{M \cdot h}}}
\] |
times-frac [=>]70.6 | \[ 0.25 \cdot \color{blue}{\left(\frac{D}{\frac{d}{M}} \cdot \frac{D}{\frac{d}{M \cdot h}}\right)}
\] |
Applied egg-rr78.3%
[Start]70.6 | \[ 0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \frac{D}{\frac{d}{M \cdot h}}\right)
\] |
|---|---|
associate-/r* [=>]75.0 | \[ 0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \frac{D}{\color{blue}{\frac{\frac{d}{M}}{h}}}\right)
\] |
associate-/r/ [=>]78.4 | \[ 0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \color{blue}{\left(\frac{D}{\frac{d}{M}} \cdot h\right)}\right)
\] |
div-inv [=>]78.3 | \[ 0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \left(\color{blue}{\left(D \cdot \frac{1}{\frac{d}{M}}\right)} \cdot h\right)\right)
\] |
clear-num [<=]78.3 | \[ 0.25 \cdot \left(\frac{D}{\frac{d}{M}} \cdot \left(\left(D \cdot \color{blue}{\frac{M}{d}}\right) \cdot h\right)\right)
\] |
Final simplification75.2%
| Alternative 1 | |
|---|---|
| Accuracy | 66.0% |
| Cost | 1225 |
| Alternative 2 | |
|---|---|
| Accuracy | 64.9% |
| Cost | 1225 |
| Alternative 3 | |
|---|---|
| Accuracy | 62.2% |
| Cost | 960 |
| Alternative 4 | |
|---|---|
| Accuracy | 61.8% |
| Cost | 960 |
| Alternative 5 | |
|---|---|
| Accuracy | 65.0% |
| Cost | 960 |
| Alternative 6 | |
|---|---|
| Accuracy | 68.5% |
| Cost | 960 |
| Alternative 7 | |
|---|---|
| Accuracy | 74.0% |
| Cost | 960 |
| Alternative 8 | |
|---|---|
| Accuracy | 50.4% |
| Cost | 64 |
herbie shell --seed 2023152
(FPCore (c0 w h D d M)
:name "Henrywood and Agarwal, Equation (13)"
:precision binary64
(* (/ c0 (* 2.0 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))