
(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 20 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 (pow (/ (* D M) (* d 2.0)) 2.0)) (t_1 (sqrt (- d))))
(if (<= l -4e-310)
(*
(/ t_1 (sqrt (- l)))
(*
(/ t_1 (sqrt (- h)))
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M (* d 2.0))) 2.0))) l))))
(if (<= l 7.4e-132)
(*
(* (sqrt (/ d h)) (/ (sqrt d) (sqrt l)))
(- 1.0 (* 0.5 (* h (/ t_0 l)))))
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double t_1 = sqrt(-d);
double tmp;
if (l <= -4e-310) {
tmp = (t_1 / sqrt(-l)) * ((t_1 / sqrt(-h)) * (1.0 + ((h * (-0.5 * pow((D * (M / (d * 2.0))), 2.0))) / l)));
} else if (l <= 7.4e-132) {
tmp = (sqrt((d / h)) * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * (h * (t_0 / l))));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0))) / l)))); elseif (l <= 7.4e-132) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l))))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.4e-132], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 7.4 \cdot 10^{-132}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 63.1%
Simplified63.1%
frac-2neg63.1%
sqrt-div68.9%
Applied egg-rr68.9%
associate-*l/78.1%
*-commutative78.1%
add-sqr-sqrt78.1%
pow278.1%
sqrt-pow178.1%
metadata-eval78.1%
pow178.1%
associate-/l/78.1%
Applied egg-rr78.1%
frac-2neg78.1%
sqrt-div94.0%
Applied egg-rr94.0%
if -3.999999999999988e-310 < l < 7.4000000000000004e-132Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 7.4000000000000004e-132 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification87.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (pow (/ (* D M) (* d 2.0)) 2.0))
(t_2 (sqrt (- d)))
(t_3
(*
(/ t_2 (sqrt (- l)))
(*
t_0
(+
1.0
(/ (pow (* (/ (* M (/ D 2.0)) d) (sqrt (* h -0.5))) 2.0) l))))))
(if (<= l -1.3e+64)
t_3
(if (<= l -3.25e-155)
(*
(/ t_2 (sqrt (- h)))
(*
(sqrt (/ d l))
(* h (- (fma (/ (pow (* D (/ M d)) 2.0) l) 0.125 (/ -1.0 h))))))
(if (<= l -4e-310)
t_3
(if (<= l 1.95e-130)
(* (* t_0 (/ (sqrt d) (sqrt l))) (- 1.0 (* 0.5 (* h (/ t_1 l)))))
(* d (/ (fma (* -0.5 (/ h l)) t_1 1.0) (* (sqrt l) (sqrt h))))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = pow(((D * M) / (d * 2.0)), 2.0);
double t_2 = sqrt(-d);
double t_3 = (t_2 / sqrt(-l)) * (t_0 * (1.0 + (pow((((M * (D / 2.0)) / d) * sqrt((h * -0.5))), 2.0) / l)));
double tmp;
if (l <= -1.3e+64) {
tmp = t_3;
} else if (l <= -3.25e-155) {
tmp = (t_2 / sqrt(-h)) * (sqrt((d / l)) * (h * -fma((pow((D * (M / d)), 2.0) / l), 0.125, (-1.0 / h))));
} else if (l <= -4e-310) {
tmp = t_3;
} else if (l <= 1.95e-130) {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * (h * (t_1 / l))));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_1, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_2 = sqrt(Float64(-d)) t_3 = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(Float64(M * Float64(D / 2.0)) / d) * sqrt(Float64(h * -0.5))) ^ 2.0) / l)))) tmp = 0.0 if (l <= -1.3e+64) tmp = t_3; elseif (l <= -3.25e-155) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(h * Float64(-fma(Float64((Float64(D * Float64(M / d)) ^ 2.0) / l), 0.125, Float64(-1.0 / h)))))); elseif (l <= -4e-310) tmp = t_3; elseif (l <= 1.95e-130) tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_1 / l))))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_1, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(N[(M * N[(D / 2.0), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.3e+64], t$95$3, If[LessEqual[l, -3.25e-155], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * (-N[(N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], t$95$3, If[LessEqual[l, 1.95e-130], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_2 := \sqrt{-d}\\
t_3 := \frac{t\_2}{\sqrt{-\ell}} \cdot \left(t\_0 \cdot \left(1 + \frac{{\left(\frac{M \cdot \frac{D}{2}}{d} \cdot \sqrt{h \cdot -0.5}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{if}\;\ell \leq -1.3 \cdot 10^{+64}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\ell \leq -3.25 \cdot 10^{-155}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-\mathsf{fma}\left(\frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;\ell \leq 1.95 \cdot 10^{-130}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_1, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.29999999999999998e64 or -3.25e-155 < l < -3.999999999999988e-310Initial program 59.1%
Simplified59.0%
frac-2neg59.0%
sqrt-div67.7%
Applied egg-rr67.7%
associate-*l/80.9%
*-commutative80.9%
add-sqr-sqrt80.9%
pow280.9%
sqrt-pow180.9%
metadata-eval80.9%
pow180.9%
associate-/l/80.9%
Applied egg-rr80.9%
add-sqr-sqrt80.9%
*-un-lft-identity80.9%
times-frac80.9%
associate-*r*80.9%
sqrt-prod81.0%
sqrt-pow164.0%
metadata-eval64.0%
pow164.0%
associate-*r/64.0%
Applied egg-rr84.5%
/-rgt-identity84.5%
associate-*r/84.5%
unpow284.5%
*-commutative84.5%
*-commutative84.5%
associate-/r*84.5%
associate-*l/84.5%
Simplified84.5%
if -1.29999999999999998e64 < l < -3.25e-155Initial program 71.3%
Simplified68.9%
Taylor expanded in h around -inf 42.0%
mul-1-neg42.0%
distribute-rgt-neg-in42.0%
*-commutative42.0%
fma-neg42.0%
Simplified72.2%
frac-2neg72.2%
sqrt-div96.9%
Applied egg-rr97.1%
if -3.999999999999988e-310 < l < 1.95e-130Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 1.95e-130 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification85.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (- d)))
(t_2 (/ t_1 (sqrt (- l))))
(t_3 (pow (/ (* D M) (* d 2.0)) 2.0)))
(if (<= l -6.5e-123)
(*
t_2
(*
(/ t_1 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D (/ (/ M 2.0) d)) 2.0))))))
(if (<= l -4e-310)
(*
t_2
(*
t_0
(+ 1.0 (/ (pow (* (/ (* M (/ D 2.0)) d) (sqrt (* h -0.5))) 2.0) l))))
(if (<= l 4.35e-131)
(* (* t_0 (/ (sqrt d) (sqrt l))) (- 1.0 (* 0.5 (* h (/ t_3 l)))))
(* d (/ (fma (* -0.5 (/ h l)) t_3 1.0) (* (sqrt l) (sqrt h)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = sqrt(-d);
double t_2 = t_1 / sqrt(-l);
double t_3 = pow(((D * M) / (d * 2.0)), 2.0);
double tmp;
if (l <= -6.5e-123) {
tmp = t_2 * ((t_1 / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D * ((M / 2.0) / d)), 2.0)))));
} else if (l <= -4e-310) {
tmp = t_2 * (t_0 * (1.0 + (pow((((M * (D / 2.0)) / d) * sqrt((h * -0.5))), 2.0) / l)));
} else if (l <= 4.35e-131) {
tmp = (t_0 * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * (h * (t_3 / l))));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_3, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(-d)) t_2 = Float64(t_1 / sqrt(Float64(-l))) t_3 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 tmp = 0.0 if (l <= -6.5e-123) tmp = Float64(t_2 * Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0)))))); elseif (l <= -4e-310) tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 + Float64((Float64(Float64(Float64(M * Float64(D / 2.0)) / d) * sqrt(Float64(h * -0.5))) ^ 2.0) / l)))); elseif (l <= 4.35e-131) tmp = Float64(Float64(t_0 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_3 / l))))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_3, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -6.5e-123], N[(t$95$2 * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(t$95$2 * N[(t$95$0 * N[(1.0 + N[(N[Power[N[(N[(N[(M * N[(D / 2.0), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.35e-131], N[(N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$3 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$3 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-\ell}}\\
t_3 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq -6.5 \cdot 10^{-123}:\\
\;\;\;\;t\_2 \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot \left(1 + \frac{{\left(\frac{M \cdot \frac{D}{2}}{d} \cdot \sqrt{h \cdot -0.5}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.35 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_3}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_3, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.49999999999999938e-123Initial program 56.1%
Simplified56.0%
frac-2neg56.0%
sqrt-div64.2%
Applied egg-rr64.2%
frac-2neg70.7%
sqrt-div91.9%
Applied egg-rr85.4%
if -6.49999999999999938e-123 < l < -3.999999999999988e-310Initial program 74.6%
Simplified74.6%
frac-2neg74.6%
sqrt-div76.6%
Applied egg-rr76.6%
associate-*l/90.1%
*-commutative90.1%
add-sqr-sqrt90.1%
pow290.1%
sqrt-pow190.1%
metadata-eval90.1%
pow190.1%
associate-/l/90.1%
Applied egg-rr90.1%
add-sqr-sqrt90.1%
*-un-lft-identity90.1%
times-frac90.1%
associate-*r*90.1%
sqrt-prod90.1%
sqrt-pow171.0%
metadata-eval71.0%
pow171.0%
associate-*r/71.0%
Applied egg-rr92.3%
/-rgt-identity92.3%
associate-*r/92.2%
unpow292.2%
*-commutative92.2%
*-commutative92.2%
associate-/r*92.2%
associate-*l/92.2%
Simplified92.2%
if -3.999999999999988e-310 < l < 4.3499999999999998e-131Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 4.3499999999999998e-131 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification85.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.5 (/ h l)))
(t_1 (pow (/ (* D M) (* d 2.0)) 2.0))
(t_2 (sqrt (- d)))
(t_3 (sqrt (/ d h)))
(t_4
(*
(/ t_2 (sqrt (- l)))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M (* d 2.0))) 2.0))) l))
t_3))))
(if (<= l -5.1e+147)
t_4
(if (<= l -3.6e-128)
(*
(/ t_2 (sqrt (- h)))
(* (sqrt (/ d l)) (fma (pow (* 0.5 (* M (/ D d))) 2.0) t_0 1.0)))
(if (<= l -4e-310)
t_4
(if (<= l 8.3e-131)
(* (* t_3 (/ (sqrt d) (sqrt l))) (- 1.0 (* 0.5 (* h (/ t_1 l)))))
(* d (/ (fma t_0 t_1 1.0) (* (sqrt l) (sqrt h))))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.5 * (h / l);
double t_1 = pow(((D * M) / (d * 2.0)), 2.0);
double t_2 = sqrt(-d);
double t_3 = sqrt((d / h));
double t_4 = (t_2 / sqrt(-l)) * ((1.0 + ((h * (-0.5 * pow((D * (M / (d * 2.0))), 2.0))) / l)) * t_3);
double tmp;
if (l <= -5.1e+147) {
tmp = t_4;
} else if (l <= -3.6e-128) {
tmp = (t_2 / sqrt(-h)) * (sqrt((d / l)) * fma(pow((0.5 * (M * (D / d))), 2.0), t_0, 1.0));
} else if (l <= -4e-310) {
tmp = t_4;
} else if (l <= 8.3e-131) {
tmp = (t_3 * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * (h * (t_1 / l))));
} else {
tmp = d * (fma(t_0, t_1, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(-0.5 * Float64(h / l)) t_1 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_2 = sqrt(Float64(-d)) t_3 = sqrt(Float64(d / h)) t_4 = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0))) / l)) * t_3)) tmp = 0.0 if (l <= -5.1e+147) tmp = t_4; elseif (l <= -3.6e-128) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * fma((Float64(0.5 * Float64(M * Float64(D / d))) ^ 2.0), t_0, 1.0))); elseif (l <= -4e-310) tmp = t_4; elseif (l <= 8.3e-131) tmp = Float64(Float64(t_3 * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_1 / l))))); else tmp = Float64(d * Float64(fma(t_0, t_1, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5.1e+147], t$95$4, If[LessEqual[l, -3.6e-128], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[(0.5 * N[(M * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], t$95$4, If[LessEqual[l, 8.3e-131], N[(N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$1 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(t$95$0 * t$95$1 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \frac{h}{\ell}\\
t_1 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \frac{t\_2}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)}{\ell}\right) \cdot t\_3\right)\\
\mathbf{if}\;\ell \leq -5.1 \cdot 10^{+147}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;\ell \leq -3.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left({\left(0.5 \cdot \left(M \cdot \frac{D}{d}\right)\right)}^{2}, t\_0, 1\right)\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;\ell \leq 8.3 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_1}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(t\_0, t\_1, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5.09999999999999999e147 or -3.60000000000000025e-128 < l < -3.999999999999988e-310Initial program 58.3%
Simplified58.3%
frac-2neg58.3%
sqrt-div67.6%
Applied egg-rr67.6%
associate-*l/81.1%
*-commutative81.1%
add-sqr-sqrt81.1%
pow281.1%
sqrt-pow181.1%
metadata-eval81.1%
pow181.1%
associate-/l/81.1%
Applied egg-rr81.1%
if -5.09999999999999999e147 < l < -3.60000000000000025e-128Initial program 71.0%
Simplified68.9%
frac-2neg73.0%
sqrt-div91.2%
Applied egg-rr87.1%
if -3.999999999999988e-310 < l < 8.29999999999999963e-131Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 8.29999999999999963e-131 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification82.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0)))
(if (<= l -4e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* (sqrt (/ d l)) (fma (/ (pow (* D (/ M d)) 2.0) l) (* h -0.125) 1.0)))
(if (<= l 1.04e-131)
(*
(* (sqrt (/ d h)) (/ (sqrt d) (sqrt l)))
(- 1.0 (* 0.5 (* h (/ t_0 l)))))
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double tmp;
if (l <= -4e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * fma((pow((D * (M / d)), 2.0) / l), (h * -0.125), 1.0));
} else if (l <= 1.04e-131) {
tmp = (sqrt((d / h)) * (sqrt(d) / sqrt(l))) * (1.0 - (0.5 * (h * (t_0 / l))));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * fma(Float64((Float64(D * Float64(M / d)) ^ 2.0) / l), Float64(h * -0.125), 1.0))); elseif (l <= 1.04e-131) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l))))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.04e-131], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{{\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}, h \cdot -0.125, 1\right)\right)\\
\mathbf{elif}\;\ell \leq 1.04 \cdot 10^{-131}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 63.1%
Simplified61.5%
Taylor expanded in M around 0 38.2%
+-commutative38.2%
associate-*r/38.2%
associate-*r*38.3%
associate-*r*38.3%
associate-*l/39.0%
associate-*r/39.0%
*-commutative39.0%
associate-*l*39.0%
fma-define39.0%
Simplified68.4%
frac-2neg78.1%
sqrt-div94.0%
Applied egg-rr81.1%
if -3.999999999999988e-310 < l < 1.04e-131Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 1.04e-131 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification81.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0))
(t_1 (- 1.0 (* 0.5 (* h (/ t_0 l)))))
(t_2 (sqrt (/ d l)))
(t_3 (sqrt (/ d h))))
(if (<= l -1e-124)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D (/ (/ M 2.0) d)) 2.0)))))
t_2)
(if (<= l -4e-310)
(* t_1 (* t_3 t_2))
(if (<= l 6.5e-131)
(* (* t_3 (/ (sqrt d) (sqrt l))) t_1)
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double t_1 = 1.0 - (0.5 * (h * (t_0 / l)));
double t_2 = sqrt((d / l));
double t_3 = sqrt((d / h));
double tmp;
if (l <= -1e-124) {
tmp = ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D * ((M / 2.0) / d)), 2.0))))) * t_2;
} else if (l <= -4e-310) {
tmp = t_1 * (t_3 * t_2);
} else if (l <= 6.5e-131) {
tmp = (t_3 * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) t_2 = sqrt(Float64(d / l)) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1e-124) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0))))) * t_2); elseif (l <= -4e-310) tmp = Float64(t_1 * Float64(t_3 * t_2)); elseif (l <= 6.5e-131) tmp = Float64(Float64(t_3 * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-124], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, -4e-310], N[(t$95$1 * N[(t$95$3 * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-131], N[(N[(t$95$3 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_1 := 1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-124}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(t\_3 \cdot t\_2\right)\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-131}:\\
\;\;\;\;\left(t\_3 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -9.99999999999999933e-125Initial program 56.6%
Simplified56.5%
frac-2neg71.1%
sqrt-div92.0%
Applied egg-rr72.3%
if -9.99999999999999933e-125 < l < -3.999999999999988e-310Initial program 74.1%
Simplified69.8%
associate-*r/77.6%
frac-times81.9%
associate-/l*77.6%
*-commutative77.6%
Applied egg-rr77.6%
*-commutative77.6%
associate-/l*77.6%
associate-*r/81.9%
*-commutative81.9%
Simplified81.9%
if -3.999999999999988e-310 < l < 6.5000000000000002e-131Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 6.5000000000000002e-131 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification79.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0)) (t_1 (sqrt (- d))))
(if (<= d -2.15e-156)
(*
(- 1.0 (* 0.5 (* h (/ t_0 l))))
(* (/ t_1 (sqrt (- h))) (sqrt (/ d l))))
(if (<= d -5e-310)
(*
(/ t_1 (sqrt (- l)))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* D (/ M (* d 2.0))) 2.0))) l))
(sqrt (/ d h))))
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double t_1 = sqrt(-d);
double tmp;
if (d <= -2.15e-156) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * ((t_1 / sqrt(-h)) * sqrt((d / l)));
} else if (d <= -5e-310) {
tmp = (t_1 / sqrt(-l)) * ((1.0 + ((h * (-0.5 * pow((D * (M / (d * 2.0))), 2.0))) / l)) * sqrt((d / h)));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_1 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -2.15e-156) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) * Float64(Float64(t_1 / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); elseif (d <= -5e-310) tmp = Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0))) / l)) * sqrt(Float64(d / h)))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2.15e-156], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;d \leq -2.15 \cdot 10^{-156}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right) \cdot \left(\frac{t\_1}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-\ell}} \cdot \left(\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}\right)}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.14999999999999989e-156Initial program 71.7%
Simplified69.5%
associate-*r/76.6%
frac-times78.8%
associate-/l*76.6%
*-commutative76.6%
Applied egg-rr76.6%
*-commutative76.6%
associate-/l*76.6%
associate-*r/78.8%
*-commutative78.8%
Simplified78.8%
frac-2neg83.3%
sqrt-div96.2%
Applied egg-rr89.5%
if -2.14999999999999989e-156 < d < -4.999999999999985e-310Initial program 38.3%
Simplified38.3%
frac-2neg38.3%
sqrt-div56.4%
Applied egg-rr56.4%
associate-*l/62.9%
*-commutative62.9%
add-sqr-sqrt62.9%
pow262.9%
sqrt-pow162.9%
metadata-eval62.9%
pow162.9%
associate-/l/62.9%
Applied egg-rr62.9%
if -4.999999999999985e-310 < d Initial program 61.9%
Simplified60.4%
Applied egg-rr73.9%
unpow173.9%
associate-*l/75.6%
associate-/l*77.0%
+-commutative77.0%
associate-*r*77.0%
fma-define77.0%
*-commutative77.0%
associate-*r/77.7%
*-commutative77.7%
Simplified77.7%
Final simplification80.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0))
(t_1 (- 1.0 (* 0.5 (* h (/ t_0 l)))))
(t_2 (sqrt (/ d h))))
(if (<= l -4e-310)
(* t_1 (* t_2 (sqrt (/ d l))))
(if (<= l 2.5e-132)
(* (* t_2 (/ (sqrt d) (sqrt l))) t_1)
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double t_1 = 1.0 - (0.5 * (h * (t_0 / l)));
double t_2 = sqrt((d / h));
double tmp;
if (l <= -4e-310) {
tmp = t_1 * (t_2 * sqrt((d / l)));
} else if (l <= 2.5e-132) {
tmp = (t_2 * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -4e-310) tmp = Float64(t_1 * Float64(t_2 * sqrt(Float64(d / l)))); elseif (l <= 2.5e-132) tmp = Float64(Float64(t_2 * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(t$95$1 * N[(t$95$2 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e-132], N[(N[(t$95$2 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_1 := 1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{-132}:\\
\;\;\;\;\left(t\_2 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 63.1%
Simplified61.5%
associate-*r/66.8%
frac-times68.4%
associate-/l*66.8%
*-commutative66.8%
Applied egg-rr66.8%
*-commutative66.8%
associate-/l*66.8%
associate-*r/68.4%
*-commutative68.4%
Simplified68.4%
if -3.999999999999988e-310 < l < 2.5e-132Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 2.5e-132 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification75.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0))
(t_1 (- 1.0 (* 0.5 (* h (/ t_0 l))))))
(if (<= l -4e-310)
(* t_1 (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))))
(if (<= l 9.6e-131)
(* (* (sqrt (/ d h)) (/ (sqrt d) (sqrt l))) t_1)
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double t_1 = 1.0 - (0.5 * (h * (t_0 / l)));
double tmp;
if (l <= -4e-310) {
tmp = t_1 * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)));
} else if (l <= 9.6e-131) {
tmp = (sqrt((d / h)) * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 t_1 = Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) tmp = 0.0 if (l <= -4e-310) tmp = Float64(t_1 * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); elseif (l <= 9.6e-131) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4e-310], N[(t$95$1 * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 9.6e-131], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
t_1 := 1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\\
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 9.6 \cdot 10^{-131}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 63.1%
Simplified61.5%
associate-*r/66.8%
frac-times68.4%
associate-/l*66.8%
*-commutative66.8%
Applied egg-rr66.8%
*-commutative66.8%
associate-/l*66.8%
associate-*r/68.4%
*-commutative68.4%
Simplified68.4%
frac-2neg78.1%
sqrt-div94.0%
Applied egg-rr78.0%
if -3.999999999999988e-310 < l < 9.5999999999999999e-131Initial program 65.6%
Simplified63.1%
associate-*r/73.4%
frac-times75.9%
associate-/l*73.4%
*-commutative73.4%
Applied egg-rr73.4%
*-commutative73.4%
associate-/l*73.4%
associate-*r/75.9%
*-commutative75.9%
Simplified75.9%
sqrt-div92.3%
Applied egg-rr92.3%
if 9.5999999999999999e-131 < l Initial program 60.3%
Simplified59.3%
Applied egg-rr73.3%
unpow173.3%
associate-*l/75.8%
associate-/l*77.8%
+-commutative77.8%
associate-*r*77.8%
fma-define77.8%
*-commutative77.8%
associate-*r/77.8%
*-commutative77.8%
Simplified77.8%
Final simplification80.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (/ (* D M) (* d 2.0)) 2.0)))
(if (<= l 6.4e-262)
(* (- 1.0 (* 0.5 (* h (/ t_0 l)))) (* (sqrt (/ d h)) (sqrt (/ d l))))
(* d (/ (fma (* -0.5 (/ h l)) t_0 1.0) (* (sqrt l) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow(((D * M) / (d * 2.0)), 2.0);
double tmp;
if (l <= 6.4e-262) {
tmp = (1.0 - (0.5 * (h * (t_0 / l)))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = d * (fma((-0.5 * (h / l)), t_0, 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0 tmp = 0.0 if (l <= 6.4e-262) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64(t_0 / l)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(fma(Float64(-0.5 * Float64(h / l)), t_0, 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, 6.4e-262], N[(N[(1.0 - N[(0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq 6.4 \cdot 10^{-262}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, t\_0, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 6.4000000000000001e-262Initial program 62.5%
Simplified61.1%
associate-*r/68.1%
frac-times69.6%
associate-/l*68.1%
*-commutative68.1%
Applied egg-rr68.1%
*-commutative68.1%
associate-/l*68.1%
associate-*r/69.6%
*-commutative69.6%
Simplified69.6%
if 6.4000000000000001e-262 < l Initial program 62.4%
Simplified60.8%
Applied egg-rr74.0%
unpow174.0%
associate-*l/75.9%
associate-/l*77.3%
+-commutative77.3%
associate-*r*77.3%
fma-define77.3%
*-commutative77.3%
associate-*r/78.2%
*-commutative78.2%
Simplified78.2%
Final simplification73.6%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.25e+157)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -1.18e-170)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D (/ (/ M 2.0) d)) 2.0))))))
(if (<= l 6.2e-298)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (* h (/ (pow (* D (/ M (* d 2.0))) 2.0) l)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (* D (/ (/ M d) 2.0)) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.25e+157) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -1.18e-170) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D * ((M / 2.0) / d)), 2.0)))));
} else if (l <= 6.2e-298) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow((D * ((M / d) / 2.0)), 2.0)));
}
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) :: tmp
if (l <= (-2.25d+157)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= (-1.18d-170)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_1 * ((m / 2.0d0) / d)) ** 2.0d0)))))
else if (l <= 6.2d-298) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * (h * (((d_1 * (m / (d * 2.0d0))) ** 2.0d0) / l))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.25e+157) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= -1.18e-170) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D * ((M / 2.0) / d)), 2.0)))));
} else if (l <= 6.2e-298) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (Math.pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2.25e+157: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= -1.18e-170: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D * ((M / 2.0) / d)), 2.0))))) elif l <= 6.2e-298: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (math.pow((D * (M / (d * 2.0))), 2.0) / l)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.25e+157) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -1.18e-170) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0)))))); elseif (l <= 6.2e-298) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2.25e+157) tmp = -d * sqrt(((1.0 / l) / h)); elseif (l <= -1.18e-170) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((D * ((M / 2.0) / d)) ^ 2.0))))); elseif (l <= 6.2e-298) tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (((D * (M / (d * 2.0))) ^ 2.0) / l)))); else tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * ((D * ((M / d) / 2.0)) ^ 2.0))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.25e+157], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.18e-170], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.2e-298], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.25 \cdot 10^{+157}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -1.18 \cdot 10^{-170}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 6.2 \cdot 10^{-298}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -2.24999999999999992e157Initial program 37.1%
Simplified37.1%
Taylor expanded in d around inf 5.8%
associate-/r*5.8%
Simplified5.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.1%
neg-mul-152.1%
Simplified52.1%
if -2.24999999999999992e157 < l < -1.18e-170Initial program 68.4%
Simplified68.3%
if -1.18e-170 < l < 6.2000000000000003e-298Initial program 74.7%
Simplified71.8%
associate-*r/83.6%
frac-times86.5%
associate-/l*83.6%
*-commutative83.6%
Applied egg-rr83.6%
*-commutative83.6%
associate-/l*83.6%
associate-*r/86.5%
*-commutative86.5%
Simplified86.5%
pow186.5%
sqrt-unprod86.5%
associate-*r*86.5%
associate-/l*86.5%
Applied egg-rr86.5%
unpow186.5%
associate-*l*86.5%
*-commutative86.5%
Simplified86.5%
if 6.2000000000000003e-298 < l Initial program 62.0%
Simplified60.6%
Applied egg-rr74.2%
unpow174.2%
associate-*r*74.2%
*-commutative74.2%
associate-*r/75.0%
*-commutative75.0%
associate-*r/75.0%
associate-*r*75.0%
associate-*r*75.0%
associate-/r*75.0%
Simplified75.0%
Final simplification72.4%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.25e+145)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l 4.8e-296)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (* h (/ (pow (* D (/ M (* d 2.0))) 2.0) l)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (* D (/ (/ M d) 2.0)) 2.0)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.25e+145) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= 4.8e-296) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow((D * ((M / d) / 2.0)), 2.0)));
}
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) :: tmp
if (l <= (-1.25d+145)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= 4.8d-296) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * (h * (((d_1 * (m / (d * 2.0d0))) ** 2.0d0) / l))))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.25e+145) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= 4.8e-296) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (Math.pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -1.25e+145: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= 4.8e-296: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (math.pow((D * (M / (d * 2.0))), 2.0) / l)))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.25e+145) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= 4.8e-296) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -1.25e+145) tmp = -d * sqrt(((1.0 / l) / h)); elseif (l <= 4.8e-296) tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (((D * (M / (d * 2.0))) ^ 2.0) / l)))); else tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * ((D * ((M / d) / 2.0)) ^ 2.0))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.25e+145], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e-296], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.25 \cdot 10^{+145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{-296}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -1.24999999999999992e145Initial program 35.9%
Simplified35.9%
Taylor expanded in d around inf 5.3%
associate-/r*5.3%
Simplified5.3%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.0%
neg-mul-149.0%
Simplified49.0%
if -1.24999999999999992e145 < l < 4.79999999999999992e-296Initial program 72.6%
Simplified70.4%
associate-*r/75.3%
frac-times77.4%
associate-/l*75.3%
*-commutative75.3%
Applied egg-rr75.3%
*-commutative75.3%
associate-/l*75.3%
associate-*r/77.4%
*-commutative77.4%
Simplified77.4%
pow177.4%
sqrt-unprod68.9%
associate-*r*68.9%
associate-/l*68.9%
Applied egg-rr68.9%
unpow168.9%
associate-*l*68.9%
*-commutative68.9%
Simplified68.9%
if 4.79999999999999992e-296 < l Initial program 62.0%
Simplified60.6%
Applied egg-rr74.2%
unpow174.2%
associate-*r*74.2%
*-commutative74.2%
associate-*r/75.0%
*-commutative75.0%
associate-*r/75.0%
associate-*r*75.0%
associate-*r*75.0%
associate-/r*75.0%
Simplified75.0%
Final simplification69.4%
(FPCore (d h l M D)
:precision binary64
(if (<= l 2.5e-197)
(*
(- 1.0 (* 0.5 (* h (/ (pow (/ (* D M) (* d 2.0)) 2.0) l))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (* -0.5 (/ h l)) (pow (* D (/ (/ M d) 2.0)) 2.0))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.5e-197) {
tmp = (1.0 - (0.5 * (h * (pow(((D * M) / (d * 2.0)), 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * pow((D * ((M / d) / 2.0)), 2.0)));
}
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) :: tmp
if (l <= 2.5d-197) then
tmp = (1.0d0 - (0.5d0 * (h * ((((d_1 * m) / (d * 2.0d0)) ** 2.0d0) / l)))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + (((-0.5d0) * (h / l)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.5e-197) {
tmp = (1.0 - (0.5 * (h * (Math.pow(((D * M) / (d * 2.0)), 2.0) / l)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 2.5e-197: tmp = (1.0 - (0.5 * (h * (math.pow(((D * M) / (d * 2.0)), 2.0) / l)))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.5e-197) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(-0.5 * Float64(h / l)) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 2.5e-197) tmp = (1.0 - (0.5 * (h * ((((D * M) / (d * 2.0)) ^ 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l))); else tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((-0.5 * (h / l)) * ((D * ((M / d) / 2.0)) ^ 2.0))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.5e-197], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.5 \cdot 10^{-197}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \left(-0.5 \cdot \frac{h}{\ell}\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 2.5000000000000001e-197Initial program 63.0%
Simplified61.0%
associate-*r/68.0%
frac-times70.0%
associate-/l*68.0%
*-commutative68.0%
Applied egg-rr68.0%
*-commutative68.0%
associate-/l*68.0%
associate-*r/70.0%
*-commutative70.0%
Simplified70.0%
if 2.5000000000000001e-197 < l Initial program 61.7%
Simplified60.9%
Applied egg-rr74.0%
unpow174.0%
associate-*r*74.0%
*-commutative74.0%
associate-*r/74.0%
*-commutative74.0%
associate-*r/74.1%
associate-*r*74.1%
associate-*r*74.1%
associate-/r*74.1%
Simplified74.1%
Final simplification71.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.5e+145)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l 1.56e+53)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (* h (/ (pow (* D (/ M (* d 2.0))) 2.0) l)))))
(* d (/ (pow h -0.5) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e+145) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= 1.56e+53) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = d * (pow(h, -0.5) / 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) :: tmp
if (l <= (-4.5d+145)) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else if (l <= 1.56d+53) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * (h * (((d_1 * (m / (d * 2.0d0))) ** 2.0d0) / l))))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e+145) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= 1.56e+53) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (Math.pow((D * (M / (d * 2.0))), 2.0) / l))));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -4.5e+145: tmp = -d * math.sqrt(((1.0 / l) / h)) elif l <= 1.56e+53: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (math.pow((D * (M / (d * 2.0))), 2.0) / l)))) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.5e+145) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= 1.56e+53) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0) / l))))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -4.5e+145) tmp = -d * sqrt(((1.0 / l) / h)); elseif (l <= 1.56e+53) tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * (h * (((D * (M / (d * 2.0))) ^ 2.0) / l)))); else tmp = d * ((h ^ -0.5) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.5e+145], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.56e+53], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{+145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq 1.56 \cdot 10^{+53}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.4999999999999998e145Initial program 35.9%
Simplified35.9%
Taylor expanded in d around inf 5.3%
associate-/r*5.3%
Simplified5.3%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.0%
neg-mul-149.0%
Simplified49.0%
if -4.4999999999999998e145 < l < 1.56e53Initial program 70.4%
Simplified68.6%
associate-*r/73.2%
frac-times75.1%
associate-/l*73.2%
*-commutative73.2%
Applied egg-rr73.2%
*-commutative73.2%
associate-/l*73.2%
associate-*r/75.0%
*-commutative75.0%
Simplified75.0%
pow175.0%
sqrt-unprod66.8%
associate-*r*66.8%
associate-/l*65.6%
Applied egg-rr65.6%
unpow165.6%
associate-*l*65.6%
*-commutative65.6%
Simplified65.6%
if 1.56e53 < l Initial program 55.1%
Simplified53.5%
Taylor expanded in d around inf 47.8%
associate-/r*47.8%
Simplified47.8%
sqrt-div59.0%
div-inv59.0%
inv-pow59.0%
sqrt-pow159.0%
metadata-eval59.0%
Applied egg-rr59.0%
associate-*r/59.0%
*-rgt-identity59.0%
Simplified59.0%
Final simplification62.0%
(FPCore (d h l M D) :precision binary64 (if (<= h 1e-300) (* (- d) (pow (* l h) -0.5)) (* d (/ (pow h -0.5) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1e-300) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * (pow(h, -0.5) / 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) :: tmp
if (h <= 1d-300) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1e-300) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 1e-300: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 1e-300) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 1e-300) tmp = -d * ((l * h) ^ -0.5); else tmp = d * ((h ^ -0.5) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1e-300], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 10^{-300}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < 1.00000000000000003e-300Initial program 63.4%
Simplified61.8%
associate-*r/67.1%
frac-times68.7%
associate-/l*67.1%
*-commutative67.1%
Applied egg-rr67.1%
*-commutative67.1%
associate-/l*67.1%
associate-*r/68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.6%
neg-mul-139.6%
Simplified39.6%
if 1.00000000000000003e-300 < h Initial program 61.6%
Simplified60.1%
Taylor expanded in d around inf 43.7%
associate-/r*43.7%
Simplified43.7%
sqrt-div51.5%
div-inv51.4%
inv-pow51.4%
sqrt-pow151.4%
metadata-eval51.4%
Applied egg-rr51.4%
associate-*r/51.5%
*-rgt-identity51.5%
Simplified51.5%
Final simplification45.7%
(FPCore (d h l M D) :precision binary64 (if (<= d -2.8e-91) (sqrt (* (/ d h) (/ d l))) (/ d (sqrt (* l h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.8e-91) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = d / sqrt((l * h));
}
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) :: tmp
if (d <= (-2.8d-91)) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.8e-91) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -2.8e-91: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = d / math.sqrt((l * h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.8e-91) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -2.8e-91) tmp = sqrt(((d / h) * (d / l))); else tmp = d / sqrt((l * h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.8e-91], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.8 \cdot 10^{-91}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -2.8e-91Initial program 73.6%
Simplified73.5%
clear-num72.6%
sqrt-div72.5%
metadata-eval72.5%
Applied egg-rr72.5%
Taylor expanded in d around inf 42.5%
add-sqr-sqrt42.5%
sqrt-unprod36.8%
*-commutative36.8%
*-commutative36.8%
swap-sqr36.8%
add-sqr-sqrt36.9%
frac-times36.9%
metadata-eval36.9%
add-sqr-sqrt37.0%
clear-num37.0%
Applied egg-rr37.0%
if -2.8e-91 < d Initial program 57.2%
Simplified56.2%
Taylor expanded in d around inf 36.9%
associate-/r*36.9%
Simplified36.9%
pow136.9%
*-commutative36.9%
associate-/l/36.9%
sqrt-div36.3%
metadata-eval36.3%
Applied egg-rr36.3%
unpow136.3%
associate-*l/36.4%
*-lft-identity36.4%
*-commutative36.4%
Simplified36.4%
Final simplification36.6%
(FPCore (d h l M D) :precision binary64 (if (<= d -7.5e-92) (sqrt (* (/ d h) (/ d l))) (* d (sqrt (/ 1.0 (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -7.5e-92) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = d * sqrt((1.0 / (l * h)));
}
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) :: tmp
if (d <= (-7.5d-92)) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = d * sqrt((1.0d0 / (l * h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -7.5e-92) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d * Math.sqrt((1.0 / (l * h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -7.5e-92: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = d * math.sqrt((1.0 / (l * h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -7.5e-92) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -7.5e-92) tmp = sqrt(((d / h) * (d / l))); else tmp = d * sqrt((1.0 / (l * h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -7.5e-92], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.5 \cdot 10^{-92}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -7.5000000000000005e-92Initial program 73.6%
Simplified73.5%
clear-num72.6%
sqrt-div72.5%
metadata-eval72.5%
Applied egg-rr72.5%
Taylor expanded in d around inf 42.5%
add-sqr-sqrt42.5%
sqrt-unprod36.8%
*-commutative36.8%
*-commutative36.8%
swap-sqr36.8%
add-sqr-sqrt36.9%
frac-times36.9%
metadata-eval36.9%
add-sqr-sqrt37.0%
clear-num37.0%
Applied egg-rr37.0%
if -7.5000000000000005e-92 < d Initial program 57.2%
Simplified56.2%
Taylor expanded in d around inf 36.9%
Final simplification36.9%
(FPCore (d h l M D) :precision binary64 (if (<= d -8e-92) (sqrt (* (/ d h) (/ d l))) (* d (sqrt (/ (/ 1.0 h) l)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8e-92) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = d * sqrt(((1.0 / h) / 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) :: tmp
if (d <= (-8d-92)) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8e-92) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -8e-92: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -8e-92) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -8e-92) tmp = sqrt(((d / h) * (d / l))); else tmp = d * sqrt(((1.0 / h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -8e-92], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8 \cdot 10^{-92}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -7.9999999999999999e-92Initial program 73.6%
Simplified73.5%
clear-num72.6%
sqrt-div72.5%
metadata-eval72.5%
Applied egg-rr72.5%
Taylor expanded in d around inf 42.5%
add-sqr-sqrt42.5%
sqrt-unprod36.8%
*-commutative36.8%
*-commutative36.8%
swap-sqr36.8%
add-sqr-sqrt36.9%
frac-times36.9%
metadata-eval36.9%
add-sqr-sqrt37.0%
clear-num37.0%
Applied egg-rr37.0%
if -7.9999999999999999e-92 < d Initial program 57.2%
Simplified56.2%
Taylor expanded in d around inf 36.9%
associate-/r*36.9%
Simplified36.9%
Final simplification36.9%
(FPCore (d h l M D) :precision binary64 (if (<= d -8.8e-219) (* (- d) (pow (* l h) -0.5)) (* d (sqrt (/ (/ 1.0 h) l)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8.8e-219) {
tmp = -d * pow((l * h), -0.5);
} else {
tmp = d * sqrt(((1.0 / h) / 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) :: tmp
if (d <= (-8.8d-219)) then
tmp = -d * ((l * h) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -8.8e-219) {
tmp = -d * Math.pow((l * h), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -8.8e-219: tmp = -d * math.pow((l * h), -0.5) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -8.8e-219) tmp = Float64(Float64(-d) * (Float64(l * h) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -8.8e-219) tmp = -d * ((l * h) ^ -0.5); else tmp = d * sqrt(((1.0 / h) / l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -8.8e-219], N[((-d) * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.8 \cdot 10^{-219}:\\
\;\;\;\;\left(-d\right) \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -8.7999999999999998e-219Initial program 67.5%
Simplified65.6%
associate-*r/71.7%
frac-times73.6%
associate-/l*71.7%
*-commutative71.7%
Applied egg-rr71.7%
*-commutative71.7%
associate-/l*71.7%
associate-*r/73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow-10.0%
metadata-eval0.0%
pow-sqr0.0%
rem-sqrt-square0.0%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.1%
neg-mul-145.1%
Simplified45.1%
if -8.7999999999999998e-219 < d Initial program 58.9%
Simplified57.6%
Taylor expanded in d around inf 41.3%
associate-/r*41.3%
Simplified41.3%
Final simplification42.9%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
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((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D): return d / math.sqrt((l * h))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((l * h)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 62.5%
Simplified60.9%
Taylor expanded in d around inf 27.0%
associate-/r*27.0%
Simplified27.0%
pow127.0%
*-commutative27.0%
associate-/l/27.0%
sqrt-div26.6%
metadata-eval26.6%
Applied egg-rr26.6%
unpow126.6%
associate-*l/26.7%
*-lft-identity26.7%
*-commutative26.7%
Simplified26.7%
Final simplification26.7%
herbie shell --seed 2024071
(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)))))