| Alternative 1 | |
|---|---|
| Error | 18.4 |
| Cost | 1864 |
(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 (* 2.0 w)))
(t_1 (/ (* c0 (* d d)) (* (* w h) (* D D))))
(t_2 (* t_0 (+ t_1 (sqrt (- (* t_1 t_1) (* M M)))))))
(if (<= t_2 -5e-214)
(* d (/ (/ (/ c0 w) (/ D (/ c0 (/ D d)))) (* w h)))
(if (<= t_2 0.0)
(* 0.25 (/ (* (/ D d) (* h M)) (/ (/ d D) M)))
(if (<= t_2 2e+142)
(* t_0 (* 2.0 (* c0 (/ (/ (* d d) D) (* w (* h D))))))
(* 0.25 (* (/ (* h (* D M)) d) (/ (* 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 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -5e-214) {
tmp = d * (((c0 / w) / (D / (c0 / (D / d)))) / (w * h));
} else if (t_2 <= 0.0) {
tmp = 0.25 * (((D / d) * (h * M)) / ((d / D) / M));
} else if (t_2 <= 2e+142) {
tmp = t_0 * (2.0 * (c0 * (((d * d) / D) / (w * (h * D)))));
} else {
tmp = 0.25 * (((h * (D * M)) / d) * ((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) :: tmp
t_0 = c0 / (2.0d0 * w)
t_1 = (c0 * (d_1 * d_1)) / ((w * h) * (d * d))
t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (m * m))))
if (t_2 <= (-5d-214)) then
tmp = d_1 * (((c0 / w) / (d / (c0 / (d / d_1)))) / (w * h))
else if (t_2 <= 0.0d0) then
tmp = 0.25d0 * (((d / d_1) * (h * m)) / ((d_1 / d) / m))
else if (t_2 <= 2d+142) then
tmp = t_0 * (2.0d0 * (c0 * (((d_1 * d_1) / d) / (w * (h * d)))))
else
tmp = 0.25d0 * (((h * (d * m)) / d_1) * ((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 / (2.0 * w);
double t_1 = (c0 * (d * d)) / ((w * h) * (D * D));
double t_2 = t_0 * (t_1 + Math.sqrt(((t_1 * t_1) - (M * M))));
double tmp;
if (t_2 <= -5e-214) {
tmp = d * (((c0 / w) / (D / (c0 / (D / d)))) / (w * h));
} else if (t_2 <= 0.0) {
tmp = 0.25 * (((D / d) * (h * M)) / ((d / D) / M));
} else if (t_2 <= 2e+142) {
tmp = t_0 * (2.0 * (c0 * (((d * d) / D) / (w * (h * D)))));
} else {
tmp = 0.25 * (((h * (D * M)) / d) * ((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 / (2.0 * w) t_1 = (c0 * (d * d)) / ((w * h) * (D * D)) t_2 = t_0 * (t_1 + math.sqrt(((t_1 * t_1) - (M * M)))) tmp = 0 if t_2 <= -5e-214: tmp = d * (((c0 / w) / (D / (c0 / (D / d)))) / (w * h)) elif t_2 <= 0.0: tmp = 0.25 * (((D / d) * (h * M)) / ((d / D) / M)) elif t_2 <= 2e+142: tmp = t_0 * (2.0 * (c0 * (((d * d) / D) / (w * (h * D))))) else: tmp = 0.25 * (((h * (D * M)) / d) * ((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(2.0 * w)) t_1 = Float64(Float64(c0 * Float64(d * d)) / Float64(Float64(w * h) * Float64(D * D))) t_2 = Float64(t_0 * Float64(t_1 + sqrt(Float64(Float64(t_1 * t_1) - Float64(M * M))))) tmp = 0.0 if (t_2 <= -5e-214) tmp = Float64(d * Float64(Float64(Float64(c0 / w) / Float64(D / Float64(c0 / Float64(D / d)))) / Float64(w * h))); elseif (t_2 <= 0.0) tmp = Float64(0.25 * Float64(Float64(Float64(D / d) * Float64(h * M)) / Float64(Float64(d / D) / M))); elseif (t_2 <= 2e+142) tmp = Float64(t_0 * Float64(2.0 * Float64(c0 * Float64(Float64(Float64(d * d) / D) / Float64(w * Float64(h * D)))))); else tmp = Float64(0.25 * Float64(Float64(Float64(h * Float64(D * M)) / d) * Float64(Float64(D * 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 / (2.0 * w); t_1 = (c0 * (d * d)) / ((w * h) * (D * D)); t_2 = t_0 * (t_1 + sqrt(((t_1 * t_1) - (M * M)))); tmp = 0.0; if (t_2 <= -5e-214) tmp = d * (((c0 / w) / (D / (c0 / (D / d)))) / (w * h)); elseif (t_2 <= 0.0) tmp = 0.25 * (((D / d) * (h * M)) / ((d / D) / M)); elseif (t_2 <= 2e+142) tmp = t_0 * (2.0 * (c0 * (((d * d) / D) / (w * (h * D))))); else tmp = 0.25 * (((h * (D * M)) / d) * ((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[(2.0 * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c0 * N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(N[(w * h), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(t$95$1 + N[Sqrt[N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e-214], N[(d * N[(N[(N[(c0 / w), $MachinePrecision] / N[(D / N[(c0 / N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w * h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], N[(0.25 * N[(N[(N[(D / d), $MachinePrecision] * N[(h * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d / D), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+142], N[(t$95$0 * N[(2.0 * N[(c0 * N[(N[(N[(d * d), $MachinePrecision] / D), $MachinePrecision] / N[(w * N[(h * D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.25 * N[(N[(N[(h * N[(D * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(D * M), $MachinePrecision] / d), $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 := \frac{c0}{2 \cdot w}\\
t_1 := \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\\
t_2 := t_0 \cdot \left(t_1 + \sqrt{t_1 \cdot t_1 - M \cdot M}\right)\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{-214}:\\
\;\;\;\;d \cdot \frac{\frac{\frac{c0}{w}}{\frac{D}{\frac{c0}{\frac{D}{d}}}}}{w \cdot h}\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;0.25 \cdot \frac{\frac{D}{d} \cdot \left(h \cdot M\right)}{\frac{\frac{d}{D}}{M}}\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+142}:\\
\;\;\;\;t_0 \cdot \left(2 \cdot \left(c0 \cdot \frac{\frac{d \cdot d}{D}}{w \cdot \left(h \cdot D\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.25 \cdot \left(\frac{h \cdot \left(D \cdot M\right)}{d} \cdot \frac{D \cdot M}{d}\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))))) < -4.9999999999999998e-214Initial program 49.4
Taylor expanded in c0 around inf 45.2
Simplified45.6
[Start]45.2 | \[ \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/ [=>]45.2 | \[ \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)}}
\] |
*-commutative [=>]45.2 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left({d}^{2} \cdot c0\right)}{\color{blue}{\left(w \cdot h\right) \cdot {D}^{2}}}
\] |
unpow2 [=>]45.2 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left({d}^{2} \cdot c0\right)}{\left(w \cdot h\right) \cdot \color{blue}{\left(D \cdot D\right)}}
\] |
*-commutative [=>]45.2 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \color{blue}{\left(c0 \cdot {d}^{2}\right)}}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}
\] |
unpow2 [=>]45.2 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \color{blue}{\left(d \cdot d\right)}\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}
\] |
associate-*r* [=>]40.7 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\color{blue}{\left(\left(w \cdot h\right) \cdot D\right) \cdot D}}
\] |
associate-*r* [<=]41.1 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\color{blue}{\left(w \cdot \left(h \cdot D\right)\right)} \cdot D}
\] |
*-commutative [<=]41.1 | \[ \frac{c0}{2 \cdot w} \cdot \frac{2 \cdot \left(c0 \cdot \left(d \cdot d\right)\right)}{\color{blue}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}}
\] |
associate-*r/ [<=]41.1 | \[ \frac{c0}{2 \cdot w} \cdot \color{blue}{\left(2 \cdot \frac{c0 \cdot \left(d \cdot d\right)}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right)}
\] |
associate-*r/ [<=]43.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(c0 \cdot \frac{d \cdot d}{D \cdot \left(w \cdot \left(h \cdot D\right)\right)}\right)}\right)
\] |
*-commutative [=>]43.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{d \cdot d}{\color{blue}{\left(w \cdot \left(h \cdot D\right)\right) \cdot D}}\right)\right)
\] |
associate-*r* [=>]42.5 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{d \cdot d}{\color{blue}{\left(\left(w \cdot h\right) \cdot D\right)} \cdot D}\right)\right)
\] |
associate-*r* [<=]46.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \frac{d \cdot d}{\color{blue}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}}\right)\right)
\] |
associate-/l/ [<=]48.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \color{blue}{\frac{\frac{d \cdot d}{D \cdot D}}{w \cdot h}}\right)\right)
\] |
associate-/r* [<=]46.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \color{blue}{\frac{d \cdot d}{\left(D \cdot D\right) \cdot \left(w \cdot h\right)}}\right)\right)
\] |
times-frac [=>]45.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \color{blue}{\left(\frac{d}{D \cdot D} \cdot \frac{d}{w \cdot h}\right)}\right)\right)
\] |
associate-/r* [=>]45.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(c0 \cdot \left(\frac{d}{D \cdot D} \cdot \color{blue}{\frac{\frac{d}{w}}{h}}\right)\right)\right)
\] |
Applied egg-rr39.7
Applied egg-rr61.5
Simplified35.8
[Start]61.5 | \[ e^{\mathsf{log1p}\left(\left(\frac{c0}{D} \cdot \left(\frac{\frac{d}{D}}{w \cdot h} \cdot d\right)\right) \cdot \left(1 \cdot \frac{c0}{w}\right)\right)} - 1
\] |
|---|---|
expm1-def [=>]54.0 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(\frac{c0}{D} \cdot \left(\frac{\frac{d}{D}}{w \cdot h} \cdot d\right)\right) \cdot \left(1 \cdot \frac{c0}{w}\right)\right)\right)}
\] |
expm1-log1p [=>]36.1 | \[ \color{blue}{\left(\frac{c0}{D} \cdot \left(\frac{\frac{d}{D}}{w \cdot h} \cdot d\right)\right) \cdot \left(1 \cdot \frac{c0}{w}\right)}
\] |
associate-/r/ [<=]37.8 | \[ \color{blue}{\frac{c0}{\frac{D}{\frac{\frac{d}{D}}{w \cdot h} \cdot d}}} \cdot \left(1 \cdot \frac{c0}{w}\right)
\] |
associate-*l/ [=>]40.3 | \[ \color{blue}{\frac{c0 \cdot \left(1 \cdot \frac{c0}{w}\right)}{\frac{D}{\frac{\frac{d}{D}}{w \cdot h} \cdot d}}}
\] |
*-commutative [<=]40.3 | \[ \frac{\color{blue}{\left(1 \cdot \frac{c0}{w}\right) \cdot c0}}{\frac{D}{\frac{\frac{d}{D}}{w \cdot h} \cdot d}}
\] |
associate-/r/ [<=]41.0 | \[ \frac{\left(1 \cdot \frac{c0}{w}\right) \cdot c0}{\frac{D}{\color{blue}{\frac{\frac{d}{D}}{\frac{w \cdot h}{d}}}}}
\] |
associate-/l* [<=]40.4 | \[ \frac{\left(1 \cdot \frac{c0}{w}\right) \cdot c0}{\color{blue}{\frac{D \cdot \frac{w \cdot h}{d}}{\frac{d}{D}}}}
\] |
associate-/l* [<=]34.9 | \[ \color{blue}{\frac{\left(\left(1 \cdot \frac{c0}{w}\right) \cdot c0\right) \cdot \frac{d}{D}}{D \cdot \frac{w \cdot h}{d}}}
\] |
associate-*r* [<=]31.1 | \[ \frac{\color{blue}{\left(1 \cdot \frac{c0}{w}\right) \cdot \left(c0 \cdot \frac{d}{D}\right)}}{D \cdot \frac{w \cdot h}{d}}
\] |
associate-/r* [=>]34.1 | \[ \color{blue}{\frac{\frac{\left(1 \cdot \frac{c0}{w}\right) \cdot \left(c0 \cdot \frac{d}{D}\right)}{D}}{\frac{w \cdot h}{d}}}
\] |
associate-/r/ [=>]33.3 | \[ \color{blue}{\frac{\frac{\left(1 \cdot \frac{c0}{w}\right) \cdot \left(c0 \cdot \frac{d}{D}\right)}{D}}{w \cdot h} \cdot d}
\] |
if -4.9999999999999998e-214 < (*.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 28.9
Taylor expanded in c0 around -inf 30.9
Simplified27.7
[Start]30.9 | \[ \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 [=>]30.9 | \[ \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 24.8
Simplified23.0
[Start]24.8 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]24.8 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-/l* [=>]24.2 | \[ 0.25 \cdot \color{blue}{\frac{{D}^{2}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}}
\] |
unpow2 [=>]24.2 | \[ 0.25 \cdot \frac{\color{blue}{D \cdot D}}{\frac{{d}^{2}}{{M}^{2} \cdot h}}
\] |
unpow2 [=>]24.2 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{\color{blue}{d \cdot d}}{{M}^{2} \cdot h}}
\] |
unpow2 [=>]24.2 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{\left(M \cdot M\right)} \cdot h}}
\] |
associate-*r* [<=]21.4 | \[ 0.25 \cdot \frac{D \cdot D}{\frac{d \cdot d}{\color{blue}{M \cdot \left(M \cdot h\right)}}}
\] |
associate-/r/ [=>]22.0 | \[ 0.25 \cdot \color{blue}{\left(\frac{D \cdot D}{d \cdot d} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)}
\] |
times-frac [=>]19.2 | \[ 0.25 \cdot \left(\color{blue}{\left(\frac{D}{d} \cdot \frac{D}{d}\right)} \cdot \left(M \cdot \left(M \cdot h\right)\right)\right)
\] |
*-commutative [=>]19.2 | \[ 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(\left(M \cdot h\right) \cdot M\right)}\right)
\] |
*-commutative [=>]19.2 | \[ 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \left(\color{blue}{\left(h \cdot M\right)} \cdot M\right)\right)
\] |
associate-*r* [<=]23.0 | \[ 0.25 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \color{blue}{\left(h \cdot \left(M \cdot M\right)\right)}\right)
\] |
Applied egg-rr13.0
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))))) < 2.0000000000000001e142Initial program 11.9
Applied egg-rr26.7
Taylor expanded in c0 around inf 6.5
Simplified14.8
[Start]6.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-/l* [=>]10.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\frac{{d}^{2}}{\frac{{D}^{2} \cdot \left(w \cdot h\right)}{c0}}}\right)
\] |
associate-/r/ [=>]13.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \color{blue}{\left(\frac{{d}^{2}}{{D}^{2} \cdot \left(w \cdot h\right)} \cdot c0\right)}\right)
\] |
associate-/r* [=>]17.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{{d}^{2}}{{D}^{2}}}{w \cdot h}} \cdot c0\right)\right)
\] |
associate-/l/ [<=]21.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{\frac{{d}^{2}}{{D}^{2}}}{h}}{w}} \cdot c0\right)\right)
\] |
unpow2 [=>]21.3 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\frac{{d}^{2}}{\color{blue}{D \cdot D}}}{h}}{w} \cdot c0\right)\right)
\] |
associate-/r* [=>]21.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\color{blue}{\frac{\frac{{d}^{2}}{D}}{D}}}{h}}{w} \cdot c0\right)\right)
\] |
unpow2 [=>]21.0 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\frac{\frac{\color{blue}{d \cdot d}}{D}}{D}}{h}}{w} \cdot c0\right)\right)
\] |
associate-*l/ [<=]20.9 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\frac{\color{blue}{\frac{d}{D} \cdot d}}{D}}{h}}{w} \cdot c0\right)\right)
\] |
associate-/r/ [<=]20.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{\frac{\color{blue}{\frac{d}{\frac{D}{d}}}}{D}}{h}}{w} \cdot c0\right)\right)
\] |
associate-/l/ [=>]19.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{\frac{\frac{d}{\frac{D}{d}}}{h \cdot D}}}{w} \cdot c0\right)\right)
\] |
associate-/l/ [=>]14.7 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\color{blue}{\frac{\frac{d}{\frac{D}{d}}}{w \cdot \left(h \cdot D\right)}} \cdot c0\right)\right)
\] |
associate-/r/ [=>]14.6 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{\frac{d}{D} \cdot d}}{w \cdot \left(h \cdot D\right)} \cdot c0\right)\right)
\] |
associate-*l/ [=>]14.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\color{blue}{\frac{d \cdot d}{D}}}{w \cdot \left(h \cdot D\right)} \cdot c0\right)\right)
\] |
*-commutative [=>]14.8 | \[ \frac{c0}{2 \cdot w} \cdot \left(2 \cdot \left(\frac{\frac{d \cdot d}{D}}{w \cdot \color{blue}{\left(D \cdot h\right)}} \cdot c0\right)\right)
\] |
if 2.0000000000000001e142 < (*.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 63.7
Taylor expanded in c0 around -inf 62.6
Simplified41.2
[Start]62.6 | \[ \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 [=>]62.6 | \[ \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 34.9
Simplified25.9
[Start]34.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \left(h \cdot {M}^{2}\right)}{{d}^{2}}
\] |
|---|---|
*-commutative [=>]34.9 | \[ 0.25 \cdot \frac{{D}^{2} \cdot \color{blue}{\left({M}^{2} \cdot h\right)}}{{d}^{2}}
\] |
associate-*r* [=>]34.3 | \[ 0.25 \cdot \frac{\color{blue}{\left({D}^{2} \cdot {M}^{2}\right) \cdot h}}{{d}^{2}}
\] |
*-commutative [=>]34.3 | \[ 0.25 \cdot \frac{\color{blue}{h \cdot \left({D}^{2} \cdot {M}^{2}\right)}}{{d}^{2}}
\] |
unpow2 [=>]34.3 | \[ 0.25 \cdot \frac{h \cdot \left(\color{blue}{\left(D \cdot D\right)} \cdot {M}^{2}\right)}{{d}^{2}}
\] |
unpow2 [=>]34.3 | \[ 0.25 \cdot \frac{h \cdot \left(\left(D \cdot D\right) \cdot \color{blue}{\left(M \cdot M\right)}\right)}{{d}^{2}}
\] |
unswap-sqr [=>]25.9 | \[ 0.25 \cdot \frac{h \cdot \color{blue}{\left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}}{{d}^{2}}
\] |
unpow2 [=>]25.9 | \[ 0.25 \cdot \frac{h \cdot \left(\left(D \cdot M\right) \cdot \left(D \cdot M\right)\right)}{\color{blue}{d \cdot d}}
\] |
Applied egg-rr16.2
Final simplification17.2
| Alternative 1 | |
|---|---|
| Error | 18.4 |
| Cost | 1864 |
| Alternative 2 | |
|---|---|
| Error | 18.4 |
| Cost | 1608 |
| Alternative 3 | |
|---|---|
| Error | 18.4 |
| Cost | 1608 |
| Alternative 4 | |
|---|---|
| Error | 18.4 |
| Cost | 1608 |
| Alternative 5 | |
|---|---|
| Error | 18.4 |
| Cost | 1608 |
| Alternative 6 | |
|---|---|
| Error | 18.7 |
| Cost | 1481 |
| Alternative 7 | |
|---|---|
| Error | 23.6 |
| Cost | 1225 |
| Alternative 8 | |
|---|---|
| Error | 17.3 |
| Cost | 1220 |
| Alternative 9 | |
|---|---|
| Error | 17.3 |
| Cost | 1220 |
| Alternative 10 | |
|---|---|
| Error | 20.6 |
| Cost | 960 |
| Alternative 11 | |
|---|---|
| Error | 18.6 |
| Cost | 960 |
| Alternative 12 | |
|---|---|
| Error | 31.7 |
| Cost | 64 |
herbie shell --seed 2023077
(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))))))