
(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 19 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 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (- d)))
(t_3 (sqrt (- h)))
(t_4 (sqrt (- l))))
(if (<= d -3.8e+46)
(*
(/ t_2 t_3)
(* t_0 (- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l))))))
(if (<= d -9.6e-70)
(*
t_1
(*
t_0
(- 1.0 (* 0.5 (pow (* (* 0.5 M) (* (/ D d) (/ t_3 t_4))) 2.0)))))
(if (<= d -4e-279)
(*
t_1
(*
(/ t_2 t_4)
(- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
(if (<= d 2.15e-159)
(*
-0.125
(/ (pow (* M D) 2.0) (/ d (pow (/ (cbrt (sqrt h)) (sqrt l)) 3.0))))
(if (<= d 1.35e+112)
(*
(* t_0 t_1)
(+
1.0
(* -0.125 (pow (/ (* (sqrt h) (* M D)) (* d (sqrt l))) 2.0))))
(*
(/ d (* (sqrt h) (sqrt l)))
(-
1.0
(* (/ h l) (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))))))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = sqrt(-d);
double t_3 = sqrt(-h);
double t_4 = sqrt(-l);
double tmp;
if (d <= -3.8e+46) {
tmp = (t_2 / t_3) * (t_0 * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else if (d <= -9.6e-70) {
tmp = t_1 * (t_0 * (1.0 - (0.5 * pow(((0.5 * M) * ((D / d) * (t_3 / t_4))), 2.0))));
} else if (d <= -4e-279) {
tmp = t_1 * ((t_2 / t_4) * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
} else if (d <= 2.15e-159) {
tmp = -0.125 * (pow((M * D), 2.0) / (d / pow((cbrt(sqrt(h)) / sqrt(l)), 3.0)));
} else if (d <= 1.35e+112) {
tmp = (t_0 * t_1) * (1.0 + (-0.125 * pow(((sqrt(h) * (M * D)) / (d * sqrt(l))), 2.0)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 - ((h / l) * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt(-d);
double t_3 = Math.sqrt(-h);
double t_4 = Math.sqrt(-l);
double tmp;
if (d <= -3.8e+46) {
tmp = (t_2 / t_3) * (t_0 * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l)))));
} else if (d <= -9.6e-70) {
tmp = t_1 * (t_0 * (1.0 - (0.5 * Math.pow(((0.5 * M) * ((D / d) * (t_3 / t_4))), 2.0))));
} else if (d <= -4e-279) {
tmp = t_1 * ((t_2 / t_4) * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
} else if (d <= 2.15e-159) {
tmp = -0.125 * (Math.pow((M * D), 2.0) / (d / Math.pow((Math.cbrt(Math.sqrt(h)) / Math.sqrt(l)), 3.0)));
} else if (d <= 1.35e+112) {
tmp = (t_0 * t_1) * (1.0 + (-0.125 * Math.pow(((Math.sqrt(h) * (M * D)) / (d * Math.sqrt(l))), 2.0)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 - ((h / l) * (0.5 * Math.pow(((D / d) * (0.5 * M)), 2.0))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(-d)) t_3 = sqrt(Float64(-h)) t_4 = sqrt(Float64(-l)) tmp = 0.0 if (d <= -3.8e+46) tmp = Float64(Float64(t_2 / t_3) * Float64(t_0 * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l)))))); elseif (d <= -9.6e-70) tmp = Float64(t_1 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(Float64(D / d) * Float64(t_3 / t_4))) ^ 2.0))))); elseif (d <= -4e-279) tmp = Float64(t_1 * Float64(Float64(t_2 / t_4) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0))))); elseif (d <= 2.15e-159) tmp = Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / Float64(d / (Float64(cbrt(sqrt(h)) / sqrt(l)) ^ 3.0)))); elseif (d <= 1.35e+112) tmp = Float64(Float64(t_0 * t_1) * Float64(1.0 + Float64(-0.125 * (Float64(Float64(sqrt(h) * Float64(M * D)) / Float64(d * sqrt(l))) ^ 2.0)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-h)], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-l)], $MachinePrecision]}, If[LessEqual[d, -3.8e+46], N[(N[(t$95$2 / t$95$3), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9.6e-70], N[(t$95$1 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(t$95$3 / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-279], N[(t$95$1 * N[(N[(t$95$2 / t$95$4), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.15e-159], N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / N[(d / N[Power[N[(N[Power[N[Sqrt[h], $MachinePrecision], 1/3], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e+112], N[(N[(t$95$0 * t$95$1), $MachinePrecision] * N[(1.0 + N[(-0.125 * N[Power[N[(N[(N[Sqrt[h], $MachinePrecision] * N[(M * D), $MachinePrecision]), $MachinePrecision] / N[(d * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{-h}\\
t_4 := \sqrt{-\ell}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{+46}:\\
\;\;\;\;\frac{t_2}{t_3} \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;d \leq -9.6 \cdot 10^{-70}:\\
\;\;\;\;t_1 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \frac{t_3}{t_4}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;t_1 \cdot \left(\frac{t_2}{t_4} \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;d \leq 2.15 \cdot 10^{-159}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{+112}:\\
\;\;\;\;\left(t_0 \cdot t_1\right) \cdot \left(1 + -0.125 \cdot {\left(\frac{\sqrt{h} \cdot \left(M \cdot D\right)}{d \cdot \sqrt{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -3.7999999999999999e46Initial program 78.1%
Simplified78.1%
frac-2neg78.1%
sqrt-div87.8%
Applied egg-rr87.8%
if -3.7999999999999999e46 < d < -9.6000000000000005e-70Initial program 79.3%
Simplified79.2%
add-sqr-sqrt79.2%
pow279.2%
sqrt-prod79.2%
unpow279.2%
sqrt-prod37.5%
add-sqr-sqrt87.5%
div-inv87.5%
metadata-eval87.5%
Applied egg-rr87.5%
associate-*l*87.6%
Simplified87.6%
frac-2neg87.6%
sqrt-div98.8%
Applied egg-rr98.8%
if -9.6000000000000005e-70 < d < -4.00000000000000022e-279Initial program 36.6%
Simplified36.4%
add-sqr-sqrt36.4%
pow236.4%
sqrt-prod36.4%
unpow236.4%
sqrt-prod24.4%
add-sqr-sqrt39.9%
div-inv39.9%
metadata-eval39.9%
Applied egg-rr39.9%
associate-*r/43.4%
Applied egg-rr43.4%
frac-2neg43.4%
sqrt-div60.5%
Applied egg-rr60.5%
if -4.00000000000000022e-279 < d < 2.15e-159Initial program 20.1%
Simplified20.1%
fma-udef20.1%
*-commutative20.1%
*-un-lft-identity20.1%
times-frac20.1%
metadata-eval20.1%
*-commutative20.1%
Applied egg-rr20.1%
Taylor expanded in d around 0 29.2%
associate-*l/28.8%
unpow228.8%
unpow228.8%
swap-sqr36.5%
unpow236.5%
associate-/l*37.0%
Simplified37.0%
add-cube-cbrt37.1%
pow337.1%
sqrt-div38.6%
cbrt-div38.7%
unpow338.7%
sqrt-prod57.6%
sqrt-unprod64.8%
add-cbrt-cube67.5%
Applied egg-rr67.5%
if 2.15e-159 < d < 1.3500000000000001e112Initial program 73.3%
Simplified73.4%
Taylor expanded in M around 0 62.3%
add-sqr-sqrt62.3%
sqrt-div62.3%
sqrt-prod62.3%
unpow262.3%
sqrt-prod29.8%
add-sqr-sqrt45.4%
sqrt-prod45.4%
unpow245.4%
sqrt-prod20.8%
add-sqr-sqrt44.3%
sqrt-prod44.3%
unpow244.3%
sqrt-prod44.3%
add-sqr-sqrt44.3%
sqrt-div44.3%
Applied egg-rr85.8%
unpow285.8%
associate-*r*87.0%
Simplified87.0%
if 1.3500000000000001e112 < d Initial program 71.0%
pow171.0%
Applied egg-rr91.4%
Final simplification83.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (fabs (* d (pow (* h l) -0.5))))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -4e+15)
(*
t_3
(*
t_0
(- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
(if (<= t_1 0.0)
t_2
(if (<= t_1 2e+253)
(*
(* t_0 t_3)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(if (<= t_1 INFINITY)
t_2
(*
-0.125
(/
(pow (* M D) 2.0)
(/ d (pow (/ (cbrt (sqrt h)) (sqrt l)) 3.0))))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = fabs((d * pow((h * l), -0.5)));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.125 * (pow((M * D), 2.0) / (d / pow((cbrt(sqrt(h)) / sqrt(l)), 3.0)));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
double t_3 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.125 * (Math.pow((M * D), 2.0) / (d / Math.pow((Math.cbrt(Math.sqrt(h)) / Math.sqrt(l)), 3.0)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5))) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0))))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / Float64(d / (Float64(cbrt(sqrt(h)) / sqrt(l)) ^ 3.0)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / N[(d / N[Power[N[(N[Power[N[Sqrt[h], $MachinePrecision], 1/3], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{\frac{d}{{\left(\frac{\sqrt[3]{\sqrt{h}}}{\sqrt{\ell}}\right)}^{3}}}\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
add-sqr-sqrt79.7%
pow279.7%
sqrt-prod79.6%
unpow279.6%
sqrt-prod44.1%
add-sqr-sqrt87.5%
div-inv87.5%
metadata-eval87.5%
Applied egg-rr87.5%
associate-*r/87.4%
Applied egg-rr87.4%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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)))) < +inf.0Initial program 48.3%
Simplified48.2%
Taylor expanded in d around inf 54.5%
add-sqr-sqrt54.1%
sqrt-unprod55.5%
pow255.5%
inv-pow55.5%
sqrt-pow155.6%
metadata-eval55.6%
Applied egg-rr55.6%
unpow255.6%
rem-sqrt-square92.5%
Simplified92.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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
if +inf.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)))) Initial program 0.0%
Simplified0.0%
fma-udef0.0%
*-commutative0.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
*-commutative0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 12.1%
associate-*l/12.4%
unpow212.4%
unpow212.4%
swap-sqr17.0%
unpow217.0%
associate-/l*17.0%
Simplified17.0%
add-cube-cbrt17.0%
pow317.0%
sqrt-div16.2%
cbrt-div16.2%
unpow316.2%
sqrt-prod29.3%
sqrt-unprod35.0%
add-cbrt-cube37.0%
Applied egg-rr37.0%
Final simplification80.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (fabs (* d (pow (* h l) -0.5))))
(t_3 (sqrt (/ d l))))
(if (<= t_1 -4e+15)
(*
t_3
(* t_0 (+ 1.0 (/ (* h (* (pow (* (/ D d) (* 0.5 M)) 2.0) -0.5)) l))))
(if (<= t_1 0.0)
t_2
(if (<= t_1 2e+253)
(*
(* t_3 t_0)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(if (<= t_1 INFINITY)
t_2
(*
-0.125
(pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = fabs((d * pow((h * l), -0.5)));
double t_3 = sqrt((d / l));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 + ((h * (pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_3 * t_0) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
double t_3 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 + ((h * (Math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_3 * t_0) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.fabs((d * math.pow((h * l), -0.5))) t_3 = math.sqrt((d / l)) tmp = 0 if t_1 <= -4e+15: tmp = t_3 * (t_0 * (1.0 + ((h * (math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l))) elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 2e+253: tmp = (t_3 * t_0) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) elif t_1 <= math.inf: tmp = t_2 else: tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5))) t_3 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0) * -0.5)) / l)))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = Float64(Float64(t_3 * t_0) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); t_2 = abs((d * ((h * l) ^ -0.5))); t_3 = sqrt((d / l)); tmp = 0.0; if (t_1 <= -4e+15) tmp = t_3 * (t_0 * (1.0 + ((h * ((((D / d) * (0.5 * M)) ^ 2.0) * -0.5)) / l))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = (t_3 * t_0) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5))); elseif (t_1 <= Inf) tmp = t_2; else tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$3 * t$95$0), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
t_3 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;\left(t_3 \cdot t_0\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
associate-*l/79.7%
add-sqr-sqrt38.8%
add-sqr-sqrt79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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)))) < +inf.0Initial program 48.3%
Simplified48.2%
Taylor expanded in d around inf 54.5%
add-sqr-sqrt54.1%
sqrt-unprod55.5%
pow255.5%
inv-pow55.5%
sqrt-pow155.6%
metadata-eval55.6%
Applied egg-rr55.6%
unpow255.6%
rem-sqrt-square92.5%
Simplified92.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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
if +inf.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)))) Initial program 0.0%
Simplified0.0%
fma-udef0.0%
*-commutative0.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
*-commutative0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 12.1%
associate-*l/12.4%
unpow212.4%
unpow212.4%
swap-sqr17.0%
unpow217.0%
associate-/l*17.0%
Simplified17.0%
add-sqr-sqrt16.6%
pow216.6%
sqrt-div22.3%
unpow222.3%
sqrt-prod6.6%
add-sqr-sqrt22.7%
*-commutative22.7%
sqrt-div16.5%
sqrt-pow135.6%
metadata-eval35.6%
Applied egg-rr35.6%
Final simplification78.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (fabs (* d (pow (* h l) -0.5))))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -4e+15)
(*
t_3
(*
t_0
(- 1.0 (* 0.5 (pow (* (* 0.5 M) (* (/ D d) (sqrt (/ h l)))) 2.0)))))
(if (<= t_1 0.0)
t_2
(if (<= t_1 2e+253)
(*
(* t_0 t_3)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(if (<= t_1 INFINITY)
t_2
(*
-0.125
(pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = fabs((d * pow((h * l), -0.5)));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * pow(((0.5 * M) * ((D / d) * sqrt((h / l)))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
double t_3 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow(((0.5 * M) * ((D / d) * Math.sqrt((h / l)))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.fabs((d * math.pow((h * l), -0.5))) t_3 = math.sqrt((d / h)) tmp = 0 if t_1 <= -4e+15: tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow(((0.5 * M) * ((D / d) * math.sqrt((h / l)))), 2.0)))) elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 2e+253: tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) elif t_1 <= math.inf: tmp = t_2 else: tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5))) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(Float64(D / d) * sqrt(Float64(h / l)))) ^ 2.0))))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); t_2 = abs((d * ((h * l) ^ -0.5))); t_3 = sqrt((d / h)); tmp = 0.0; if (t_1 <= -4e+15) tmp = t_3 * (t_0 * (1.0 - (0.5 * (((0.5 * M) * ((D / d) * sqrt((h / l)))) ^ 2.0)))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5))); elseif (t_1 <= Inf) tmp = t_2; else tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \left(\frac{D}{d} \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
add-sqr-sqrt79.7%
pow279.7%
sqrt-prod79.6%
unpow279.6%
sqrt-prod44.1%
add-sqr-sqrt87.5%
div-inv87.5%
metadata-eval87.5%
Applied egg-rr87.5%
associate-*l*86.4%
Simplified86.4%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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)))) < +inf.0Initial program 48.3%
Simplified48.2%
Taylor expanded in d around inf 54.5%
add-sqr-sqrt54.1%
sqrt-unprod55.5%
pow255.5%
inv-pow55.5%
sqrt-pow155.6%
metadata-eval55.6%
Applied egg-rr55.6%
unpow255.6%
rem-sqrt-square92.5%
Simplified92.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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
if +inf.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)))) Initial program 0.0%
Simplified0.0%
fma-udef0.0%
*-commutative0.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
*-commutative0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 12.1%
associate-*l/12.4%
unpow212.4%
unpow212.4%
swap-sqr17.0%
unpow217.0%
associate-/l*17.0%
Simplified17.0%
add-sqr-sqrt16.6%
pow216.6%
sqrt-div22.3%
unpow222.3%
sqrt-prod6.6%
add-sqr-sqrt22.7%
*-commutative22.7%
sqrt-div16.5%
sqrt-pow135.6%
metadata-eval35.6%
Applied egg-rr35.6%
Final simplification80.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (fabs (* d (pow (* h l) -0.5))))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -4e+15)
(*
t_3
(*
t_0
(- 1.0 (* 0.5 (pow (* (sqrt (/ h l)) (* (/ D d) (* 0.5 M))) 2.0)))))
(if (<= t_1 0.0)
t_2
(if (<= t_1 2e+253)
(*
(* t_0 t_3)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(if (<= t_1 INFINITY)
t_2
(*
-0.125
(pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = fabs((d * pow((h * l), -0.5)));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
double t_3 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((Math.sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.fabs((d * math.pow((h * l), -0.5))) t_3 = math.sqrt((d / h)) tmp = 0 if t_1 <= -4e+15: tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow((math.sqrt((h / l)) * ((D / d) * (0.5 * M))), 2.0)))) elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 2e+253: tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) elif t_1 <= math.inf: tmp = t_2 else: tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5))) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(sqrt(Float64(h / l)) * Float64(Float64(D / d) * Float64(0.5 * M))) ^ 2.0))))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); t_2 = abs((d * ((h * l) ^ -0.5))); t_3 = sqrt((d / h)); tmp = 0.0; if (t_1 <= -4e+15) tmp = t_3 * (t_0 * (1.0 - (0.5 * ((sqrt((h / l)) * ((D / d) * (0.5 * M))) ^ 2.0)))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5))); elseif (t_1 <= Inf) tmp = t_2; else tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\sqrt{\frac{h}{\ell}} \cdot \left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
add-sqr-sqrt79.7%
pow279.7%
sqrt-prod79.6%
unpow279.6%
sqrt-prod44.1%
add-sqr-sqrt87.5%
div-inv87.5%
metadata-eval87.5%
Applied egg-rr87.5%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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)))) < +inf.0Initial program 48.3%
Simplified48.2%
Taylor expanded in d around inf 54.5%
add-sqr-sqrt54.1%
sqrt-unprod55.5%
pow255.5%
inv-pow55.5%
sqrt-pow155.6%
metadata-eval55.6%
Applied egg-rr55.6%
unpow255.6%
rem-sqrt-square92.5%
Simplified92.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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
if +inf.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)))) Initial program 0.0%
Simplified0.0%
fma-udef0.0%
*-commutative0.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
*-commutative0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 12.1%
associate-*l/12.4%
unpow212.4%
unpow212.4%
swap-sqr17.0%
unpow217.0%
associate-/l*17.0%
Simplified17.0%
add-sqr-sqrt16.6%
pow216.6%
sqrt-div22.3%
unpow222.3%
sqrt-prod6.6%
add-sqr-sqrt22.7%
*-commutative22.7%
sqrt-div16.5%
sqrt-pow135.6%
metadata-eval35.6%
Applied egg-rr35.6%
Final simplification80.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (fabs (* d (pow (* h l) -0.5))))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -4e+15)
(*
t_3
(*
t_0
(- 1.0 (* 0.5 (pow (* (/ (* D (* 0.5 M)) d) (sqrt (/ h l))) 2.0)))))
(if (<= t_1 0.0)
t_2
(if (<= t_1 2e+253)
(*
(* t_0 t_3)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))
(if (<= t_1 INFINITY)
t_2
(*
-0.125
(pow (/ (* M D) (sqrt (/ d (/ (sqrt h) (pow l 1.5))))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = fabs((d * pow((h * l), -0.5)));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * pow((((D * (0.5 * M)) / d) * sqrt((h / l))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -0.125 * pow(((M * D) / sqrt((d / (sqrt(h) / pow(l, 1.5))))), 2.0);
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.abs((d * Math.pow((h * l), -0.5)));
double t_3 = Math.sqrt((d / h));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_3 * (t_0 * (1.0 - (0.5 * Math.pow((((D * (0.5 * M)) / d) * Math.sqrt((h / l))), 2.0))));
} else if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= 2e+253) {
tmp = (t_0 * t_3) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -0.125 * Math.pow(((M * D) / Math.sqrt((d / (Math.sqrt(h) / Math.pow(l, 1.5))))), 2.0);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.fabs((d * math.pow((h * l), -0.5))) t_3 = math.sqrt((d / h)) tmp = 0 if t_1 <= -4e+15: tmp = t_3 * (t_0 * (1.0 - (0.5 * math.pow((((D * (0.5 * M)) / d) * math.sqrt((h / l))), 2.0)))) elif t_1 <= 0.0: tmp = t_2 elif t_1 <= 2e+253: tmp = (t_0 * t_3) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) elif t_1 <= math.inf: tmp = t_2 else: tmp = -0.125 * math.pow(((M * D) / math.sqrt((d / (math.sqrt(h) / math.pow(l, 1.5))))), 2.0) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = abs(Float64(d * (Float64(h * l) ^ -0.5))) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_3 * Float64(t_0 * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(D * Float64(0.5 * M)) / d) * sqrt(Float64(h / l))) ^ 2.0))))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = Float64(Float64(t_0 * t_3) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(-0.125 * (Float64(Float64(M * D) / sqrt(Float64(d / Float64(sqrt(h) / (l ^ 1.5))))) ^ 2.0)); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); t_2 = abs((d * ((h * l) ^ -0.5))); t_3 = sqrt((d / h)); tmp = 0.0; if (t_1 <= -4e+15) tmp = t_3 * (t_0 * (1.0 - (0.5 * ((((D * (0.5 * M)) / d) * sqrt((h / l))) ^ 2.0)))); elseif (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= 2e+253) tmp = (t_0 * t_3) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5))); elseif (t_1 <= Inf) tmp = t_2; else tmp = -0.125 * (((M * D) / sqrt((d / (sqrt(h) / (l ^ 1.5))))) ^ 2.0); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$3 * N[(t$95$0 * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(D * N[(0.5 * M), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, 2e+253], N[(N[(t$95$0 * t$95$3), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(-0.125 * N[Power[N[(N[(M * D), $MachinePrecision] / N[Sqrt[N[(d / N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_3 \cdot \left(t_0 \cdot \left(1 - 0.5 \cdot {\left(\frac{D \cdot \left(0.5 \cdot M\right)}{d} \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+253}:\\
\;\;\;\;\left(t_0 \cdot t_3\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-0.125 \cdot {\left(\frac{M \cdot D}{\sqrt{\frac{d}{\frac{\sqrt{h}}{{\ell}^{1.5}}}}}\right)}^{2}\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
add-sqr-sqrt79.7%
pow279.7%
sqrt-prod79.6%
unpow279.6%
sqrt-prod44.1%
add-sqr-sqrt87.5%
div-inv87.5%
metadata-eval87.5%
Applied egg-rr87.5%
associate-*r/87.4%
Applied egg-rr87.4%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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)))) < +inf.0Initial program 48.3%
Simplified48.2%
Taylor expanded in d around inf 54.5%
add-sqr-sqrt54.1%
sqrt-unprod55.5%
pow255.5%
inv-pow55.5%
sqrt-pow155.6%
metadata-eval55.6%
Applied egg-rr55.6%
unpow255.6%
rem-sqrt-square92.5%
Simplified92.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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
if +inf.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)))) Initial program 0.0%
Simplified0.0%
fma-udef0.0%
*-commutative0.0%
*-un-lft-identity0.0%
times-frac0.0%
metadata-eval0.0%
*-commutative0.0%
Applied egg-rr0.0%
Taylor expanded in d around 0 12.1%
associate-*l/12.4%
unpow212.4%
unpow212.4%
swap-sqr17.0%
unpow217.0%
associate-/l*17.0%
Simplified17.0%
add-sqr-sqrt16.6%
pow216.6%
sqrt-div22.3%
unpow222.3%
sqrt-prod6.6%
add-sqr-sqrt22.7%
*-commutative22.7%
sqrt-div16.5%
sqrt-pow135.6%
metadata-eval35.6%
Applied egg-rr35.6%
Final simplification80.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))
(t_2 (sqrt (/ d l))))
(if (<= t_1 -4e+15)
(*
t_2
(* t_0 (+ 1.0 (/ (* h (* (pow (* (/ D d) (* 0.5 M)) 2.0) -0.5)) l))))
(if (or (<= t_1 0.0) (not (<= t_1 2e+253)))
(fabs (* d (pow (* h l) -0.5)))
(*
(* t_2 t_0)
(+ 1.0 (* (pow (* D (* -0.5 (/ M d))) 2.0) (* (/ h l) -0.5))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double t_1 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = sqrt((d / l));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_2 * (t_0 * (1.0 + ((h * (pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
} else if ((t_1 <= 0.0) || !(t_1 <= 2e+253)) {
tmp = fabs((d * pow((h * l), -0.5)));
} else {
tmp = (t_2 * t_0) * (1.0 + (pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
t_2 = sqrt((d / l))
if (t_1 <= (-4d+15)) then
tmp = t_2 * (t_0 * (1.0d0 + ((h * ((((d_1 / d) * (0.5d0 * m)) ** 2.0d0) * (-0.5d0))) / l)))
else if ((t_1 <= 0.0d0) .or. (.not. (t_1 <= 2d+253))) then
tmp = abs((d * ((h * l) ** (-0.5d0))))
else
tmp = (t_2 * t_0) * (1.0d0 + (((d_1 * ((-0.5d0) * (m / d))) ** 2.0d0) * ((h / l) * (-0.5d0))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / h));
double t_1 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
double t_2 = Math.sqrt((d / l));
double tmp;
if (t_1 <= -4e+15) {
tmp = t_2 * (t_0 * (1.0 + ((h * (Math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l)));
} else if ((t_1 <= 0.0) || !(t_1 <= 2e+253)) {
tmp = Math.abs((d * Math.pow((h * l), -0.5)));
} else {
tmp = (t_2 * t_0) * (1.0 + (Math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5)));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / h)) t_1 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) t_2 = math.sqrt((d / l)) tmp = 0 if t_1 <= -4e+15: tmp = t_2 * (t_0 * (1.0 + ((h * (math.pow(((D / d) * (0.5 * M)), 2.0) * -0.5)) / l))) elif (t_1 <= 0.0) or not (t_1 <= 2e+253): tmp = math.fabs((d * math.pow((h * l), -0.5))) else: tmp = (t_2 * t_0) * (1.0 + (math.pow((D * (-0.5 * (M / d))), 2.0) * ((h / l) * -0.5))) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_1 <= -4e+15) tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0) * -0.5)) / l)))); elseif ((t_1 <= 0.0) || !(t_1 <= 2e+253)) tmp = abs(Float64(d * (Float64(h * l) ^ -0.5))); else tmp = Float64(Float64(t_2 * t_0) * Float64(1.0 + Float64((Float64(D * Float64(-0.5 * Float64(M / d))) ^ 2.0) * Float64(Float64(h / l) * -0.5)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / h)); t_1 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); t_2 = sqrt((d / l)); tmp = 0.0; if (t_1 <= -4e+15) tmp = t_2 * (t_0 * (1.0 + ((h * ((((D / d) * (0.5 * M)) ^ 2.0) * -0.5)) / l))); elseif ((t_1 <= 0.0) || ~((t_1 <= 2e+253))) tmp = abs((d * ((h * l) ^ -0.5))); else tmp = (t_2 * t_0) * (1.0 + (((D * (-0.5 * (M / d))) ^ 2.0) * ((h / l) * -0.5))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e+15], N[(t$95$2 * N[(t$95$0 * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 0.0], N[Not[LessEqual[t$95$1, 2e+253]], $MachinePrecision]], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(t$95$2 * t$95$0), $MachinePrecision] * N[(1.0 + N[(N[Power[N[(D * N[(-0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t_2 \cdot \left(t_0 \cdot \left(1 + \frac{h \cdot \left({\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\
\mathbf{elif}\;t_1 \leq 0 \lor \neg \left(t_1 \leq 2 \cdot 10^{+253}\right):\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(t_2 \cdot t_0\right) \cdot \left(1 + {\left(D \cdot \left(-0.5 \cdot \frac{M}{d}\right)\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\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)))) < -4e15Initial program 78.5%
Simplified79.7%
associate-*l/79.7%
add-sqr-sqrt38.8%
add-sqr-sqrt79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
if -4e15 < (*.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 1.9999999999999999e253 < (*.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 24.4%
Simplified24.3%
Taylor expanded in d around inf 35.3%
add-sqr-sqrt34.5%
sqrt-unprod35.9%
pow235.9%
inv-pow35.9%
sqrt-pow135.9%
metadata-eval35.9%
Applied egg-rr35.9%
unpow235.9%
rem-sqrt-square59.9%
Simplified59.9%
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)))) < 1.9999999999999999e253Initial program 98.2%
Simplified96.8%
fma-udef96.8%
*-commutative96.8%
*-un-lft-identity96.8%
times-frac96.8%
metadata-eval96.8%
*-commutative96.8%
Applied egg-rr96.8%
Final simplification76.4%
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(fabs (* d (pow (* h l) -0.5)))
(if (<= d 8e-99)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = fabs((d * pow((h * l), -0.5)));
} else if (d <= 8e-99) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 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 (d <= (-5d-310)) then
tmp = abs((d * ((h * l) ** (-0.5d0))))
else if (d <= 8d-99) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (((m * d_1) ** 2.0d0) / d))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 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 (d <= -5e-310) {
tmp = Math.abs((d * Math.pow((h * l), -0.5)));
} else if (d <= 8e-99) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (Math.pow((M * D), 2.0) / d));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -5e-310: tmp = math.fabs((d * math.pow((h * l), -0.5))) elif d <= 8e-99: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (math.pow((M * D), 2.0) / d)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = abs(Float64(d * (Float64(h * l) ^ -0.5))); elseif (d <= 8e-99) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -5e-310) tmp = abs((d * ((h * l) ^ -0.5))); elseif (d <= 8e-99) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (((M * D) ^ 2.0) / d)); else tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, 8e-99], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-99}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 65.1%
Simplified64.2%
Taylor expanded in d around inf 8.7%
add-sqr-sqrt2.2%
sqrt-unprod31.7%
pow231.7%
inv-pow31.7%
sqrt-pow131.7%
metadata-eval31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square45.4%
Simplified45.4%
if -4.999999999999985e-310 < d < 8.0000000000000002e-99Initial program 35.3%
Simplified35.3%
fma-udef35.3%
*-commutative35.3%
*-un-lft-identity35.3%
times-frac35.3%
metadata-eval35.3%
*-commutative35.3%
Applied egg-rr35.3%
Taylor expanded in d around 0 36.4%
associate-*l/36.1%
unpow236.1%
unpow236.1%
swap-sqr42.5%
unpow242.5%
associate-/l*42.9%
Simplified42.9%
associate-/r/42.7%
*-commutative42.7%
sqrt-div46.2%
sqrt-pow168.4%
metadata-eval68.4%
Applied egg-rr68.4%
if 8.0000000000000002e-99 < d Initial program 72.4%
Applied egg-rr49.2%
expm1-def62.1%
expm1-log1p85.9%
associate-/r*85.0%
associate-*r*85.0%
*-commutative85.0%
associate-*l*85.0%
Simplified85.0%
Final simplification64.2%
(FPCore (d h l M D)
:precision binary64
(if (<= d -4e-279)
(*
(fma (pow (* (/ M d) (* D -0.5)) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt (* (/ d l) (/ d h))))
(if (<= d 2.15e-97)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4e-279) {
tmp = fma(pow(((M / d) * (D * -0.5)), 2.0), ((h / l) * -0.5), 1.0) * sqrt(((d / l) * (d / h)));
} else if (d <= 2.15e-97) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (d <= -4e-279) tmp = Float64(fma((Float64(Float64(M / d) * Float64(D * -0.5)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); elseif (d <= 2.15e-97) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-279], N[(N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * -0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.15e-97], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M}{d} \cdot \left(D \cdot -0.5\right)\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;d \leq 2.15 \cdot 10^{-97}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.00000000000000022e-279Initial program 67.4%
Simplified66.5%
fma-udef66.5%
*-commutative66.5%
*-un-lft-identity66.5%
times-frac66.5%
metadata-eval66.5%
*-commutative66.5%
Applied egg-rr66.5%
distribute-lft-in50.5%
sqrt-unprod45.1%
associate-*r*45.1%
sqrt-unprod43.3%
Applied egg-rr43.3%
distribute-lft-out60.5%
fma-udef60.5%
*-commutative60.5%
Simplified60.5%
if -4.00000000000000022e-279 < d < 2.15e-97Initial program 32.7%
Simplified32.6%
fma-udef32.6%
*-commutative32.6%
*-un-lft-identity32.6%
times-frac32.6%
metadata-eval32.6%
*-commutative32.6%
Applied egg-rr32.6%
Taylor expanded in d around 0 33.8%
associate-*l/33.5%
unpow233.5%
unpow233.5%
swap-sqr39.4%
unpow239.4%
associate-/l*39.8%
Simplified39.8%
associate-/r/39.7%
*-commutative39.7%
sqrt-div42.8%
sqrt-pow163.2%
metadata-eval63.2%
Applied egg-rr63.2%
if 2.15e-97 < d Initial program 72.4%
Applied egg-rr49.2%
expm1-def62.1%
expm1-log1p85.9%
associate-/r*85.0%
associate-*r*85.0%
*-commutative85.0%
associate-*l*85.0%
Simplified85.0%
Final simplification69.9%
(FPCore (d h l M D)
:precision binary64
(if (<= d -4e-279)
(*
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ M 2.0) (/ D d)) 2.0) (/ h l)))))
(sqrt (/ d h)))
(if (<= d 4.3e-98)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4e-279) {
tmp = (sqrt((d / l)) * (1.0 - (0.5 * (pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) * sqrt((d / h));
} else if (d <= 4.3e-98) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 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 (d <= (-4d-279)) then
tmp = (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (h / l))))) * sqrt((d / h))
else if (d <= 4.3d-98) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (((m * d_1) ** 2.0d0) / d))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 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 (d <= -4e-279) {
tmp = (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) * Math.sqrt((d / h));
} else if (d <= 4.3e-98) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (Math.pow((M * D), 2.0) / d));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -4e-279: tmp = (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((M / 2.0) * (D / d)), 2.0) * (h / l))))) * math.sqrt((d / h)) elif d <= 4.3e-98: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (math.pow((M * D), 2.0) / d)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -4e-279) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * Float64(h / l))))) * sqrt(Float64(d / h))); elseif (d <= 4.3e-98) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -4e-279) tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((((M / 2.0) * (D / d)) ^ 2.0) * (h / l))))) * sqrt((d / h)); elseif (d <= 4.3e-98) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (((M * D) ^ 2.0) / d)); else tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-279], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.3e-98], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 4.3 \cdot 10^{-98}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.00000000000000022e-279Initial program 67.4%
Simplified67.3%
if -4.00000000000000022e-279 < d < 4.29999999999999988e-98Initial program 32.7%
Simplified32.6%
fma-udef32.6%
*-commutative32.6%
*-un-lft-identity32.6%
times-frac32.6%
metadata-eval32.6%
*-commutative32.6%
Applied egg-rr32.6%
Taylor expanded in d around 0 33.8%
associate-*l/33.5%
unpow233.5%
unpow233.5%
swap-sqr39.4%
unpow239.4%
associate-/l*39.8%
Simplified39.8%
associate-/r/39.7%
*-commutative39.7%
sqrt-div42.8%
sqrt-pow163.2%
metadata-eval63.2%
Applied egg-rr63.2%
if 4.29999999999999988e-98 < d Initial program 72.4%
Applied egg-rr49.2%
expm1-def62.1%
expm1-log1p85.9%
associate-/r*85.0%
associate-*r*85.0%
*-commutative85.0%
associate-*l*85.0%
Simplified85.0%
Final simplification72.9%
(FPCore (d h l M D)
:precision binary64
(if (<= d -4e-279)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))))
(if (<= d 8e-99)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4e-279) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))));
} else if (d <= 8e-99) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 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 (d <= (-4d-279)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))))
else if (d <= 8d-99) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (((m * d_1) ** 2.0d0) / d))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 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 (d <= -4e-279) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))));
} else if (d <= 8e-99) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (Math.pow((M * D), 2.0) / d));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -4e-279: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) elif d <= 8e-99: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (math.pow((M * D), 2.0) / d)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -4e-279) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))))); elseif (d <= 8e-99) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -4e-279) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5)))); elseif (d <= 8e-99) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (((M * D) ^ 2.0) / d)); else tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-279], 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[(N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-99], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-99}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.00000000000000022e-279Initial program 67.4%
Simplified67.4%
if -4.00000000000000022e-279 < d < 8.0000000000000002e-99Initial program 32.7%
Simplified32.6%
fma-udef32.6%
*-commutative32.6%
*-un-lft-identity32.6%
times-frac32.6%
metadata-eval32.6%
*-commutative32.6%
Applied egg-rr32.6%
Taylor expanded in d around 0 33.8%
associate-*l/33.5%
unpow233.5%
unpow233.5%
swap-sqr39.4%
unpow239.4%
associate-/l*39.8%
Simplified39.8%
associate-/r/39.7%
*-commutative39.7%
sqrt-div42.8%
sqrt-pow163.2%
metadata-eval63.2%
Applied egg-rr63.2%
if 8.0000000000000002e-99 < d Initial program 72.4%
Applied egg-rr49.2%
expm1-def62.1%
expm1-log1p85.9%
associate-/r*85.0%
associate-*r*85.0%
*-commutative85.0%
associate-*l*85.0%
Simplified85.0%
Final simplification72.9%
(FPCore (d h l M D)
:precision binary64
(if (<= d -4e-279)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ M (* 2.0 (/ d D))) 2.0))))))
(if (<= d 8e-99)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(*
(/ (/ d (sqrt l)) (sqrt h))
(- 1.0 (* 0.5 (* (/ h l) (pow (* M (* 0.5 (/ D d))) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4e-279) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((M / (2.0 * (d / D))), 2.0)))));
} else if (d <= 8e-99) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * pow((M * (0.5 * (D / d))), 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 (d <= (-4d-279)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((m / (2.0d0 * (d / d_1))) ** 2.0d0)))))
else if (d <= 8d-99) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (((m * d_1) ** 2.0d0) / d))
else
tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0d0 - (0.5d0 * ((h / l) * ((m * (0.5d0 * (d_1 / d))) ** 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 (d <= -4e-279) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((M / (2.0 * (d / D))), 2.0)))));
} else if (d <= 8e-99) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (Math.pow((M * D), 2.0) / d));
} else {
tmp = ((d / Math.sqrt(l)) / Math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * Math.pow((M * (0.5 * (D / d))), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -4e-279: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((M / (2.0 * (d / D))), 2.0))))) elif d <= 8e-99: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (math.pow((M * D), 2.0) / d)) else: tmp = ((d / math.sqrt(l)) / math.sqrt(h)) * (1.0 - (0.5 * ((h / l) * math.pow((M * (0.5 * (D / d))), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -4e-279) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M / Float64(2.0 * Float64(d / D))) ^ 2.0)))))); elseif (d <= 8e-99) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(Float64(Float64(d / sqrt(l)) / sqrt(h)) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -4e-279) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((M / (2.0 * (d / D))) ^ 2.0))))); elseif (d <= 8e-99) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (((M * D) ^ 2.0) / d)); else tmp = ((d / sqrt(l)) / sqrt(h)) * (1.0 - (0.5 * ((h / l) * ((M * (0.5 * (D / d))) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -4e-279], 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[(M / N[(2.0 * N[(d / D), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-99], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-279}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M}{2 \cdot \frac{d}{D}}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-99}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -4.00000000000000022e-279Initial program 67.4%
Simplified67.4%
*-commutative67.4%
clear-num67.3%
frac-times67.4%
*-un-lft-identity67.4%
Applied egg-rr67.4%
if -4.00000000000000022e-279 < d < 8.0000000000000002e-99Initial program 32.7%
Simplified32.6%
fma-udef32.6%
*-commutative32.6%
*-un-lft-identity32.6%
times-frac32.6%
metadata-eval32.6%
*-commutative32.6%
Applied egg-rr32.6%
Taylor expanded in d around 0 33.8%
associate-*l/33.5%
unpow233.5%
unpow233.5%
swap-sqr39.4%
unpow239.4%
associate-/l*39.8%
Simplified39.8%
associate-/r/39.7%
*-commutative39.7%
sqrt-div42.8%
sqrt-pow163.2%
metadata-eval63.2%
Applied egg-rr63.2%
if 8.0000000000000002e-99 < d Initial program 72.4%
Applied egg-rr49.2%
expm1-def62.1%
expm1-log1p85.9%
associate-/r*85.0%
associate-*r*85.0%
*-commutative85.0%
associate-*l*85.0%
Simplified85.0%
Final simplification72.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* d (pow (* h l) -0.5))) (t_1 (pow (* M D) 2.0)))
(if (<= d -5e-310)
(fabs t_0)
(if (<= d 3e-271)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ t_1 d)))
(if (<= d 1.4e-259)
t_0
(if (<= d 5.4e+55)
(* -0.125 (* t_1 (/ (/ (sqrt h) d) (pow l 1.5))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = d * pow((h * l), -0.5);
double t_1 = pow((M * D), 2.0);
double tmp;
if (d <= -5e-310) {
tmp = fabs(t_0);
} else if (d <= 3e-271) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (t_1 / d));
} else if (d <= 1.4e-259) {
tmp = t_0;
} else if (d <= 5.4e+55) {
tmp = -0.125 * (t_1 * ((sqrt(h) / d) / pow(l, 1.5)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d * ((h * l) ** (-0.5d0))
t_1 = (m * d_1) ** 2.0d0
if (d <= (-5d-310)) then
tmp = abs(t_0)
else if (d <= 3d-271) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (t_1 / d))
else if (d <= 1.4d-259) then
tmp = t_0
else if (d <= 5.4d+55) then
tmp = (-0.125d0) * (t_1 * ((sqrt(h) / d) / (l ** 1.5d0)))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * Math.pow((h * l), -0.5);
double t_1 = Math.pow((M * D), 2.0);
double tmp;
if (d <= -5e-310) {
tmp = Math.abs(t_0);
} else if (d <= 3e-271) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (t_1 / d));
} else if (d <= 1.4e-259) {
tmp = t_0;
} else if (d <= 5.4e+55) {
tmp = -0.125 * (t_1 * ((Math.sqrt(h) / d) / Math.pow(l, 1.5)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = d * math.pow((h * l), -0.5) t_1 = math.pow((M * D), 2.0) tmp = 0 if d <= -5e-310: tmp = math.fabs(t_0) elif d <= 3e-271: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (t_1 / d)) elif d <= 1.4e-259: tmp = t_0 elif d <= 5.4e+55: tmp = -0.125 * (t_1 * ((math.sqrt(h) / d) / math.pow(l, 1.5))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(d * (Float64(h * l) ^ -0.5)) t_1 = Float64(M * D) ^ 2.0 tmp = 0.0 if (d <= -5e-310) tmp = abs(t_0); elseif (d <= 3e-271) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64(t_1 / d))); elseif (d <= 1.4e-259) tmp = t_0; elseif (d <= 5.4e+55) tmp = Float64(-0.125 * Float64(t_1 * Float64(Float64(sqrt(h) / d) / (l ^ 1.5)))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = d * ((h * l) ^ -0.5); t_1 = (M * D) ^ 2.0; tmp = 0.0; if (d <= -5e-310) tmp = abs(t_0); elseif (d <= 3e-271) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (t_1 / d)); elseif (d <= 1.4e-259) tmp = t_0; elseif (d <= 5.4e+55) tmp = -0.125 * (t_1 * ((sqrt(h) / d) / (l ^ 1.5))); else tmp = d * (sqrt((1.0 / h)) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -5e-310], N[Abs[t$95$0], $MachinePrecision], If[LessEqual[d, 3e-271], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-259], t$95$0, If[LessEqual[d, 5.4e+55], N[(-0.125 * N[(t$95$1 * N[(N[(N[Sqrt[h], $MachinePrecision] / d), $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
t_1 := {\left(M \cdot D\right)}^{2}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|t_0\right|\\
\mathbf{elif}\;d \leq 3 \cdot 10^{-271}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{t_1}{d}\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-259}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{+55}:\\
\;\;\;\;-0.125 \cdot \left(t_1 \cdot \frac{\frac{\sqrt{h}}{d}}{{\ell}^{1.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 65.1%
Simplified64.2%
Taylor expanded in d around inf 8.7%
add-sqr-sqrt2.2%
sqrt-unprod31.7%
pow231.7%
inv-pow31.7%
sqrt-pow131.7%
metadata-eval31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square45.4%
Simplified45.4%
if -4.999999999999985e-310 < d < 3.00000000000000002e-271Initial program 25.0%
Simplified25.0%
fma-udef25.0%
*-commutative25.0%
*-un-lft-identity25.0%
times-frac25.0%
metadata-eval25.0%
*-commutative25.0%
Applied egg-rr25.0%
Taylor expanded in d around 0 50.4%
associate-*l/50.4%
unpow250.4%
unpow250.4%
swap-sqr50.8%
unpow250.8%
associate-/l*50.8%
Simplified50.8%
associate-/r/50.8%
*-commutative50.8%
sqrt-div50.8%
sqrt-pow187.5%
metadata-eval87.5%
Applied egg-rr87.5%
if 3.00000000000000002e-271 < d < 1.4e-259Initial program 18.3%
Simplified18.3%
fma-udef18.3%
*-commutative18.3%
*-un-lft-identity18.3%
times-frac18.3%
metadata-eval18.3%
*-commutative18.3%
Applied egg-rr18.3%
Taylor expanded in d around inf 60.3%
unpow1/260.3%
rem-exp-log57.7%
exp-neg57.7%
exp-prod57.7%
distribute-lft-neg-out57.7%
distribute-rgt-neg-in57.7%
metadata-eval57.7%
exp-to-pow60.3%
Simplified60.3%
if 1.4e-259 < d < 5.39999999999999954e55Initial program 55.1%
Simplified55.1%
fma-udef55.1%
*-commutative55.1%
*-un-lft-identity55.1%
times-frac55.1%
metadata-eval55.1%
*-commutative55.1%
Applied egg-rr55.1%
Taylor expanded in d around 0 32.7%
associate-*l/32.5%
unpow232.5%
unpow232.5%
swap-sqr40.8%
unpow240.8%
associate-/l*41.1%
Simplified41.1%
expm1-log1p-u40.7%
expm1-udef40.5%
associate-/r/40.4%
*-commutative40.4%
sqrt-div41.9%
sqrt-pow154.2%
metadata-eval54.2%
Applied egg-rr54.2%
expm1-def58.5%
expm1-log1p59.6%
associate-/r/62.3%
*-rgt-identity62.3%
associate-*r/62.4%
associate-/r/62.3%
*-commutative62.3%
times-frac63.5%
*-lft-identity63.5%
associate-/r*62.5%
Simplified62.5%
if 5.39999999999999954e55 < d Initial program 72.2%
Simplified73.8%
Taylor expanded in d around inf 74.3%
associate-/r*74.9%
sqrt-div85.1%
Applied egg-rr85.1%
Final simplification61.1%
(FPCore (d h l M D)
:precision binary64
(if (<= d -5e-310)
(fabs (* d (pow (* h l) -0.5)))
(if (<= d 5.4e+55)
(* -0.125 (* (/ (sqrt h) (pow l 1.5)) (/ (pow (* M D) 2.0) d)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5e-310) {
tmp = fabs((d * pow((h * l), -0.5)));
} else if (d <= 5.4e+55) {
tmp = -0.125 * ((sqrt(h) / pow(l, 1.5)) * (pow((M * D), 2.0) / d));
} else {
tmp = d * (sqrt((1.0 / h)) / 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 (d <= (-5d-310)) then
tmp = abs((d * ((h * l) ** (-0.5d0))))
else if (d <= 5.4d+55) then
tmp = (-0.125d0) * ((sqrt(h) / (l ** 1.5d0)) * (((m * d_1) ** 2.0d0) / d))
else
tmp = d * (sqrt((1.0d0 / h)) / 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 (d <= -5e-310) {
tmp = Math.abs((d * Math.pow((h * l), -0.5)));
} else if (d <= 5.4e+55) {
tmp = -0.125 * ((Math.sqrt(h) / Math.pow(l, 1.5)) * (Math.pow((M * D), 2.0) / d));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -5e-310: tmp = math.fabs((d * math.pow((h * l), -0.5))) elif d <= 5.4e+55: tmp = -0.125 * ((math.sqrt(h) / math.pow(l, 1.5)) * (math.pow((M * D), 2.0) / d)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -5e-310) tmp = abs(Float64(d * (Float64(h * l) ^ -0.5))); elseif (d <= 5.4e+55) tmp = Float64(-0.125 * Float64(Float64(sqrt(h) / (l ^ 1.5)) * Float64((Float64(M * D) ^ 2.0) / d))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -5e-310) tmp = abs((d * ((h * l) ^ -0.5))); elseif (d <= 5.4e+55) tmp = -0.125 * ((sqrt(h) / (l ^ 1.5)) * (((M * D) ^ 2.0) / d)); else tmp = d * (sqrt((1.0 / h)) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5e-310], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, 5.4e+55], N[(-0.125 * N[(N[(N[Sqrt[h], $MachinePrecision] / N[Power[l, 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{+55}:\\
\;\;\;\;-0.125 \cdot \left(\frac{\sqrt{h}}{{\ell}^{1.5}} \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 65.1%
Simplified64.2%
Taylor expanded in d around inf 8.7%
add-sqr-sqrt2.2%
sqrt-unprod31.7%
pow231.7%
inv-pow31.7%
sqrt-pow131.7%
metadata-eval31.7%
Applied egg-rr31.7%
unpow231.7%
rem-sqrt-square45.4%
Simplified45.4%
if -4.999999999999985e-310 < d < 5.39999999999999954e55Initial program 49.8%
Simplified49.8%
fma-udef49.8%
*-commutative49.8%
*-un-lft-identity49.8%
times-frac49.8%
metadata-eval49.8%
*-commutative49.8%
Applied egg-rr49.8%
Taylor expanded in d around 0 32.7%
associate-*l/32.5%
unpow232.5%
unpow232.5%
swap-sqr39.5%
unpow239.5%
associate-/l*39.8%
Simplified39.8%
associate-/r/39.7%
*-commutative39.7%
sqrt-div41.9%
sqrt-pow159.0%
metadata-eval59.0%
Applied egg-rr59.0%
if 5.39999999999999954e55 < d Initial program 72.2%
Simplified73.8%
Taylor expanded in d around inf 74.3%
associate-/r*74.9%
sqrt-div85.1%
Applied egg-rr85.1%
Final simplification59.3%
(FPCore (d h l M D) :precision binary64 (if (<= d 1.65e-159) (fabs (* d (pow (* h l) -0.5))) (* d (* (pow l -0.5) (pow h -0.5)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.65e-159) {
tmp = fabs((d * pow((h * l), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
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 <= 1.65d-159) then
tmp = abs((d * ((h * l) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.65e-159) {
tmp = Math.abs((d * Math.pow((h * l), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 1.65e-159: tmp = math.fabs((d * math.pow((h * l), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= 1.65e-159) tmp = abs(Float64(d * (Float64(h * l) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= 1.65e-159) tmp = abs((d * ((h * l) ^ -0.5))); else tmp = d * ((l ^ -0.5) * (h ^ -0.5)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.65e-159], N[Abs[N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.65 \cdot 10^{-159}:\\
\;\;\;\;\left|d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right|\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 1.6500000000000001e-159Initial program 54.8%
Simplified54.1%
Taylor expanded in d around inf 11.0%
add-sqr-sqrt6.0%
sqrt-unprod26.6%
pow226.6%
inv-pow26.6%
sqrt-pow126.6%
metadata-eval26.6%
Applied egg-rr26.6%
unpow226.6%
rem-sqrt-square38.8%
Simplified38.8%
if 1.6500000000000001e-159 < d Initial program 72.2%
Simplified73.2%
fma-udef73.2%
*-commutative73.2%
*-un-lft-identity73.2%
times-frac73.2%
metadata-eval73.2%
*-commutative73.2%
Applied egg-rr73.2%
Taylor expanded in d around inf 52.4%
unpow1/252.4%
rem-exp-log50.2%
exp-neg50.3%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow52.4%
Simplified52.4%
*-commutative52.4%
unpow-prod-down63.7%
Applied egg-rr63.7%
Final simplification49.2%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (* d (pow (* h l) -0.5)))) (if (<= M 3e+77) (fabs t_0) t_0)))
double code(double d, double h, double l, double M, double D) {
double t_0 = d * pow((h * l), -0.5);
double tmp;
if (M <= 3e+77) {
tmp = fabs(t_0);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = d * ((h * l) ** (-0.5d0))
if (m <= 3d+77) then
tmp = abs(t_0)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d * Math.pow((h * l), -0.5);
double tmp;
if (M <= 3e+77) {
tmp = Math.abs(t_0);
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = d * math.pow((h * l), -0.5) tmp = 0 if M <= 3e+77: tmp = math.fabs(t_0) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(d * (Float64(h * l) ^ -0.5)) tmp = 0.0 if (M <= 3e+77) tmp = abs(t_0); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = d * ((h * l) ^ -0.5); tmp = 0.0; if (M <= 3e+77) tmp = abs(t_0); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, 3e+77], N[Abs[t$95$0], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;M \leq 3 \cdot 10^{+77}:\\
\;\;\;\;\left|t_0\right|\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if M < 2.9999999999999998e77Initial program 58.9%
Simplified58.9%
Taylor expanded in d around inf 29.5%
add-sqr-sqrt27.5%
sqrt-unprod33.8%
pow233.8%
inv-pow33.8%
sqrt-pow133.8%
metadata-eval33.8%
Applied egg-rr33.8%
unpow233.8%
rem-sqrt-square49.4%
Simplified49.4%
if 2.9999999999999998e77 < M Initial program 75.2%
Simplified75.2%
fma-udef75.2%
*-commutative75.2%
*-un-lft-identity75.2%
times-frac75.2%
metadata-eval75.2%
*-commutative75.2%
Applied egg-rr75.2%
Taylor expanded in d around inf 22.6%
unpow1/222.6%
rem-exp-log22.3%
exp-neg22.3%
exp-prod22.3%
distribute-lft-neg-out22.3%
distribute-rgt-neg-in22.3%
metadata-eval22.3%
exp-to-pow22.6%
Simplified22.6%
Final simplification44.2%
(FPCore (d h l M D) :precision binary64 (if (<= h -4e+127) (* d (sqrt (* h l))) (* d (sqrt (/ (/ 1.0 l) h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -4e+127) {
tmp = d * sqrt((h * 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 (h <= (-4d+127)) then
tmp = d * sqrt((h * 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 (h <= -4e+127) {
tmp = d * Math.sqrt((h * l));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -4e+127: tmp = d * math.sqrt((h * l)) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -4e+127) tmp = Float64(d * sqrt(Float64(h * l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -4e+127) tmp = d * sqrt((h * l)); else tmp = d * sqrt(((1.0 / l) / h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -4e+127], N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -4 \cdot 10^{+127}:\\
\;\;\;\;d \cdot \sqrt{h \cdot \ell}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if h < -3.99999999999999982e127Initial program 53.4%
Simplified53.4%
Taylor expanded in d around inf 3.4%
add-exp-log3.4%
log-rec3.4%
Applied egg-rr3.4%
add-sqr-sqrt0.5%
sqrt-unprod16.5%
sqr-neg16.5%
sqrt-unprod16.0%
add-sqr-sqrt16.5%
*-commutative16.5%
add-exp-log16.5%
Applied egg-rr16.5%
if -3.99999999999999982e127 < h Initial program 63.4%
Simplified63.4%
Taylor expanded in d around inf 32.2%
*-commutative32.2%
associate-/r*32.4%
Simplified32.4%
Final simplification30.2%
(FPCore (d h l M D) :precision binary64 (if (<= h -1.35e+127) (* d (sqrt (* h l))) (* d (pow (* h l) -0.5))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.35e+127) {
tmp = d * sqrt((h * l));
} else {
tmp = d * pow((h * l), -0.5);
}
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 <= (-1.35d+127)) then
tmp = d * sqrt((h * l))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.35e+127) {
tmp = d * Math.sqrt((h * l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -1.35e+127: tmp = d * math.sqrt((h * l)) else: tmp = d * math.pow((h * l), -0.5) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.35e+127) tmp = Float64(d * sqrt(Float64(h * l))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -1.35e+127) tmp = d * sqrt((h * l)); else tmp = d * ((h * l) ^ -0.5); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.35e+127], N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.35 \cdot 10^{+127}:\\
\;\;\;\;d \cdot \sqrt{h \cdot \ell}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if h < -1.3500000000000001e127Initial program 53.4%
Simplified53.4%
Taylor expanded in d around inf 3.4%
add-exp-log3.4%
log-rec3.4%
Applied egg-rr3.4%
add-sqr-sqrt0.5%
sqrt-unprod16.5%
sqr-neg16.5%
sqrt-unprod16.0%
add-sqr-sqrt16.5%
*-commutative16.5%
add-exp-log16.5%
Applied egg-rr16.5%
if -1.3500000000000001e127 < h Initial program 63.4%
Simplified63.4%
fma-udef63.4%
*-commutative63.4%
*-un-lft-identity63.4%
times-frac63.4%
metadata-eval63.4%
*-commutative63.4%
Applied egg-rr63.4%
Taylor expanded in d around inf 32.2%
unpow1/232.2%
rem-exp-log31.1%
exp-neg31.1%
exp-prod31.1%
distribute-lft-neg-out31.1%
distribute-rgt-neg-in31.1%
metadata-eval31.1%
exp-to-pow32.2%
Simplified32.2%
Final simplification30.0%
(FPCore (d h l M D) :precision binary64 (* d (sqrt (* h l))))
double code(double d, double h, double l, double M, double D) {
return d * sqrt((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 * sqrt((h * l))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * Math.sqrt((h * l));
}
def code(d, h, l, M, D): return d * math.sqrt((h * l))
function code(d, h, l, M, D) return Float64(d * sqrt(Float64(h * l))) end
function tmp = code(d, h, l, M, D) tmp = d * sqrt((h * l)); end
code[d_, h_, l_, M_, D_] := N[(d * N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d \cdot \sqrt{h \cdot \ell}
\end{array}
Initial program 62.0%
Simplified62.0%
Taylor expanded in d around inf 28.2%
add-exp-log27.2%
log-rec27.2%
Applied egg-rr27.2%
add-sqr-sqrt14.7%
sqrt-unprod18.4%
sqr-neg18.4%
sqrt-unprod3.5%
add-sqr-sqrt4.8%
*-commutative4.8%
add-exp-log4.8%
Applied egg-rr4.8%
Final simplification4.8%
herbie shell --seed 2023333
(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)))))