
(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 16 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}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))))
(*
(/ (sqrt d) (sqrt h))
(*
(/ (sqrt d) (sqrt l))
(- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))));
} else {
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))))));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (d <= (-5d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))))
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -5e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0)))))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -5e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))));
else
tmp = (sqrt(d) / sqrt(h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\right)\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 62.4%
Simplified63.2%
expm1-log1p-u62.7%
expm1-udef62.7%
div-inv62.7%
associate-*l*62.7%
metadata-eval62.7%
Applied egg-rr62.7%
expm1-def62.7%
expm1-log1p63.2%
associate-*r/68.1%
associate-*l/68.8%
*-commutative68.8%
Simplified68.8%
frac-2neg68.8%
sqrt-div82.3%
Applied egg-rr82.3%
if -4.999999999999985e-310 < d Initial program 61.4%
Simplified60.5%
expm1-log1p-u60.3%
expm1-udef60.3%
div-inv60.3%
associate-*l*60.3%
metadata-eval60.3%
Applied egg-rr60.3%
expm1-def60.3%
expm1-log1p60.5%
associate-*r/60.9%
associate-*l/62.5%
*-commutative62.5%
Simplified62.5%
clear-num62.5%
un-div-inv62.5%
associate-*r*62.5%
metadata-eval62.5%
div-inv62.5%
*-commutative62.5%
frac-times63.4%
Applied egg-rr63.4%
sqrt-div74.0%
div-inv74.0%
Applied egg-rr74.0%
associate-*r/74.0%
*-rgt-identity74.0%
Simplified74.0%
sqrt-div89.1%
div-inv89.0%
Applied egg-rr89.0%
associate-*r/89.1%
*-rgt-identity89.1%
Simplified89.1%
Final simplification85.4%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
(t_2
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_1) (/ h l)))))
(t_3 (* D (* M (/ 0.5 d)))))
(if (<= t_2 -4e-276)
(* (sqrt (/ d h)) (* t_0 (- 1.0 (* 0.5 (* t_3 (* (/ h l) t_3))))))
(if (or (<= t_2 0.0) (not (<= t_2 5e+221)))
(fabs (/ d (sqrt (* h l))))
(* (* t_0 (- 1.0 (* 0.5 (/ h (/ l t_1))))) (/ 1.0 (sqrt (/ h d))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
double t_3 = D * (M * (0.5 / d));
double tmp;
if (t_2 <= -4e-276) {
tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: t_3
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = ((m * d_1) / (d * 2.0d0)) ** 2.0d0
t_2 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
t_3 = d_1 * (m * (0.5d0 / d))
if (t_2 <= (-4d-276)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 - (0.5d0 * (t_3 * ((h / l) * t_3)))))
else if ((t_2 <= 0.0d0) .or. (.not. (t_2 <= 5d+221))) then
tmp = abs((d / sqrt((h * l))))
else
tmp = (t_0 * (1.0d0 - (0.5d0 * (h / (l / t_1))))) * (1.0d0 / sqrt((h / d)))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
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.pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
double t_3 = D * (M * (0.5 / d));
double tmp;
if (t_2 <= -4e-276) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / Math.sqrt((h / d)));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.pow(((M * D) / (d * 2.0)), 2.0) t_2 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l))) t_3 = D * (M * (0.5 / d)) tmp = 0 if t_2 <= -4e-276: tmp = math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3))))) elif (t_2 <= 0.0) or not (t_2 <= 5e+221): tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / math.sqrt((h / d))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0 t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))) t_3 = Float64(D * Float64(M * Float64(0.5 / d))) tmp = 0.0 if (t_2 <= -4e-276) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(t_3 * Float64(Float64(h / l) * t_3)))))); elseif ((t_2 <= 0.0) || !(t_2 <= 5e+221)) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / t_1))))) * Float64(1.0 / sqrt(Float64(h / d)))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = ((M * D) / (d * 2.0)) ^ 2.0;
t_2 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
t_3 = D * (M * (0.5 / d));
tmp = 0.0;
if (t_2 <= -4e-276)
tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (t_3 * ((h / l) * t_3)))));
elseif ((t_2 <= 0.0) || ~((t_2 <= 5e+221)))
tmp = abs((d / sqrt((h * l))));
else
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-276], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(t$95$3 * N[(N[(h / l), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 5e+221]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h / N[(l / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\
t_3 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(t_3 \cdot \left(\frac{h}{\ell} \cdot t_3\right)\right)\right)\right)\\
\mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{t_1}}\right)\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -4e-276Initial program 86.4%
Simplified86.4%
expm1-log1p-u85.2%
expm1-udef85.2%
div-inv85.2%
associate-*l*85.2%
metadata-eval85.2%
Applied egg-rr85.2%
expm1-def85.2%
expm1-log1p86.4%
associate-*r/83.8%
associate-*l/86.5%
*-commutative86.5%
Simplified86.5%
clear-num86.4%
un-div-inv86.4%
associate-*r*86.4%
metadata-eval86.4%
div-inv86.4%
*-commutative86.4%
frac-times86.4%
Applied egg-rr86.4%
associate-/r/86.4%
unpow286.4%
associate-*r*88.9%
div-inv88.9%
associate-*l*87.6%
*-commutative87.6%
associate-/r*87.6%
metadata-eval87.6%
div-inv87.6%
associate-*l*89.0%
*-commutative89.0%
associate-/r*89.0%
metadata-eval89.0%
Applied egg-rr89.0%
if -4e-276 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 5.0000000000000002e221 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 20.9%
Taylor expanded in d around inf 29.6%
add-sqr-sqrt28.8%
sqrt-unprod32.8%
pow232.8%
sqrt-div32.8%
metadata-eval32.8%
un-div-inv32.8%
Applied egg-rr32.8%
unpow232.8%
rem-sqrt-square55.5%
Simplified55.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 5.0000000000000002e221Initial program 99.3%
Simplified99.3%
expm1-log1p-u99.3%
expm1-udef99.3%
div-inv99.3%
associate-*l*99.3%
metadata-eval99.3%
Applied egg-rr99.3%
expm1-def99.3%
expm1-log1p99.3%
associate-*r/99.3%
associate-*l/99.3%
*-commutative99.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.3%
associate-*r*99.3%
metadata-eval99.3%
div-inv99.3%
*-commutative99.3%
frac-times99.3%
Applied egg-rr99.3%
clear-num99.3%
sqrt-div99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification77.6%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (pow (/ (* M D) (* d 2.0)) 2.0))
(t_2
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (* 0.5 t_1) (/ h l))))))
(if (<= t_2 -4e-276)
(*
(sqrt (/ d h))
(*
t_0
(- 1.0 (* 0.5 (pow (* (* M (* 0.5 (/ D d))) (sqrt (/ h l))) 2.0)))))
(if (or (<= t_2 0.0) (not (<= t_2 5e+221)))
(fabs (/ d (sqrt (* h l))))
(* (* t_0 (- 1.0 (* 0.5 (/ h (/ l t_1))))) (/ 1.0 (sqrt (/ h d))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
double tmp;
if (t_2 <= -4e-276) {
tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * pow(((M * (0.5 * (D / d))) * sqrt((h / l))), 2.0))));
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 = sqrt((d / l))
t_1 = ((m * d_1) / (d * 2.0d0)) ** 2.0d0
t_2 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((0.5d0 * t_1) * (h / l)))
if (t_2 <= (-4d-276)) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 - (0.5d0 * (((m * (0.5d0 * (d_1 / d))) * sqrt((h / l))) ** 2.0d0))))
else if ((t_2 <= 0.0d0) .or. (.not. (t_2 <= 5d+221))) then
tmp = abs((d / sqrt((h * l))))
else
tmp = (t_0 * (1.0d0 - (0.5d0 * (h / (l / t_1))))) * (1.0d0 / sqrt((h / d)))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
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.pow(((M * D) / (d * 2.0)), 2.0);
double t_2 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
double tmp;
if (t_2 <= -4e-276) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * Math.pow(((M * (0.5 * (D / d))) * Math.sqrt((h / l))), 2.0))));
} else if ((t_2 <= 0.0) || !(t_2 <= 5e+221)) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / Math.sqrt((h / d)));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.pow(((M * D) / (d * 2.0)), 2.0) t_2 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((0.5 * t_1) * (h / l))) tmp = 0 if t_2 <= -4e-276: tmp = math.sqrt((d / h)) * (t_0 * (1.0 - (0.5 * math.pow(((M * (0.5 * (D / d))) * math.sqrt((h / l))), 2.0)))) elif (t_2 <= 0.0) or not (t_2 <= 5e+221): tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / math.sqrt((h / d))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0 t_2 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(0.5 * t_1) * Float64(h / l)))) tmp = 0.0 if (t_2 <= -4e-276) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(M * Float64(0.5 * Float64(D / d))) * sqrt(Float64(h / l))) ^ 2.0))))); elseif ((t_2 <= 0.0) || !(t_2 <= 5e+221)) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / t_1))))) * Float64(1.0 / sqrt(Float64(h / d)))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
t_1 = ((M * D) / (d * 2.0)) ^ 2.0;
t_2 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((0.5 * t_1) * (h / l)));
tmp = 0.0;
if (t_2 <= -4e-276)
tmp = sqrt((d / h)) * (t_0 * (1.0 - (0.5 * (((M * (0.5 * (D / d))) * sqrt((h / l))) ^ 2.0))));
elseif ((t_2 <= 0.0) || ~((t_2 <= 5e+221)))
tmp = abs((d / sqrt((h * l))));
else
tmp = (t_0 * (1.0 - (0.5 * (h / (l / t_1))))) * (1.0 / sqrt((h / d)));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(0.5 * t$95$1), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-276], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$2, 0.0], N[Not[LessEqual[t$95$2, 5e+221]], $MachinePrecision]], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h / N[(l / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\\
t_2 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \left(0.5 \cdot t_1\right) \cdot \frac{h}{\ell}\right)\\
\mathbf{if}\;t_2 \leq -4 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right) \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_2 \leq 0 \lor \neg \left(t_2 \leq 5 \cdot 10^{+221}\right):\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{t_1}}\right)\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < -4e-276Initial program 86.4%
Simplified86.4%
add-sqr-sqrt86.5%
pow286.5%
sqrt-prod86.4%
sqrt-pow189.0%
metadata-eval89.0%
pow189.0%
div-inv89.0%
associate-*l*89.0%
metadata-eval89.0%
Applied egg-rr89.0%
if -4e-276 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 0.0 or 5.0000000000000002e221 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) Initial program 20.9%
Taylor expanded in d around inf 29.6%
add-sqr-sqrt28.8%
sqrt-unprod32.8%
pow232.8%
sqrt-div32.8%
metadata-eval32.8%
un-div-inv32.8%
Applied egg-rr32.8%
unpow232.8%
rem-sqrt-square55.5%
Simplified55.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 1 2)) (pow.f64 (/.f64 d l) (/.f64 1 2))) (-.f64 1 (*.f64 (*.f64 (/.f64 1 2) (pow.f64 (/.f64 (*.f64 M D) (*.f64 2 d)) 2)) (/.f64 h l)))) < 5.0000000000000002e221Initial program 99.3%
Simplified99.3%
expm1-log1p-u99.3%
expm1-udef99.3%
div-inv99.3%
associate-*l*99.3%
metadata-eval99.3%
Applied egg-rr99.3%
expm1-def99.3%
expm1-log1p99.3%
associate-*r/99.3%
associate-*l/99.3%
*-commutative99.3%
Simplified99.3%
clear-num99.3%
un-div-inv99.3%
associate-*r*99.3%
metadata-eval99.3%
div-inv99.3%
*-commutative99.3%
frac-times99.3%
Applied egg-rr99.3%
clear-num99.3%
sqrt-div99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification77.6%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))
(if (<= h -5e-310)
(*
(sqrt (/ d h))
(*
(- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))
(/ (sqrt (- d)) (sqrt (- l)))))
(if (<= h 2.6e+189)
(* (* (/ (sqrt d) (sqrt l)) t_0) (/ 1.0 (sqrt (/ h d))))
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_0))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (h <= -5e-310) {
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
} else if (h <= 2.6e+189) {
tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0 / sqrt((h / d)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
if (h <= (-5d-310)) then
tmp = sqrt((d / h)) * ((1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))) * (sqrt(-d) / sqrt(-l)))
else if (h <= 2.6d+189) then
tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0d0 / sqrt((h / d)))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0)
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))));
double tmp;
if (h <= -5e-310) {
tmp = Math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (h <= 2.6e+189) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * (1.0 / Math.sqrt((h / d)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * t_0);
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0)))) tmp = 0 if h <= -5e-310: tmp = math.sqrt((d / h)) * ((1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (math.sqrt(-d) / math.sqrt(-l))) elif h <= 2.6e+189: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * (1.0 / math.sqrt((h / d))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * t_0) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (h <= 2.6e+189) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * Float64(1.0 / sqrt(Float64(h / d)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_0)); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (h <= -5e-310)
tmp = sqrt((d / h)) * ((1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
elseif (h <= 2.6e+189)
tmp = ((sqrt(d) / sqrt(l)) * t_0) * (1.0 / sqrt((h / d)));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.6e+189], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;h \leq 2.6 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 62.4%
Simplified63.2%
expm1-log1p-u62.7%
expm1-udef62.7%
div-inv62.7%
associate-*l*62.7%
metadata-eval62.7%
Applied egg-rr62.7%
expm1-def62.7%
expm1-log1p63.2%
associate-*r/68.1%
associate-*l/68.8%
*-commutative68.8%
Simplified68.8%
frac-2neg68.8%
sqrt-div77.1%
Applied egg-rr77.1%
if -4.999999999999985e-310 < h < 2.59999999999999981e189Initial program 67.3%
Simplified66.2%
expm1-log1p-u65.9%
expm1-udef65.9%
div-inv65.9%
associate-*l*65.9%
metadata-eval65.9%
Applied egg-rr65.9%
expm1-def65.9%
expm1-log1p66.2%
associate-*r/66.5%
associate-*l/68.6%
*-commutative68.6%
Simplified68.6%
clear-num68.6%
un-div-inv68.6%
associate-*r*68.6%
metadata-eval68.6%
div-inv68.6%
*-commutative68.6%
frac-times69.7%
Applied egg-rr69.7%
clear-num69.6%
sqrt-div70.7%
metadata-eval70.7%
Applied egg-rr70.7%
sqrt-div82.5%
div-inv82.5%
Applied egg-rr83.5%
associate-*r/82.5%
*-rgt-identity82.5%
Simplified83.5%
if 2.59999999999999981e189 < h Initial program 38.6%
Simplified38.6%
expm1-log1p-u38.6%
expm1-udef38.6%
div-inv38.6%
associate-*l*38.6%
metadata-eval38.6%
Applied egg-rr38.6%
expm1-def38.6%
expm1-log1p38.6%
associate-*r/39.1%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
clear-num39.1%
un-div-inv39.1%
associate-*r*39.1%
metadata-eval39.1%
div-inv39.1%
*-commutative39.1%
frac-times39.1%
Applied egg-rr39.1%
sqrt-div80.0%
div-inv80.0%
Applied egg-rr67.8%
associate-*r/80.0%
*-rgt-identity80.0%
Simplified67.9%
Final simplification78.6%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_1 (sqrt (/ d h))))
(if (<= h -5e-310)
(*
t_1
(*
(- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))
(/ (sqrt (- d)) (sqrt (- l)))))
(if (<= h 2.4e+189)
(* (* (/ (sqrt d) (sqrt l)) t_0) t_1)
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_0))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))));
double t_1 = sqrt((d / h));
double tmp;
if (h <= -5e-310) {
tmp = t_1 * ((1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
} else if (h <= 2.4e+189) {
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
t_0 = 1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
t_1 = sqrt((d / h))
if (h <= (-5d-310)) then
tmp = t_1 * ((1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))) * (sqrt(-d) / sqrt(-l)))
else if (h <= 2.4d+189) then
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0)
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = 1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_1 = Math.sqrt((d / h));
double tmp;
if (h <= -5e-310) {
tmp = t_1 * ((1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (Math.sqrt(-d) / Math.sqrt(-l)));
} else if (h <= 2.4e+189) {
tmp = ((Math.sqrt(d) / Math.sqrt(l)) * t_0) * t_1;
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * t_0);
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0)))) t_1 = math.sqrt((d / h)) tmp = 0 if h <= -5e-310: tmp = t_1 * ((1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l)))) * (math.sqrt(-d) / math.sqrt(-l))) elif h <= 2.4e+189: tmp = ((math.sqrt(d) / math.sqrt(l)) * t_0) * t_1 else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * t_0) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_1 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_1 * Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); elseif (h <= 2.4e+189) tmp = Float64(Float64(Float64(sqrt(d) / sqrt(l)) * t_0) * t_1); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_0)); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))));
t_1 = sqrt((d / h));
tmp = 0.0;
if (h <= -5e-310)
tmp = t_1 * ((1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))) * (sqrt(-d) / sqrt(-l)));
elseif (h <= 2.4e+189)
tmp = ((sqrt(d) / sqrt(l)) * t_0) * t_1;
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_0);
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$1 * N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.4e+189], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\\
t_1 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \left(\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{elif}\;h \leq 2.4 \cdot 10^{+189}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t_0\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t_0\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 62.4%
Simplified63.2%
expm1-log1p-u62.7%
expm1-udef62.7%
div-inv62.7%
associate-*l*62.7%
metadata-eval62.7%
Applied egg-rr62.7%
expm1-def62.7%
expm1-log1p63.2%
associate-*r/68.1%
associate-*l/68.8%
*-commutative68.8%
Simplified68.8%
frac-2neg68.8%
sqrt-div77.1%
Applied egg-rr77.1%
if -4.999999999999985e-310 < h < 2.4000000000000001e189Initial program 67.3%
Simplified66.2%
expm1-log1p-u65.9%
expm1-udef65.9%
div-inv65.9%
associate-*l*65.9%
metadata-eval65.9%
Applied egg-rr65.9%
expm1-def65.9%
expm1-log1p66.2%
associate-*r/66.5%
associate-*l/68.6%
*-commutative68.6%
Simplified68.6%
clear-num68.6%
un-div-inv68.6%
associate-*r*68.6%
metadata-eval68.6%
div-inv68.6%
*-commutative68.6%
frac-times69.7%
Applied egg-rr69.7%
sqrt-div82.5%
div-inv82.5%
Applied egg-rr82.5%
associate-*r/82.5%
*-rgt-identity82.5%
Simplified82.5%
if 2.4000000000000001e189 < h Initial program 38.6%
Simplified38.6%
expm1-log1p-u38.6%
expm1-udef38.6%
div-inv38.6%
associate-*l*38.6%
metadata-eval38.6%
Applied egg-rr38.6%
expm1-def38.6%
expm1-log1p38.6%
associate-*r/39.1%
associate-*l/39.1%
*-commutative39.1%
Simplified39.1%
clear-num39.1%
un-div-inv39.1%
associate-*r*39.1%
metadata-eval39.1%
div-inv39.1%
*-commutative39.1%
frac-times39.1%
Applied egg-rr39.1%
sqrt-div80.0%
div-inv80.0%
Applied egg-rr67.8%
associate-*r/80.0%
*-rgt-identity80.0%
Simplified67.9%
Final simplification78.2%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -1e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (- 1.0 (* 0.5 (* h (/ (pow (* M (* 0.5 (/ D d))) 2.0) l))))))
(if (<= l 5.4e-191)
(*
(sqrt (/ d h))
(*
(/ (sqrt d) (sqrt l))
(-
1.0
(*
0.5
(/ h (* (/ d D) (* (/ 2.0 M) (/ l (* (/ D d) (* 0.5 M))))))))))
(*
(/ (sqrt d) (sqrt h))
(*
t_0
(- 1.0 (* 0.5 (/ h (/ l (pow (/ (* M D) (* d 2.0)) 2.0)))))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (pow((M * (0.5 * (D / d))), 2.0) / l)))));
} else if (l <= 5.4e-191) {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / pow(((M * D) / (d * 2.0)), 2.0))))));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 = sqrt((d / l))
if (l <= (-1d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0d0 - (0.5d0 * (h * (((m * (0.5d0 * (d_1 / d))) ** 2.0d0) / l)))))
else if (l <= 5.4d-191) then
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0d0 - (0.5d0 * (h / ((d / d_1) * ((2.0d0 / m) * (l / ((d_1 / d) * (0.5d0 * m)))))))))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -1e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (Math.pow((M * (0.5 * (D / d))), 2.0) / l)))));
} else if (l <= 5.4e-191) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) / (d * 2.0)), 2.0))))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -1e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (math.pow((M * (0.5 * (D / d))), 2.0) / l))))) elif l <= 5.4e-191: tmp = math.sqrt((d / h)) * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M))))))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / math.pow(((M * D) / (d * 2.0)), 2.0)))))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0) / l)))))); elseif (l <= 5.4e-191) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(Float64(d / D) * Float64(Float64(2.0 / M) * Float64(l / Float64(Float64(D / d) * Float64(0.5 * M)))))))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -1e-310)
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (1.0 - (0.5 * (h * (((M * (0.5 * (D / d))) ^ 2.0) / l)))));
elseif (l <= 5.4e-191)
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * (1.0 - (0.5 * (h / ((d / D) * ((2.0 / M) * (l / ((D / d) * (0.5 * M)))))))));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (0.5 * (h / (l / (((M * D) / (d * 2.0)) ^ 2.0))))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.4e-191], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(N[(d / D), $MachinePrecision] * N[(N[(2.0 / M), $MachinePrecision] * N[(l / N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 5.4 \cdot 10^{-191}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{d}{D} \cdot \left(\frac{2}{M} \cdot \frac{\ell}{\frac{D}{d} \cdot \left(0.5 \cdot M\right)}\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}}}\right)\right)\\
\end{array}
\end{array}
if l < -9.999999999999969e-311Initial program 62.4%
Simplified63.2%
expm1-log1p-u62.7%
expm1-udef62.7%
div-inv62.7%
associate-*l*62.7%
metadata-eval62.7%
Applied egg-rr62.7%
expm1-def62.7%
expm1-log1p63.2%
associate-*r/68.1%
associate-*l/68.8%
*-commutative68.8%
Simplified68.8%
frac-2neg68.8%
sqrt-div82.3%
Applied egg-rr82.3%
if -9.999999999999969e-311 < l < 5.39999999999999998e-191Initial program 62.3%
Simplified62.3%
expm1-log1p-u62.3%
expm1-udef62.3%
div-inv62.3%
associate-*l*62.3%
metadata-eval62.3%
Applied egg-rr62.3%
expm1-def62.3%
expm1-log1p62.3%
associate-*r/63.1%
associate-*l/63.1%
*-commutative63.1%
Simplified63.1%
clear-num63.1%
un-div-inv63.1%
associate-*r*63.1%
metadata-eval63.1%
div-inv63.1%
*-commutative63.1%
frac-times63.1%
Applied egg-rr63.1%
sqrt-div83.2%
div-inv83.2%
Applied egg-rr83.2%
associate-*r/83.2%
*-rgt-identity83.2%
Simplified83.2%
*-un-lft-identity63.1%
unpow263.1%
times-frac63.5%
clear-num63.5%
times-frac63.4%
times-frac63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr87.6%
associate-*l*87.6%
Simplified87.6%
if 5.39999999999999998e-191 < l Initial program 61.2%
Simplified60.1%
expm1-log1p-u59.8%
expm1-udef59.8%
div-inv59.8%
associate-*l*59.8%
metadata-eval59.8%
Applied egg-rr59.8%
expm1-def59.8%
expm1-log1p60.1%
associate-*r/60.3%
associate-*l/62.4%
*-commutative62.4%
Simplified62.4%
clear-num62.4%
un-div-inv62.4%
associate-*r*62.4%
metadata-eval62.4%
div-inv62.4%
*-commutative62.4%
frac-times63.5%
Applied egg-rr63.5%
sqrt-div89.4%
div-inv89.3%
Applied egg-rr77.6%
associate-*r/89.4%
*-rgt-identity89.4%
Simplified77.6%
Final simplification81.1%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= D 0.235)
(fabs (/ d (sqrt (* h l))))
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (/ h (/ l (pow (* (* M D) (/ 0.5 d)) 2.0)))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 0.235) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h / (l / pow(((M * D) * (0.5 / d)), 2.0))))));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (d_1 <= 0.235d0) then
tmp = abs((d / sqrt((h * l))))
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h / (l / (((m * d_1) * (0.5d0 / d)) ** 2.0d0))))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 0.235) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h / (l / Math.pow(((M * D) * (0.5 / d)), 2.0))))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 0.235: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h / (l / math.pow(((M * D) * (0.5 / d)), 2.0)))))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 0.235) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(l / (Float64(Float64(M * D) * Float64(0.5 / d)) ^ 2.0))))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 0.235)
tmp = abs((d / sqrt((h * l))));
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (h / (l / (((M * D) * (0.5 / d)) ^ 2.0))))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[D, 0.235], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(l / N[Power[N[(N[(M * D), $MachinePrecision] * N[(0.5 / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 0.235:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{{\left(\left(M \cdot D\right) \cdot \frac{0.5}{d}\right)}^{2}}}\right)\right)\\
\end{array}
\end{array}
if D < 0.23499999999999999Initial program 65.5%
Taylor expanded in d around inf 27.6%
add-sqr-sqrt24.6%
sqrt-unprod37.3%
pow237.3%
sqrt-div37.3%
metadata-eval37.3%
un-div-inv37.3%
Applied egg-rr37.3%
unpow237.3%
rem-sqrt-square52.2%
Simplified52.2%
if 0.23499999999999999 < D Initial program 50.8%
Simplified52.4%
expm1-log1p-u51.9%
expm1-udef51.9%
div-inv51.9%
associate-*l*51.9%
metadata-eval51.9%
Applied egg-rr51.9%
expm1-def51.9%
expm1-log1p52.4%
associate-*r/52.9%
associate-*l/56.2%
*-commutative56.2%
Simplified56.2%
clear-num56.1%
un-div-inv56.1%
associate-*r*56.1%
metadata-eval56.1%
div-inv56.1%
*-commutative56.1%
frac-times54.5%
Applied egg-rr54.5%
clear-num54.4%
associate-/r/54.5%
*-commutative54.5%
associate-/r*54.5%
metadata-eval54.5%
Applied egg-rr54.5%
Final simplification52.8%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= D 0.46)
(fabs (/ d (sqrt (* h l))))
(*
(/ 1.0 (sqrt (/ h d)))
(*
(sqrt (/ d l))
(-
1.0
(* 0.5 (/ h (* (/ l (* (/ D d) (* 0.5 M))) (* (/ d D) (/ 2.0 M))))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 0.46) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (d_1 <= 0.46d0) then
tmp = abs((d / sqrt((h * l))))
else
tmp = (1.0d0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (h / ((l / ((d_1 / d) * (0.5d0 * m))) * ((d / d_1) * (2.0d0 / m)))))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (D <= 0.46) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = (1.0 / Math.sqrt((h / d))) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if D <= 0.46: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = (1.0 / math.sqrt((h / d))) * (math.sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M))))))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (D <= 0.46) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(Float64(1.0 / sqrt(Float64(h / d))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(h / Float64(Float64(l / Float64(Float64(D / d) * Float64(0.5 * M))) * Float64(Float64(d / D) * Float64(2.0 / M)))))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (D <= 0.46)
tmp = abs((d / sqrt((h * l))));
else
tmp = (1.0 / sqrt((h / d))) * (sqrt((d / l)) * (1.0 - (0.5 * (h / ((l / ((D / d) * (0.5 * M))) * ((d / D) * (2.0 / M)))))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[D, 0.46], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h / N[(N[(l / N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(d / D), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;D \leq 0.46:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{h}{d}}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \frac{h}{\frac{\ell}{\frac{D}{d} \cdot \left(0.5 \cdot M\right)} \cdot \left(\frac{d}{D} \cdot \frac{2}{M}\right)}\right)\right)\\
\end{array}
\end{array}
if D < 0.46000000000000002Initial program 65.5%
Taylor expanded in d around inf 27.6%
add-sqr-sqrt24.6%
sqrt-unprod37.3%
pow237.3%
sqrt-div37.3%
metadata-eval37.3%
un-div-inv37.3%
Applied egg-rr37.3%
unpow237.3%
rem-sqrt-square52.2%
Simplified52.2%
if 0.46000000000000002 < D Initial program 50.8%
Simplified52.4%
expm1-log1p-u51.9%
expm1-udef51.9%
div-inv51.9%
associate-*l*51.9%
metadata-eval51.9%
Applied egg-rr51.9%
expm1-def51.9%
expm1-log1p52.4%
associate-*r/52.9%
associate-*l/56.2%
*-commutative56.2%
Simplified56.2%
clear-num56.1%
un-div-inv56.1%
associate-*r*56.1%
metadata-eval56.1%
div-inv56.1%
*-commutative56.1%
frac-times54.5%
Applied egg-rr54.5%
clear-num54.4%
sqrt-div55.3%
metadata-eval55.3%
Applied egg-rr55.3%
*-un-lft-identity55.3%
unpow255.3%
times-frac55.3%
clear-num55.3%
times-frac55.3%
times-frac58.5%
div-inv58.5%
metadata-eval58.5%
Applied egg-rr58.5%
Final simplification53.7%
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* D (* M (/ 0.5 d)))))
(if (<= D 0.215)
(fabs (/ d (sqrt (* h l))))
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (- 1.0 (* 0.5 (* t_0 (* (/ h l) t_0)))))))))D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = D * (M * (0.5 / d));
double tmp;
if (D <= 0.215) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 = d_1 * (m * (0.5d0 / d))
if (d_1 <= 0.215d0) then
tmp = abs((d / sqrt((h * l))))
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (0.5d0 * (t_0 * ((h / l) * t_0)))))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = D * (M * (0.5 / d));
double tmp;
if (D <= 0.215) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = D * (M * (0.5 / d)) tmp = 0 if D <= 0.215: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0))))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(M * Float64(0.5 / d))) tmp = 0.0 if (D <= 0.215) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64(t_0 * Float64(Float64(h / l) * t_0)))))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = D * (M * (0.5 / d));
tmp = 0.0;
if (D <= 0.215)
tmp = abs((d / sqrt((h * l))));
else
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (0.5 * (t_0 * ((h / l) * t_0)))));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[D, 0.215], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := D \cdot \left(M \cdot \frac{0.5}{d}\right)\\
\mathbf{if}\;D \leq 0.215:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(t_0 \cdot \left(\frac{h}{\ell} \cdot t_0\right)\right)\right)\right)\\
\end{array}
\end{array}
if D < 0.214999999999999997Initial program 65.5%
Taylor expanded in d around inf 27.6%
add-sqr-sqrt24.6%
sqrt-unprod37.3%
pow237.3%
sqrt-div37.3%
metadata-eval37.3%
un-div-inv37.3%
Applied egg-rr37.3%
unpow237.3%
rem-sqrt-square52.2%
Simplified52.2%
if 0.214999999999999997 < D Initial program 50.8%
Simplified52.4%
expm1-log1p-u51.9%
expm1-udef51.9%
div-inv51.9%
associate-*l*51.9%
metadata-eval51.9%
Applied egg-rr51.9%
expm1-def51.9%
expm1-log1p52.4%
associate-*r/52.9%
associate-*l/56.2%
*-commutative56.2%
Simplified56.2%
clear-num56.1%
un-div-inv56.1%
associate-*r*56.1%
metadata-eval56.1%
div-inv56.1%
*-commutative56.1%
frac-times54.5%
Applied egg-rr54.5%
associate-/r/50.8%
unpow250.8%
associate-*r*50.9%
div-inv50.9%
associate-*l*50.9%
*-commutative50.9%
associate-/r*50.9%
metadata-eval50.9%
div-inv50.9%
associate-*l*52.6%
*-commutative52.6%
associate-/r*52.6%
metadata-eval52.6%
Applied egg-rr52.6%
Final simplification52.3%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= M 1.9e+70) (fabs (/ d (sqrt (* h l)))) (* d (pow (/ 1.0 (pow (* h l) 3.0)) 0.16666666666666666))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 1.9e+70) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = d * pow((1.0 / pow((h * l), 3.0)), 0.16666666666666666);
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (m <= 1.9d+70) then
tmp = abs((d / sqrt((h * l))))
else
tmp = d * ((1.0d0 / ((h * l) ** 3.0d0)) ** 0.16666666666666666d0)
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 1.9e+70) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = d * Math.pow((1.0 / Math.pow((h * l), 3.0)), 0.16666666666666666);
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 1.9e+70: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = d * math.pow((1.0 / math.pow((h * l), 3.0)), 0.16666666666666666) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 1.9e+70) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d * (Float64(1.0 / (Float64(h * l) ^ 3.0)) ^ 0.16666666666666666)); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (M <= 1.9e+70)
tmp = abs((d / sqrt((h * l))));
else
tmp = d * ((1.0 / ((h * l) ^ 3.0)) ^ 0.16666666666666666);
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 1.9e+70], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(1.0 / N[Power[N[(h * l), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.9 \cdot 10^{+70}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\frac{1}{{\left(h \cdot \ell\right)}^{3}}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if M < 1.8999999999999999e70Initial program 61.1%
Taylor expanded in d around inf 28.0%
add-sqr-sqrt25.0%
sqrt-unprod37.9%
pow237.9%
sqrt-div37.9%
metadata-eval37.9%
un-div-inv37.9%
Applied egg-rr37.9%
unpow237.9%
rem-sqrt-square52.8%
Simplified52.8%
if 1.8999999999999999e70 < M Initial program 65.8%
Taylor expanded in d around inf 16.1%
add-cbrt-cube16.1%
pow1/316.1%
pow316.1%
associate-/r*16.1%
Applied egg-rr16.1%
sqrt-pow116.1%
associate-/r*16.1%
cube-div16.1%
metadata-eval16.1%
metadata-eval16.1%
Applied egg-rr16.1%
Final simplification45.8%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= M 6.2e+26) (fabs (/ d (sqrt (* h l)))) (/ d (exp (* 0.5 (log1p (+ (* h l) -1.0)))))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 6.2e+26) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = d / exp((0.5 * log1p(((h * l) + -1.0))));
}
return tmp;
}
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 6.2e+26) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = d / Math.exp((0.5 * Math.log1p(((h * l) + -1.0))));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if M <= 6.2e+26: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = d / math.exp((0.5 * math.log1p(((h * l) + -1.0)))) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (M <= 6.2e+26) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d / exp(Float64(0.5 * log1p(Float64(Float64(h * l) + -1.0))))); end return tmp end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[M, 6.2e+26], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Exp[N[(0.5 * N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 6.2 \cdot 10^{+26}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{e^{0.5 \cdot \mathsf{log1p}\left(h \cdot \ell + -1\right)}}\\
\end{array}
\end{array}
if M < 6.1999999999999999e26Initial program 60.9%
Taylor expanded in d around inf 28.4%
add-sqr-sqrt25.4%
sqrt-unprod37.0%
pow237.0%
sqrt-div37.0%
metadata-eval37.0%
un-div-inv37.0%
Applied egg-rr37.0%
unpow237.0%
rem-sqrt-square52.2%
Simplified52.2%
if 6.1999999999999999e26 < M Initial program 65.5%
Taylor expanded in d around inf 16.7%
expm1-log1p-u12.1%
expm1-udef7.3%
sqrt-div8.2%
metadata-eval8.2%
un-div-inv8.2%
Applied egg-rr8.2%
expm1-def13.1%
expm1-log1p17.7%
Simplified17.7%
pow1/217.7%
pow-to-exp16.7%
Applied egg-rr16.7%
log1p-expm1-u20.2%
expm1-udef20.2%
add-exp-log20.2%
Applied egg-rr20.2%
Final simplification44.7%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -5e-310) (fabs (/ d (sqrt (* h l)))) (* d (* (pow l -0.5) (pow h -0.5)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (h <= (-5d-310)) then
tmp = abs((d / sqrt((h * l))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -5e-310: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -5e-310)
tmp = abs((d / sqrt((h * l))));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 62.4%
Taylor expanded in d around inf 7.9%
add-sqr-sqrt1.8%
sqrt-unprod35.4%
pow235.4%
sqrt-div35.4%
metadata-eval35.4%
un-div-inv35.5%
Applied egg-rr35.5%
unpow235.5%
rem-sqrt-square47.8%
Simplified47.8%
if -4.999999999999985e-310 < h Initial program 61.4%
Taylor expanded in d around inf 46.8%
expm1-log1p-u45.3%
expm1-udef31.6%
sqrt-div32.3%
metadata-eval32.3%
un-div-inv32.3%
Applied egg-rr32.3%
expm1-def46.0%
expm1-log1p47.5%
Simplified47.5%
clear-num47.5%
associate-/r/47.5%
pow1/247.5%
pow-flip47.5%
metadata-eval47.5%
Applied egg-rr47.5%
*-commutative47.5%
unpow-prod-down54.9%
Applied egg-rr54.9%
Final simplification51.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (let* ((t_0 (/ d (sqrt (* h l))))) (if (<= M 2.6e+70) (fabs t_0) t_0)))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((h * l));
double tmp;
if (M <= 2.6e+70) {
tmp = fabs(t_0);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 = d / sqrt((h * l))
if (m <= 2.6d+70) then
tmp = abs(t_0)
else
tmp = t_0
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / Math.sqrt((h * l));
double tmp;
if (M <= 2.6e+70) {
tmp = Math.abs(t_0);
} else {
tmp = t_0;
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = d / math.sqrt((h * l)) tmp = 0 if M <= 2.6e+70: tmp = math.fabs(t_0) else: tmp = t_0 return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (M <= 2.6e+70) tmp = abs(t_0); else tmp = t_0; end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = d / sqrt((h * l));
tmp = 0.0;
if (M <= 2.6e+70)
tmp = abs(t_0);
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 2.6e+70], N[Abs[t$95$0], $MachinePrecision], t$95$0]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;M \leq 2.6 \cdot 10^{+70}:\\
\;\;\;\;\left|t_0\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if M < 2.6e70Initial program 61.1%
Taylor expanded in d around inf 28.0%
add-sqr-sqrt25.0%
sqrt-unprod37.9%
pow237.9%
sqrt-div37.9%
metadata-eval37.9%
un-div-inv37.9%
Applied egg-rr37.9%
unpow237.9%
rem-sqrt-square52.8%
Simplified52.8%
if 2.6e70 < M Initial program 65.8%
Taylor expanded in d around inf 16.1%
expm1-log1p-u10.8%
expm1-udef6.9%
sqrt-div8.0%
metadata-eval8.0%
un-div-inv8.0%
Applied egg-rr8.0%
expm1-def12.0%
expm1-log1p17.3%
Simplified17.3%
Final simplification46.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -5e-310) (fabs (/ d (sqrt (* h l)))) (/ d (* (sqrt h) (sqrt l)))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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) :: tmp
if (h <= (-5d-310)) then
tmp = abs((d / sqrt((h * l))))
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -5e-310: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -5e-310)
tmp = abs((d / sqrt((h * l))));
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 62.4%
Taylor expanded in d around inf 7.9%
add-sqr-sqrt1.8%
sqrt-unprod35.4%
pow235.4%
sqrt-div35.4%
metadata-eval35.4%
un-div-inv35.5%
Applied egg-rr35.5%
unpow235.5%
rem-sqrt-square47.8%
Simplified47.8%
if -4.999999999999985e-310 < h Initial program 61.4%
Taylor expanded in d around inf 46.8%
expm1-log1p-u45.3%
expm1-udef31.6%
sqrt-div32.3%
metadata-eval32.3%
un-div-inv32.3%
Applied egg-rr32.3%
expm1-def46.0%
expm1-log1p47.5%
Simplified47.5%
*-commutative47.5%
sqrt-prod54.8%
Applied egg-rr54.8%
Final simplification51.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* h l) -0.5)))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -0.5);
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 * l) ** (-0.5d0))
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((h * l), -0.5);
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -0.5);
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 62.0%
Taylor expanded in d around inf 25.7%
expm1-log1p-u25.3%
expm1-udef17.2%
inv-pow17.2%
sqrt-pow117.5%
metadata-eval17.5%
Applied egg-rr17.5%
expm1-def25.6%
expm1-log1p26.0%
Simplified26.0%
Final simplification26.0%
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* h l))))
D = abs(D);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
NOTE: D should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
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 / sqrt((h * l))
end function
D = Math.abs(D);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((h * l));
}
D = abs(D) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
D = abs(D) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
D = abs(D)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
end
NOTE: D should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D = |D|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 62.0%
Taylor expanded in d around inf 25.7%
expm1-log1p-u22.2%
expm1-udef15.9%
sqrt-div16.2%
metadata-eval16.2%
un-div-inv16.2%
Applied egg-rr16.2%
expm1-def22.5%
expm1-log1p26.0%
Simplified26.0%
Final simplification26.0%
herbie shell --seed 2023310
(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)))))