
(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 15 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
(if (<= l -2e-310)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* h (/ (* -0.5 (pow (* D (/ (* 0.5 M) d)) 2.0)) l)))))
(*
d
(/
(fma h (* (pow (* (/ D 2.0) (/ M d)) 2.0) (/ -0.5 l)) 1.0)
(* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-310) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + (h * ((-0.5 * pow((D * ((0.5 * M) / d)), 2.0)) / l))));
} else {
tmp = d * (fma(h, (pow(((D / 2.0) * (M / d)), 2.0) * (-0.5 / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D * Float64(Float64(0.5 * M) / d)) ^ 2.0)) / l))))); else tmp = Float64(d * Float64(fma(h, Float64((Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D * N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(D \cdot \frac{0.5 \cdot M}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 67.3%
Simplified68.0%
clear-num68.0%
associate-*l/68.0%
*-un-lft-identity68.0%
frac-times67.3%
div-inv67.3%
associate-*l*68.0%
associate-/r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
associate-/r/70.3%
*-commutative70.3%
associate-/l*70.3%
*-commutative70.3%
associate-*l*70.3%
Simplified70.3%
associate-*r/70.4%
associate-*r*70.3%
*-commutative70.3%
*-commutative70.3%
*-commutative70.3%
associate-*r*70.4%
associate-*l/70.4%
Applied egg-rr70.4%
frac-2neg70.4%
sqrt-div80.9%
Applied egg-rr80.9%
if -1.999999999999994e-310 < l Initial program 67.1%
Applied egg-rr67.2%
Simplified84.8%
Final simplification82.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2e-310)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* h (* (/ -0.5 l) (pow (* D (* M (/ 0.5 d))) 2.0))))))
(*
d
(/
(fma h (* (pow (* (/ D 2.0) (/ M d)) 2.0) (/ -0.5 l)) 1.0)
(* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2e-310) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + (h * ((-0.5 / l) * pow((D * (M * (0.5 / d))), 2.0)))));
} else {
tmp = d * (fma(h, (pow(((D / 2.0) * (M / d)), 2.0) * (-0.5 / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2e-310) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0)))))); else tmp = Float64(d * Float64(fma(h, Float64((Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2e-310], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + h \cdot \left(\frac{-0.5}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.999999999999994e-310Initial program 67.3%
Simplified68.0%
clear-num68.0%
associate-*l/68.0%
*-un-lft-identity68.0%
frac-times67.3%
div-inv67.3%
associate-*l*68.0%
associate-/r*68.0%
metadata-eval68.0%
Applied egg-rr68.0%
associate-/r/70.3%
*-commutative70.3%
associate-/l*70.3%
*-commutative70.3%
associate-*l*70.3%
Simplified70.3%
frac-2neg70.4%
sqrt-div80.9%
Applied egg-rr80.9%
if -1.999999999999994e-310 < l Initial program 67.1%
Applied egg-rr67.2%
Simplified84.8%
Final simplification82.7%
(FPCore (d h l M D)
:precision binary64
(if (<= h -3.2e-251)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ 1.0 (/ l (* (* h -0.5) (pow (* D (* 0.5 (/ M d))) 2.0)))))))
(if (<= h -2e-310)
(* d (- (sqrt (/ 1.0 (* l h)))))
(*
d
(/
(fma h (* (pow (* (/ D 2.0) (/ M d)) 2.0) (/ -0.5 l)) 1.0)
(* (sqrt l) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.2e-251) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * pow((D * (0.5 * (M / d))), 2.0))))));
} else if (h <= -2e-310) {
tmp = d * -sqrt((1.0 / (l * h)));
} else {
tmp = d * (fma(h, (pow(((D / 2.0) * (M / d)), 2.0) * (-0.5 / l)), 1.0) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (h <= -3.2e-251) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(1.0 / Float64(l / Float64(Float64(h * -0.5) * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0))))))); elseif (h <= -2e-310) tmp = Float64(d * Float64(-sqrt(Float64(1.0 / Float64(l * h))))); else tmp = Float64(d * Float64(fma(h, Float64((Float64(Float64(D / 2.0) * Float64(M / d)) ^ 2.0) * Float64(-0.5 / l)), 1.0) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -3.2e-251], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / N[(l / N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -2e-310], N[(d * (-N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[(h * N[(N[Power[N[(N[(D / 2.0), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -3.2 \cdot 10^{-251}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{1}{\frac{\ell}{\left(h \cdot -0.5\right) \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}}\right)\right)\\
\mathbf{elif}\;h \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{1}{\ell \cdot h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, {\left(\frac{D}{2} \cdot \frac{M}{d}\right)}^{2} \cdot \frac{-0.5}{\ell}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -3.19999999999999982e-251Initial program 69.5%
Simplified70.3%
clear-num70.2%
associate-*l/70.3%
*-un-lft-identity70.3%
frac-times69.5%
div-inv69.5%
associate-*l*70.3%
associate-/r*70.3%
metadata-eval70.3%
Applied egg-rr70.3%
associate-/r/72.7%
*-commutative72.7%
associate-/l*72.7%
*-commutative72.7%
associate-*l*72.8%
Simplified72.8%
associate-*r/72.8%
associate-*r*72.7%
*-commutative72.7%
*-commutative72.7%
*-commutative72.7%
associate-*r*72.8%
associate-*l/72.8%
Applied egg-rr72.8%
associate-*r/72.8%
clear-num72.8%
associate-*l/72.8%
associate-*r*72.8%
associate-*l/72.8%
associate-/l*72.8%
Applied egg-rr72.8%
if -3.19999999999999982e-251 < h < -1.999999999999994e-310Initial program 45.2%
Applied egg-rr36.7%
Simplified37.1%
Taylor expanded in d around -inf 83.3%
associate-*r*83.3%
neg-mul-183.3%
*-commutative83.3%
Simplified83.3%
if -1.999999999999994e-310 < h Initial program 67.1%
Applied egg-rr67.2%
Simplified84.8%
Final simplification79.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -2.2e-189)
(* d (- t_0))
(if (<= l -2e-310)
(* d (log1p (expm1 t_0)))
(if (<= l 3.1e-51)
(*
d
(/
(fma h (* (/ -0.5 l) (pow (* (/ M d) (* D 0.5)) 2.0)) 1.0)
(sqrt (* l h))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h)))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -2.2e-189) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = d * log1p(expm1(t_0));
} else if (l <= 3.1e-51) {
tmp = d * (fma(h, ((-0.5 / l) * pow(((M / d) * (D * 0.5)), 2.0)), 1.0) / sqrt((l * h)));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -2.2e-189) tmp = Float64(d * Float64(-t_0)); elseif (l <= -2e-310) tmp = Float64(d * log1p(expm1(t_0))); elseif (l <= 3.1e-51) tmp = Float64(d * Float64(fma(h, Float64(Float64(-0.5 / l) * (Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -2.2e-189], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Log[1 + N[(Exp[t$95$0] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.1e-51], N[(d * N[(N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{-189}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{-51}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, \frac{-0.5}{\ell} \cdot {\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.20000000000000019e-189Initial program 66.5%
Applied egg-rr27.2%
Simplified28.3%
Taylor expanded in d around -inf 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-rgt-neg-in52.7%
*-commutative52.7%
unpow1/252.7%
rem-exp-log49.6%
exp-neg49.6%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow53.4%
Simplified53.4%
if -2.20000000000000019e-189 < l < -1.999999999999994e-310Initial program 72.6%
Taylor expanded in d around inf 40.3%
log1p-expm1-u62.2%
pow1/262.2%
inv-pow62.2%
pow-pow62.2%
*-commutative62.2%
metadata-eval62.2%
Applied egg-rr62.2%
if -1.999999999999994e-310 < l < 3.0999999999999997e-51Initial program 73.6%
Applied egg-rr22.8%
Simplified27.5%
*-commutative27.5%
sqrt-prod29.5%
Applied egg-rr88.4%
if 3.0999999999999997e-51 < l Initial program 62.6%
Applied egg-rr69.7%
*-rgt-identity69.7%
distribute-lft-in71.1%
*-commutative71.1%
Simplified71.1%
Final simplification65.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -3e+229)
(* d (- (pow (* l h) -0.5)))
(if (<= l 7e-204)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* h (* (/ -0.5 l) (pow (* 0.5 (/ (* D M) d)) 2.0))))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3e+229) {
tmp = d * -pow((l * h), -0.5);
} else if (l <= 7e-204) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 / l) * pow((0.5 * ((D * M) / d)), 2.0)))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(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 (l <= (-3d+229)) then
tmp = d * -((l * h) ** (-0.5d0))
else if (l <= 7d-204) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (h * (((-0.5d0) / l) * ((0.5d0 * ((d_1 * m) / d)) ** 2.0d0)))))
else
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3e+229) {
tmp = d * -Math.pow((l * h), -0.5);
} else if (l <= 7e-204) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (h * ((-0.5 / l) * Math.pow((0.5 * ((D * M) / d)), 2.0)))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -3e+229: tmp = d * -math.pow((l * h), -0.5) elif l <= 7e-204: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (h * ((-0.5 / l) * math.pow((0.5 * ((D * M) / d)), 2.0))))) else: tmp = (1.0 + ((h / l) * (-0.5 * math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -3e+229) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.5))); elseif (l <= 7e-204) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 / l) * (Float64(0.5 * Float64(Float64(D * M) / d)) ^ 2.0)))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -3e+229) tmp = d * -((l * h) ^ -0.5); elseif (l <= 7e-204) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 / l) * ((0.5 * ((D * M) / d)) ^ 2.0))))); else tmp = (1.0 + ((h / l) * (-0.5 * ((M * (D * (0.5 / d))) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3e+229], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 7e-204], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3 \cdot 10^{+229}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{-204}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \left(\frac{-0.5}{\ell} \cdot {\left(0.5 \cdot \frac{D \cdot M}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.99999999999999998e229Initial program 37.1%
Applied egg-rr41.8%
Simplified42.0%
Taylor expanded in d around -inf 61.3%
mul-1-neg61.3%
*-commutative61.3%
distribute-rgt-neg-in61.3%
*-commutative61.3%
unpow1/261.3%
rem-exp-log57.9%
exp-neg57.9%
exp-prod57.9%
distribute-lft-neg-out57.9%
distribute-rgt-neg-in57.9%
metadata-eval57.9%
exp-to-pow61.3%
Simplified61.3%
if -2.99999999999999998e229 < l < 7.00000000000000054e-204Initial program 71.8%
Simplified71.1%
clear-num71.1%
associate-*l/71.2%
*-un-lft-identity71.2%
frac-times72.0%
div-inv71.9%
associate-*l*71.2%
associate-/r*71.2%
metadata-eval71.2%
Applied egg-rr71.2%
associate-/r/75.2%
*-commutative75.2%
associate-/l*75.2%
*-commutative75.2%
associate-*l*75.2%
Simplified75.2%
Taylor expanded in D around 0 75.2%
if 7.00000000000000054e-204 < l Initial program 67.1%
Applied egg-rr71.1%
*-rgt-identity71.1%
distribute-lft-in74.9%
*-commutative74.9%
Simplified74.9%
Final simplification74.0%
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.2e-204)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ 1.0 (/ l (* (* h -0.5) (pow (* D (* 0.5 (/ M d))) 2.0)))))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.2e-204) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * pow((D * (0.5 * (M / d))), 2.0))))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(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 (l <= 1.2d-204) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (1.0d0 / (l / ((h * (-0.5d0)) * ((d_1 * (0.5d0 * (m / d))) ** 2.0d0))))))
else
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.2e-204) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * Math.pow((D * (0.5 * (M / d))), 2.0))))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 1.2e-204: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * math.pow((D * (0.5 * (M / d))), 2.0)))))) else: tmp = (1.0 + ((h / l) * (-0.5 * math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.2e-204) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(1.0 / Float64(l / Float64(Float64(h * -0.5) * (Float64(D * Float64(0.5 * Float64(M / d))) ^ 2.0))))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 1.2e-204) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (1.0 / (l / ((h * -0.5) * ((D * (0.5 * (M / d))) ^ 2.0)))))); else tmp = (1.0 + ((h / l) * (-0.5 * ((M * (D * (0.5 / d))) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.2e-204], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(1.0 / N[(l / N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D * N[(0.5 * N[(M / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.2 \cdot 10^{-204}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{1}{\frac{\ell}{\left(h \cdot -0.5\right) \cdot {\left(D \cdot \left(0.5 \cdot \frac{M}{d}\right)\right)}^{2}}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.2e-204Initial program 67.3%
Simplified67.3%
clear-num67.3%
associate-*l/67.4%
*-un-lft-identity67.4%
frac-times67.4%
div-inv67.4%
associate-*l*67.4%
associate-/r*67.4%
metadata-eval67.4%
Applied egg-rr67.4%
associate-/r/70.9%
*-commutative70.9%
associate-/l*70.9%
*-commutative70.9%
associate-*l*70.9%
Simplified70.9%
associate-*r/70.9%
associate-*r*70.9%
*-commutative70.9%
*-commutative70.9%
*-commutative70.9%
associate-*r*70.9%
associate-*l/70.9%
Applied egg-rr70.9%
associate-*r/71.6%
clear-num71.6%
associate-*l/71.5%
associate-*r*71.5%
associate-*l/71.6%
associate-/l*71.6%
Applied egg-rr71.6%
if 1.2e-204 < l Initial program 67.1%
Applied egg-rr71.1%
*-rgt-identity71.1%
distribute-lft-in74.9%
*-commutative74.9%
Simplified74.9%
Final simplification72.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -9e-189)
(* d (- t_0))
(if (<= l -2e-310)
(* d (log1p (expm1 t_0)))
(*
d
(/
(fma h (* -0.5 (/ (pow (* (/ M d) (* D 0.5)) 2.0) l)) 1.0)
(sqrt (* l h))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -9e-189) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = d * log1p(expm1(t_0));
} else {
tmp = d * (fma(h, (-0.5 * (pow(((M / d) * (D * 0.5)), 2.0) / l)), 1.0) / sqrt((l * h)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -9e-189) tmp = Float64(d * Float64(-t_0)); elseif (l <= -2e-310) tmp = Float64(d * log1p(expm1(t_0))); else tmp = Float64(d * Float64(fma(h, Float64(-0.5 * Float64((Float64(Float64(M / d) * Float64(D * 0.5)) ^ 2.0) / l)), 1.0) / sqrt(Float64(l * h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -9e-189], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Log[1 + N[(Exp[t$95$0] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(h * N[(-0.5 * N[(N[Power[N[(N[(M / d), $MachinePrecision] * N[(D * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -9 \cdot 10^{-189}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(h, -0.5 \cdot \frac{{\left(\frac{M}{d} \cdot \left(D \cdot 0.5\right)\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -8.9999999999999992e-189Initial program 66.5%
Applied egg-rr27.2%
Simplified28.3%
Taylor expanded in d around -inf 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-rgt-neg-in52.7%
*-commutative52.7%
unpow1/252.7%
rem-exp-log49.6%
exp-neg49.6%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow53.4%
Simplified53.4%
if -8.9999999999999992e-189 < l < -1.999999999999994e-310Initial program 72.6%
Taylor expanded in d around inf 40.3%
log1p-expm1-u62.2%
pow1/262.2%
inv-pow62.2%
pow-pow62.2%
*-commutative62.2%
metadata-eval62.2%
Applied egg-rr62.2%
if -1.999999999999994e-310 < l Initial program 67.1%
Applied egg-rr25.3%
Simplified27.5%
sqrt-prod29.0%
unpow229.0%
sqrt-prod39.0%
add-sqr-sqrt39.1%
sqrt-div40.0%
Applied egg-rr73.0%
associate-*l/73.0%
associate-*l*73.0%
associate-/l*73.0%
associate-/l*73.0%
associate-/l*73.0%
associate-*l*73.0%
Simplified73.0%
Final simplification63.3%
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.1e-204)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* h (* (/ -0.5 l) (pow (* D (* M (/ 0.5 d))) 2.0))))
(sqrt (/ d h))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.1e-204) {
tmp = sqrt((d / l)) * ((1.0 + (h * ((-0.5 / l) * pow((D * (M * (0.5 / d))), 2.0)))) * sqrt((d / h)));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(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 (l <= 1.1d-204) then
tmp = sqrt((d / l)) * ((1.0d0 + (h * (((-0.5d0) / l) * ((d_1 * (m * (0.5d0 / d))) ** 2.0d0)))) * sqrt((d / h)))
else
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.1e-204) {
tmp = Math.sqrt((d / l)) * ((1.0 + (h * ((-0.5 / l) * Math.pow((D * (M * (0.5 / d))), 2.0)))) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 1.1e-204: tmp = math.sqrt((d / l)) * ((1.0 + (h * ((-0.5 / l) * math.pow((D * (M * (0.5 / d))), 2.0)))) * math.sqrt((d / h))) else: tmp = (1.0 + ((h / l) * (-0.5 * math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.1e-204) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 / l) * (Float64(D * Float64(M * Float64(0.5 / d))) ^ 2.0)))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 1.1e-204) tmp = sqrt((d / l)) * ((1.0 + (h * ((-0.5 / l) * ((D * (M * (0.5 / d))) ^ 2.0)))) * sqrt((d / h))); else tmp = (1.0 + ((h / l) * (-0.5 * ((M * (D * (0.5 / d))) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.1e-204], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(h * N[(N[(-0.5 / l), $MachinePrecision] * N[Power[N[(D * N[(M * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.1 \cdot 10^{-204}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + h \cdot \left(\frac{-0.5}{\ell} \cdot {\left(D \cdot \left(M \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.0999999999999999e-204Initial program 67.3%
Simplified67.3%
clear-num67.3%
associate-*l/67.4%
*-un-lft-identity67.4%
frac-times67.4%
div-inv67.4%
associate-*l*67.4%
associate-/r*67.4%
metadata-eval67.4%
Applied egg-rr67.4%
associate-/r/70.9%
*-commutative70.9%
associate-/l*70.9%
*-commutative70.9%
associate-*l*70.9%
Simplified70.9%
if 1.0999999999999999e-204 < l Initial program 67.1%
Applied egg-rr71.1%
*-rgt-identity71.1%
distribute-lft-in74.9%
*-commutative74.9%
Simplified74.9%
Final simplification72.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l 9.5e-205)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* h (/ (* -0.5 (pow (* D (/ (* 0.5 M) d)) 2.0)) l)))
(sqrt (/ d h))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.5e-205) {
tmp = sqrt((d / l)) * ((1.0 + (h * ((-0.5 * pow((D * ((0.5 * M) / d)), 2.0)) / l))) * sqrt((d / h)));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(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 (l <= 9.5d-205) then
tmp = sqrt((d / l)) * ((1.0d0 + (h * (((-0.5d0) * ((d_1 * ((0.5d0 * m) / d)) ** 2.0d0)) / l))) * sqrt((d / h)))
else
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.5e-205) {
tmp = Math.sqrt((d / l)) * ((1.0 + (h * ((-0.5 * Math.pow((D * ((0.5 * M) / d)), 2.0)) / l))) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 9.5e-205: tmp = math.sqrt((d / l)) * ((1.0 + (h * ((-0.5 * math.pow((D * ((0.5 * M) / d)), 2.0)) / l))) * math.sqrt((d / h))) else: tmp = (1.0 + ((h / l) * (-0.5 * math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 9.5e-205) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D * Float64(Float64(0.5 * M) / d)) ^ 2.0)) / l))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 9.5e-205) tmp = sqrt((d / l)) * ((1.0 + (h * ((-0.5 * ((D * ((0.5 * M) / d)) ^ 2.0)) / l))) * sqrt((d / h))); else tmp = (1.0 + ((h / l) * (-0.5 * ((M * (D * (0.5 / d))) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 9.5e-205], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D * N[(N[(0.5 * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9.5 \cdot 10^{-205}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + h \cdot \frac{-0.5 \cdot {\left(D \cdot \frac{0.5 \cdot M}{d}\right)}^{2}}{\ell}\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 9.49999999999999957e-205Initial program 67.3%
Simplified67.3%
clear-num67.3%
associate-*l/67.4%
*-un-lft-identity67.4%
frac-times67.4%
div-inv67.4%
associate-*l*67.4%
associate-/r*67.4%
metadata-eval67.4%
Applied egg-rr67.4%
associate-/r/70.9%
*-commutative70.9%
associate-/l*70.9%
*-commutative70.9%
associate-*l*70.9%
Simplified70.9%
associate-*r/70.9%
associate-*r*70.9%
*-commutative70.9%
*-commutative70.9%
*-commutative70.9%
associate-*r*70.9%
associate-*l/70.9%
Applied egg-rr70.9%
if 9.49999999999999957e-205 < l Initial program 67.1%
Applied egg-rr71.1%
*-rgt-identity71.1%
distribute-lft-in74.9%
*-commutative74.9%
Simplified74.9%
Final simplification72.6%
(FPCore (d h l M D)
:precision binary64
(if (<= l 1.7e-204)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* h (/ (* -0.5 (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))))
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (* M (* D (/ 0.5 d))) 2.0))))
(/ d (* (sqrt l) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.7e-204) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * pow((D / ((d * 2.0) / M)), 2.0)) / l))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * pow((M * (D * (0.5 / d))), 2.0)))) * (d / (sqrt(l) * sqrt(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 (l <= 1.7d-204) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (h * (((-0.5d0) * ((d_1 / ((d * 2.0d0) / m)) ** 2.0d0)) / l))))
else
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * ((m * (d_1 * (0.5d0 / d))) ** 2.0d0)))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 1.7e-204) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (h * ((-0.5 * Math.pow((D / ((d * 2.0) / M)), 2.0)) / l))));
} else {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 1.7e-204: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (h * ((-0.5 * math.pow((D / ((d * 2.0) / M)), 2.0)) / l)))) else: tmp = (1.0 + ((h / l) * (-0.5 * math.pow((M * (D * (0.5 / d))), 2.0)))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 1.7e-204) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(M * Float64(D * Float64(0.5 / d))) ^ 2.0)))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 1.7e-204) tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((-0.5 * ((D / ((d * 2.0) / M)) ^ 2.0)) / l)))); else tmp = (1.0 + ((h / l) * (-0.5 * ((M * (D * (0.5 / d))) ^ 2.0)))) * (d / (sqrt(l) * sqrt(h))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 1.7e-204], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.7 \cdot 10^{-204}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(M \cdot \left(D \cdot \frac{0.5}{d}\right)\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.7000000000000001e-204Initial program 67.3%
Simplified67.3%
clear-num67.3%
associate-*l/67.4%
*-un-lft-identity67.4%
frac-times67.4%
div-inv67.4%
associate-*l*67.4%
associate-/r*67.4%
metadata-eval67.4%
Applied egg-rr67.4%
associate-/r/70.9%
*-commutative70.9%
associate-/l*70.9%
*-commutative70.9%
associate-*l*70.9%
Simplified70.9%
associate-*r/70.9%
associate-*r*70.9%
*-commutative70.9%
*-commutative70.9%
*-commutative70.9%
associate-*r*70.9%
associate-*l/70.9%
Applied egg-rr70.9%
clear-num70.9%
un-div-inv70.9%
*-un-lft-identity70.9%
times-frac70.9%
metadata-eval70.9%
Applied egg-rr70.9%
associate-*r/70.9%
Simplified70.9%
if 1.7000000000000001e-204 < l Initial program 67.1%
Applied egg-rr71.1%
*-rgt-identity71.1%
distribute-lft-in74.9%
*-commutative74.9%
Simplified74.9%
Final simplification72.5%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -4.1e-190)
(* d (- t_0))
(if (<= l -2e-310)
(log1p (expm1 (* d t_0)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -4.1e-190) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = log1p(expm1((d * t_0)));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -4.1e-190) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = Math.log1p(Math.expm1((d * t_0)));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -4.1e-190: tmp = d * -t_0 elif l <= -2e-310: tmp = math.log1p(math.expm1((d * t_0))) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -4.1e-190) tmp = Float64(d * Float64(-t_0)); elseif (l <= -2e-310) tmp = log1p(expm1(Float64(d * t_0))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -4.1e-190], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -2e-310], N[Log[1 + N[(Exp[N[(d * t$95$0), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -4.1 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(d \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.1000000000000002e-190Initial program 66.5%
Applied egg-rr27.2%
Simplified28.3%
Taylor expanded in d around -inf 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-rgt-neg-in52.7%
*-commutative52.7%
unpow1/252.7%
rem-exp-log49.6%
exp-neg49.6%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow53.4%
Simplified53.4%
if -4.1000000000000002e-190 < l < -1.999999999999994e-310Initial program 72.6%
Taylor expanded in d around inf 40.3%
log1p-expm1-u56.2%
pow1/256.2%
inv-pow56.2%
pow-pow56.2%
*-commutative56.2%
metadata-eval56.2%
Applied egg-rr56.2%
if -1.999999999999994e-310 < l Initial program 67.1%
Taylor expanded in d around inf 39.6%
associate-/r*40.6%
sqrt-div45.0%
Applied egg-rr45.0%
Final simplification49.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* l h) -0.5)))
(if (<= l -2.3e-188)
(* d (- t_0))
(if (<= l -2e-310)
(* d (log1p (expm1 t_0)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -2.3e-188) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = d * log1p(expm1(t_0));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -2.3e-188) {
tmp = d * -t_0;
} else if (l <= -2e-310) {
tmp = d * Math.log1p(Math.expm1(t_0));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -2.3e-188: tmp = d * -t_0 elif l <= -2e-310: tmp = d * math.log1p(math.expm1(t_0)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -2.3e-188) tmp = Float64(d * Float64(-t_0)); elseif (l <= -2e-310) tmp = Float64(d * log1p(expm1(t_0))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -2.3e-188], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[l, -2e-310], N[(d * N[Log[1 + N[(Exp[t$95$0] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-188}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3e-188Initial program 66.5%
Applied egg-rr27.2%
Simplified28.3%
Taylor expanded in d around -inf 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-rgt-neg-in52.7%
*-commutative52.7%
unpow1/252.7%
rem-exp-log49.6%
exp-neg49.6%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow53.4%
Simplified53.4%
if -2.3e-188 < l < -1.999999999999994e-310Initial program 72.6%
Taylor expanded in d around inf 40.3%
log1p-expm1-u62.2%
pow1/262.2%
inv-pow62.2%
pow-pow62.2%
*-commutative62.2%
metadata-eval62.2%
Applied egg-rr62.2%
if -1.999999999999994e-310 < l Initial program 67.1%
Taylor expanded in d around inf 39.6%
associate-/r*40.6%
sqrt-div45.0%
Applied egg-rr45.0%
Final simplification50.0%
(FPCore (d h l M D) :precision binary64 (if (<= d 6e-206) (* d (- (pow (* l h) -0.5))) (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 6e-206) {
tmp = d * -pow((l * h), -0.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) :: tmp
if (d <= 6d-206) then
tmp = d * -((l * h) ** (-0.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 tmp;
if (d <= 6e-206) {
tmp = d * -Math.pow((l * h), -0.5);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= 6e-206: tmp = d * -math.pow((l * h), -0.5) 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 <= 6e-206) tmp = Float64(d * Float64(-(Float64(l * h) ^ -0.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) tmp = 0.0; if (d <= 6e-206) tmp = d * -((l * h) ^ -0.5); else tmp = d * (sqrt((1.0 / h)) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, 6e-206], N[(d * (-N[Power[N[(l * h), $MachinePrecision], -0.5], $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 6 \cdot 10^{-206}:\\
\;\;\;\;d \cdot \left(-{\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < 6.0000000000000004e-206Initial program 64.6%
Applied egg-rr22.5%
Simplified24.7%
Taylor expanded in d around -inf 45.9%
mul-1-neg45.9%
*-commutative45.9%
distribute-rgt-neg-in45.9%
*-commutative45.9%
unpow1/245.9%
rem-exp-log43.5%
exp-neg43.5%
exp-prod43.9%
distribute-lft-neg-out43.9%
distribute-rgt-neg-in43.9%
metadata-eval43.9%
exp-to-pow46.4%
Simplified46.4%
if 6.0000000000000004e-206 < d Initial program 71.3%
Taylor expanded in d around inf 44.1%
associate-/r*45.3%
sqrt-div50.6%
Applied egg-rr50.6%
Final simplification48.1%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (pow (* l h) -0.5))) (if (<= l -1.2e-190) (* d (- t_0)) (* d t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (l <= -1.2e-190) {
tmp = d * -t_0;
} else {
tmp = d * 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 = (l * h) ** (-0.5d0)
if (l <= (-1.2d-190)) then
tmp = d * -t_0
else
tmp = d * 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 = Math.pow((l * h), -0.5);
double tmp;
if (l <= -1.2e-190) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if l <= -1.2e-190: tmp = d * -t_0 else: tmp = d * t_0 return tmp
function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (l <= -1.2e-190) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (l * h) ^ -0.5; tmp = 0.0; if (l <= -1.2e-190) tmp = d * -t_0; else tmp = d * t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, -1.2e-190], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -1.2 \cdot 10^{-190}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -1.2e-190Initial program 66.5%
Applied egg-rr27.2%
Simplified28.3%
Taylor expanded in d around -inf 52.7%
mul-1-neg52.7%
*-commutative52.7%
distribute-rgt-neg-in52.7%
*-commutative52.7%
unpow1/252.7%
rem-exp-log49.6%
exp-neg49.6%
exp-prod50.2%
distribute-lft-neg-out50.2%
distribute-rgt-neg-in50.2%
metadata-eval50.2%
exp-to-pow53.4%
Simplified53.4%
if -1.2e-190 < l Initial program 67.8%
Applied egg-rr23.5%
Simplified26.1%
Taylor expanded in d around inf 39.7%
*-commutative39.7%
unpow1/239.7%
rem-exp-log38.1%
exp-neg38.1%
exp-prod38.9%
distribute-lft-neg-out38.9%
distribute-rgt-neg-in38.9%
metadata-eval38.9%
exp-to-pow40.6%
Simplified40.6%
Final simplification46.4%
(FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
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 * ((l * h) ** (-0.5d0))
end function
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
function tmp = code(d, h, l, M, D) tmp = d * ((l * h) ^ -0.5); end
code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 67.2%
Applied egg-rr25.2%
Simplified27.1%
Taylor expanded in d around inf 24.5%
*-commutative24.5%
unpow1/224.5%
rem-exp-log23.6%
exp-neg23.6%
exp-prod24.1%
distribute-lft-neg-out24.1%
distribute-rgt-neg-in24.1%
metadata-eval24.1%
exp-to-pow25.0%
Simplified25.0%
Final simplification25.0%
herbie shell --seed 2024045
(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)))))