
(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 23 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 (* (* M D) 0.5))
(t_1 (sqrt (/ d l)))
(t_2
(+
1.0
(* (/ (/ (* M D) (* d 2.0)) l) (/ (/ t_0 (* d 2.0)) (/ -1.0 h))))))
(if (<= h -5.6e-308)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_1) t_2)
(if (<= h 5.2e+70)
(* t_2 (* t_1 (/ (sqrt d) (sqrt h))))
(*
(*
(- 1.0 (* h (/ (* (* M D) t_0) (* (* d 2.0) (* 2.0 (* d l))))))
(/ 1.0 (sqrt h)))
(/ d (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M * D) * 0.5;
double t_1 = sqrt((d / l));
double t_2 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((t_0 / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (h <= -5.6e-308) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2;
} else if (h <= 5.2e+70) {
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
} else {
tmp = ((1.0 - (h * (((M * D) * t_0) / ((d * 2.0) * (2.0 * (d * l)))))) * (1.0 / sqrt(h))) * (d / sqrt(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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (m * d_1) * 0.5d0
t_1 = sqrt((d / l))
t_2 = 1.0d0 + ((((m * d_1) / (d * 2.0d0)) / l) * ((t_0 / (d * 2.0d0)) / ((-1.0d0) / h)))
if (h <= (-5.6d-308)) then
tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2
else if (h <= 5.2d+70) then
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)))
else
tmp = ((1.0d0 - (h * (((m * d_1) * t_0) / ((d * 2.0d0) * (2.0d0 * (d * l)))))) * (1.0d0 / sqrt(h))) * (d / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (M * D) * 0.5;
double t_1 = Math.sqrt((d / l));
double t_2 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((t_0 / (d * 2.0)) / (-1.0 / h)));
double tmp;
if (h <= -5.6e-308) {
tmp = ((Math.sqrt(-d) / Math.sqrt(-h)) * t_1) * t_2;
} else if (h <= 5.2e+70) {
tmp = t_2 * (t_1 * (Math.sqrt(d) / Math.sqrt(h)));
} else {
tmp = ((1.0 - (h * (((M * D) * t_0) / ((d * 2.0) * (2.0 * (d * l)))))) * (1.0 / Math.sqrt(h))) * (d / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (M * D) * 0.5 t_1 = math.sqrt((d / l)) t_2 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((t_0 / (d * 2.0)) / (-1.0 / h))) tmp = 0 if h <= -5.6e-308: tmp = ((math.sqrt(-d) / math.sqrt(-h)) * t_1) * t_2 elif h <= 5.2e+70: tmp = t_2 * (t_1 * (math.sqrt(d) / math.sqrt(h))) else: tmp = ((1.0 - (h * (((M * D) * t_0) / ((d * 2.0) * (2.0 * (d * l)))))) * (1.0 / math.sqrt(h))) * (d / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) * 0.5) t_1 = sqrt(Float64(d / l)) t_2 = Float64(1.0 + Float64(Float64(Float64(Float64(M * D) / Float64(d * 2.0)) / l) * Float64(Float64(t_0 / Float64(d * 2.0)) / Float64(-1.0 / h)))) tmp = 0.0 if (h <= -5.6e-308) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1) * t_2); elseif (h <= 5.2e+70) tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); else tmp = Float64(Float64(Float64(1.0 - Float64(h * Float64(Float64(Float64(M * D) * t_0) / Float64(Float64(d * 2.0) * Float64(2.0 * Float64(d * l)))))) * Float64(1.0 / sqrt(h))) * Float64(d / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (M * D) * 0.5; t_1 = sqrt((d / l)); t_2 = 1.0 + ((((M * D) / (d * 2.0)) / l) * ((t_0 / (d * 2.0)) / (-1.0 / h))); tmp = 0.0; if (h <= -5.6e-308) tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2; elseif (h <= 5.2e+70) tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h))); else tmp = ((1.0 - (h * (((M * D) * t_0) / ((d * 2.0) * (2.0 * (d * l)))))) * (1.0 / sqrt(h))) * (d / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(N[(N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(t$95$0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5.6e-308], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[h, 5.2e+70], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - N[(h * N[(N[(N[(M * D), $MachinePrecision] * t$95$0), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(2.0 * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(M \cdot D\right) \cdot 0.5\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := 1 + \frac{\frac{M \cdot D}{d \cdot 2}}{\ell} \cdot \frac{\frac{t\_0}{d \cdot 2}}{\frac{-1}{h}}\\
\mathbf{if}\;h \leq -5.6 \cdot 10^{-308}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;h \leq 5.2 \cdot 10^{+70}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(1 - h \cdot \frac{\left(M \cdot D\right) \cdot t\_0}{\left(d \cdot 2\right) \cdot \left(2 \cdot \left(d \cdot \ell\right)\right)}\right) \cdot \frac{1}{\sqrt{h}}\right) \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < -5.59999999999999969e-308Initial program 70.5%
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.0%
lift-/.f64N/A
metadata-eval75.0
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6475.0
Applied rewrites75.0%
lift-/.f64N/A
metadata-eval75.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6485.3
Applied rewrites85.3%
if -5.59999999999999969e-308 < h < 5.2000000000000001e70Initial program 80.0%
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 rewrites81.2%
lift-/.f64N/A
metadata-eval81.2
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6481.2
Applied rewrites81.2%
lift-/.f64N/A
metadata-eval81.2
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6489.5
Applied rewrites89.5%
if 5.2000000000000001e70 < h Initial program 43.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 rewrites51.2%
Applied rewrites75.0%
Final simplification84.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (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_0 (- INFINITY))
(* (sqrt (/ h (* l (* l l)))) (* 0.125 (* M (/ (* M (* D D)) d))))
(if (<= t_0 1e+206)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (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_0 <= -((double) INFINITY)) {
tmp = sqrt((h / (l * (l * l)))) * (0.125 * (M * ((M * (D * D)) / d)));
} else if (t_0 <= 1e+206) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (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_0 <= -Double.POSITIVE_INFINITY) {
tmp = Math.sqrt((h / (l * (l * l)))) * (0.125 * (M * ((M * (D * D)) / d)));
} else if (t_0 <= 1e+206) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (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_0 <= -math.inf: tmp = math.sqrt((h / (l * (l * l)))) * (0.125 * (M * ((M * (D * D)) / d))) elif t_0 <= 1e+206: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = 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_0 <= Float64(-Inf)) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(0.125 * Float64(M * Float64(Float64(M * Float64(D * D)) / d)))); elseif (t_0 <= 1e+206) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (((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_0 <= -Inf) tmp = sqrt((h / (l * (l * l)))) * (0.125 * (M * ((M * (D * D)) / d))); elseif (t_0 <= 1e+206) tmp = sqrt((d / l)) * sqrt((d / h)); else tmp = d * (sqrt((1.0 / h)) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = 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$0, (-Infinity)], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(M * N[(N[(M * N[(D * D), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+206], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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\_0 \leq -\infty:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(0.125 \cdot \left(M \cdot \frac{M \cdot \left(D \cdot D\right)}{d}\right)\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+206}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\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)))) < -inf.0Initial program 82.8%
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 rewrites89.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6413.1
Applied rewrites13.1%
Applied rewrites12.5%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-/l*N/A
mul-1-negN/A
Applied rewrites35.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)))) < 1e206Initial program 89.5%
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 rewrites88.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6437.4
Applied rewrites37.4%
Applied rewrites37.5%
Applied rewrites74.6%
if 1e206 < (*.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 26.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 rewrites34.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6428.9
Applied rewrites28.9%
Applied rewrites29.6%
Final simplification48.9%
herbie shell --seed 2024230
(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)))))