
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 29 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(+
1.0
(*
(/ (/ (* M D) (* d 2.0)) l)
(/ (/ (* (* M D) 0.5) (* d 2.0)) (/ -1.0 h))))))
(if (<= h -1e-309)
(* (* (sqrt (/ d h)) (* (sqrt (/ -1.0 l)) (sqrt (- d)))) t_0)
(* t_0 (* (/ (sqrt d) (sqrt h)) (sqrt (/ d l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((((M * D) * 0.5) / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (h <= -1e-309) {
tmp = (sqrt((d / h)) * (sqrt((-1.0 / l)) * sqrt(-d))) * t_0;
} else {
tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l)));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((((m * d_1) / (d * 2.0d0)) / l) * ((((m * d_1) * 0.5d0) / (d * 2.0d0)) / ((-1.0d0) / h)))
if (h <= (-1d-309)) then
tmp = (sqrt((d / h)) * (sqrt(((-1.0d0) / l)) * sqrt(-d))) * t_0
else
tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((((M * D) * 0.5) / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (h <= -1e-309) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt((-1.0 / l)) * Math.sqrt(-d))) * t_0;
} else {
tmp = t_0 * ((Math.sqrt(d) / Math.sqrt(h)) * Math.sqrt((d / l)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((((M * D) * 0.5) / (d * 2.0)) / (-1.0 / h))) tmp = 0 if h <= -1e-309: tmp = (math.sqrt((d / h)) * (math.sqrt((-1.0 / l)) * math.sqrt(-d))) * t_0 else: tmp = t_0 * ((math.sqrt(d) / math.sqrt(h)) * math.sqrt((d / l))) return tmp
function code(d, h, l, M, D) t_0 = Float64(1.0 + Float64(Float64(Float64(Float64(M * D) / Float64(d * 2.0)) / l) * Float64(Float64(Float64(Float64(M * D) * 0.5) / Float64(d * 2.0)) / Float64(-1.0 / h)))) tmp = 0.0 if (h <= -1e-309) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-1.0 / l)) * sqrt(Float64(-d)))) * t_0); else tmp = Float64(t_0 * Float64(Float64(sqrt(d) / sqrt(h)) * sqrt(Float64(d / l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((((M * D) * 0.5) / (d * 2.0)) / (-1.0 / h))); tmp = 0.0; if (h <= -1e-309) tmp = (sqrt((d / h)) * (sqrt((-1.0 / l)) * sqrt(-d))) * t_0; else tmp = t_0 * ((sqrt(d) / sqrt(h)) * sqrt((d / l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 + N[(N[(N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1e-309], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{\frac{M \cdot D}{d \cdot 2}}{\ell} \cdot \frac{\frac{\left(M \cdot D\right) \cdot 0.5}{d \cdot 2}}{\frac{-1}{h}}\\
\mathbf{if}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{-1}{\ell}} \cdot \sqrt{-d}\right)\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if h < -1.000000000000002e-309Initial program 69.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
Applied rewrites75.5%
lift-/.f64N/A
metadata-eval75.5
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6475.5
Applied rewrites75.5%
lift-/.f64N/A
metadata-eval75.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6475.5
Applied rewrites75.5%
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
associate-/r/N/A
sqrt-prodN/A
*-lft-identityN/A
lift-*.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6484.5
lift-*.f64N/A
*-lft-identity84.5
Applied rewrites84.5%
if -1.000000000000002e-309 < h Initial program 63.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
Applied rewrites68.4%
lift-/.f64N/A
metadata-eval68.4
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6468.4
Applied rewrites68.4%
lift-/.f64N/A
metadata-eval68.4
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
lift-/.f6480.9
Applied rewrites80.9%
Final simplification82.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (* (sqrt (/ d h)) t_0))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M D) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_2 -4e+292)
(* t_1 (- 1.0 (/ (* (/ D d) (* (* D (* M M)) (* h 0.125))) (* d l))))
(if (<= t_2 -5e-179)
(*
t_1
(-
1.0
(* h (/ (* (* M D) (* (* M D) 0.5)) (* (* d 2.0) (* l (* d 2.0)))))))
(if (<= t_2 INFINITY)
(/ t_0 (sqrt (/ h d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (/ (* D (* D (* 0.125 (* h (* M M))))) (* d (* d l))))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h)) * t_0;
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M * D) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= -4e+292) {
tmp = t_1 * (1.0 - (((D / d) * ((D * (M * M)) * (h * 0.125))) / (d * l)));
} else if (t_2 <= -5e-179) {
tmp = t_1 * (1.0 - (h * (((M * D) * ((M * D) * 0.5)) / ((d * 2.0) * (l * (d * 2.0))))));
} else if (t_2 <= ((double) INFINITY)) {
tmp = t_0 / sqrt((h / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - ((D * (D * (0.125 * (h * (M * M))))) / (d * (d * l))));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h)) * t_0;
double t_2 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M * D) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= -4e+292) {
tmp = t_1 * (1.0 - (((D / d) * ((D * (M * M)) * (h * 0.125))) / (d * l)));
} else if (t_2 <= -5e-179) {
tmp = t_1 * (1.0 - (h * (((M * D) * ((M * D) * 0.5)) / ((d * 2.0) * (l * (d * 2.0))))));
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = t_0 / Math.sqrt((h / d));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - ((D * (D * (0.125 * (h * (M * M))))) / (d * (d * l))));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) * t_0 t_2 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M * D) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_2 <= -4e+292: tmp = t_1 * (1.0 - (((D / d) * ((D * (M * M)) * (h * 0.125))) / (d * l))) elif t_2 <= -5e-179: tmp = t_1 * (1.0 - (h * (((M * D) * ((M * D) * 0.5)) / ((d * 2.0) * (l * (d * 2.0)))))) elif t_2 <= math.inf: tmp = t_0 / math.sqrt((h / d)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - ((D * (D * (0.125 * (h * (M * M))))) / (d * (d * l)))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(sqrt(Float64(d / h)) * t_0) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_2 <= -4e+292) tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(D / d) * Float64(Float64(D * Float64(M * M)) * Float64(h * 0.125))) / Float64(d * l)))); elseif (t_2 <= -5e-179) tmp = Float64(t_1 * Float64(1.0 - Float64(h * Float64(Float64(Float64(M * D) * Float64(Float64(M * D) * 0.5)) / Float64(Float64(d * 2.0) * Float64(l * Float64(d * 2.0))))))); elseif (t_2 <= Inf) tmp = Float64(t_0 / sqrt(Float64(h / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(Float64(D * Float64(D * Float64(0.125 * Float64(h * Float64(M * M))))) / Float64(d * Float64(d * l))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = sqrt((d / h)) * t_0; t_2 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M * D) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0)))); tmp = 0.0; if (t_2 <= -4e+292) tmp = t_1 * (1.0 - (((D / d) * ((D * (M * M)) * (h * 0.125))) / (d * l))); elseif (t_2 <= -5e-179) tmp = t_1 * (1.0 - (h * (((M * D) * ((M * D) * 0.5)) / ((d * 2.0) * (l * (d * 2.0)))))); elseif (t_2 <= Inf) tmp = t_0 / sqrt((h / d)); else tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - ((D * (D * (0.125 * (h * (M * M))))) / (d * (d * l)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e+292], N[(t$95$1 * N[(1.0 - N[(N[(N[(D / d), $MachinePrecision] * N[(N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(h * 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -5e-179], N[(t$95$1 * N[(1.0 - N[(h * N[(N[(N[(M * D), $MachinePrecision] * N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(t$95$0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(D * N[(D * N[(0.125 * N[(h * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}} \cdot t\_0\\
t_2 := \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{+292}:\\
\;\;\;\;t\_1 \cdot \left(1 - \frac{\frac{D}{d} \cdot \left(\left(D \cdot \left(M \cdot M\right)\right) \cdot \left(h \cdot 0.125\right)\right)}{d \cdot \ell}\right)\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-179}:\\
\;\;\;\;t\_1 \cdot \left(1 - h \cdot \frac{\left(M \cdot D\right) \cdot \left(\left(M \cdot D\right) \cdot 0.5\right)}{\left(d \cdot 2\right) \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{t\_0}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - \frac{D \cdot \left(D \cdot \left(0.125 \cdot \left(h \cdot \left(M \cdot M\right)\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.0000000000000001e292Initial program 82.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6469.4
Applied rewrites69.4%
lift-/.f64N/A
metadata-eval69.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6468.7
Applied rewrites68.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
lower-*.f6469.4
lift-/.f64N/A
metadata-eval69.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6469.4
lift-/.f64N/A
metadata-eval69.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6469.4
Applied rewrites69.4%
Applied rewrites78.6%
if -4.0000000000000001e292 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.9999999999999998e-179Initial program 97.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
Applied rewrites92.6%
lift-/.f64N/A
metadata-eval92.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6492.6
Applied rewrites92.6%
lift-/.f64N/A
metadata-eval92.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6492.6
Applied rewrites92.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f64N/A
Applied rewrites51.5%
if -4.9999999999999998e-179 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 78.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6458.2
Applied rewrites58.2%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6442.5
Applied rewrites42.5%
Applied rewrites78.6%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f649.8
Applied rewrites9.8%
lift-/.f64N/A
metadata-eval9.8
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6410.0
Applied rewrites10.0%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites19.7%
Final simplification66.2%
herbie shell --seed 2024226
(FPCore (d h l M D)
:name "Henrywood and Agarwal, Equation (12)"
:precision binary64
(* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))