
(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 21 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))))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(/ t_0 (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))))
(if (<= l 1.15e+131)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * ((t_0 / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))));
} else if (l <= 1.15e+131) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))))); elseif (l <= 1.15e+131) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $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[l, 1.15e+131], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \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}\;\ell \leq 1.15 \cdot 10^{+131}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
frac-2neg67.3%
sqrt-div77.3%
Applied egg-rr77.3%
frac-2neg77.3%
sqrt-div83.7%
Applied egg-rr83.7%
if -4.999999999999985e-310 < l < 1.14999999999999996e131Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 1.14999999999999996e131 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification84.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= l -5e+60)
(*
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5))))
t_0)
(if (<= l -5e-310)
(*
(- 1.0 (* 0.5 (/ (* h (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))
(* (sqrt (/ d l)) t_0))
(if (<= l 7e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (l <= -5e+60) {
tmp = ((sqrt(-d) / sqrt(-l)) * (1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5)))) * t_0;
} else if (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * pow((D / ((d * 2.0) / M)), 2.0)) / l))) * (sqrt((d / l)) * t_0);
} else if (l <= 7e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -5e+60) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5)))) * t_0); elseif (l <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * t_0)); elseif (l <= 7e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e+60], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $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] * t$95$0), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{+60}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.99999999999999975e60Initial program 52.7%
Simplified54.2%
frac-2neg64.1%
sqrt-div79.4%
Applied egg-rr65.6%
if -4.99999999999999975e60 < l < -4.999999999999985e-310Initial program 75.2%
Simplified75.2%
clear-num75.2%
frac-times76.3%
*-un-lft-identity76.3%
associate-*l/76.3%
*-un-lft-identity76.3%
times-frac76.3%
metadata-eval76.3%
Applied egg-rr76.3%
associate-*r/81.0%
associate-*r/81.0%
Applied egg-rr81.0%
if -4.999999999999985e-310 < l < 7.0000000000000002e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 7.0000000000000002e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification79.7%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= l -7.5e+50)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) t_0)
(- 1.0 (* 0.5 (* (/ h l) (pow (/ D (* 2.0 (/ d M))) 2.0)))))
(if (<= l -5e-310)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M 0.5)) 2.0)) l)))
(* t_0 (/ 1.0 (sqrt (/ l d)))))
(if (<= l 8e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (l <= -7.5e+50) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * (1.0 - (0.5 * ((h / l) * pow((D / (2.0 * (d / M))), 2.0))));
} else if (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * pow(((D / d) * (M * 0.5)), 2.0)) / l))) * (t_0 * (1.0 / sqrt((l / d))));
} else if (l <= 8e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -7.5e+50) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D / Float64(2.0 * Float64(d / M))) ^ 2.0))))); elseif (l <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(t_0 * Float64(1.0 / sqrt(Float64(l / d))))); elseif (l <= 8e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -7.5e+50], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D / N[(2.0 * N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -7.5 \cdot 10^{+50}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_0\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D}{2 \cdot \frac{d}{M}}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(t\_0 \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right)\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -7.4999999999999999e50Initial program 54.4%
Simplified54.0%
clear-num54.0%
frac-times54.8%
*-un-lft-identity54.8%
associate-*l/54.8%
*-un-lft-identity54.8%
times-frac54.8%
metadata-eval54.8%
Applied egg-rr54.8%
frac-2neg63.6%
sqrt-div78.3%
Applied egg-rr61.7%
if -7.4999999999999999e50 < l < -4.999999999999985e-310Initial program 74.6%
Simplified75.8%
associate-*r/80.5%
add-sqr-sqrt50.2%
add-sqr-sqrt80.5%
div-inv80.5%
metadata-eval80.5%
Applied egg-rr80.5%
clear-num80.6%
sqrt-div80.6%
metadata-eval80.6%
Applied egg-rr80.6%
if -4.999999999999985e-310 < l < 8.0000000000000005e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 8.0000000000000005e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification78.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M 0.5)) 2.0)) l))))
(if (<= l 7.1e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((D / d) * (M * 0.5)), 2.0)) / l)));
} else if (l <= 7.1e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) / l)))); elseif (l <= 7.1e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.1e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 7.1 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
associate-*r/69.5%
add-sqr-sqrt41.5%
add-sqr-sqrt69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
frac-2neg77.3%
sqrt-div83.7%
Applied egg-rr75.1%
if -4.999999999999985e-310 < l < 7.1000000000000002e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 7.1000000000000002e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification79.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (/ D (/ (* d 2.0) M)) 2.0)) l))))
(if (<= l 7.5e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow((D / ((d * 2.0) / M)), 2.0)) / l)));
} else if (l <= 7.5e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l)))); elseif (l <= 7.5e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
clear-num67.3%
frac-times67.6%
*-un-lft-identity67.6%
associate-*l/67.6%
*-un-lft-identity67.6%
times-frac67.6%
metadata-eval67.6%
Applied egg-rr67.6%
associate-*r/69.8%
associate-*r/69.8%
Applied egg-rr69.8%
frac-2neg77.3%
sqrt-div83.7%
Applied egg-rr75.2%
if -4.999999999999985e-310 < l < 7.5000000000000003e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 7.5000000000000003e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification79.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))
(sqrt (/ d l))))
(if (<= l 7e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else if (l <= 7e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l)))); elseif (l <= 7e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 7 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
frac-2neg67.3%
sqrt-div77.3%
Applied egg-rr77.3%
if -4.999999999999985e-310 < l < 7.0000000000000002e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 7.0000000000000002e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification80.9%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(- 1.0 (* 0.5 (/ (* h (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(if (<= l 6.6e+130)
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))
(*
(/ d (sqrt h))
(/
(fma (pow (* D (/ M (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0)
(sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * pow((D / ((d * 2.0) / M)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else if (l <= 6.6e+130) {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(h) * sqrt(l)));
} else {
tmp = (d / sqrt(h)) * (fma(pow((D * (M / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0) / sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); elseif (l <= 6.6e+130) tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(fma((Float64(D * Float64(M / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0) / sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.6e+130], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(D * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;\ell \leq 6.6 \cdot 10^{+130}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{\mathsf{fma}\left({\left(D \cdot \frac{M}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
clear-num67.3%
frac-times67.6%
*-un-lft-identity67.6%
associate-*l/67.6%
*-un-lft-identity67.6%
times-frac67.6%
metadata-eval67.6%
Applied egg-rr67.6%
associate-*r/69.8%
associate-*r/69.8%
Applied egg-rr69.8%
if -4.999999999999985e-310 < l < 6.6e130Initial program 68.8%
Simplified67.4%
Applied egg-rr36.3%
expm1-def50.2%
expm1-log1p86.3%
*-commutative86.3%
Simplified87.7%
fma-udef87.7%
associate-*r/87.7%
*-commutative87.7%
Applied egg-rr87.7%
associate-*l/93.1%
*-commutative93.1%
*-un-lft-identity93.1%
*-commutative93.1%
times-frac93.1%
metadata-eval93.1%
Applied egg-rr93.1%
if 6.6e130 < l Initial program 51.8%
Simplified51.8%
Applied egg-rr44.3%
Simplified71.8%
Final simplification76.8%
(FPCore (d h l M D)
:precision binary64
(if (<= d -3.6e+213)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= d -1.65e-303)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ (* M D) 2.0) d) 2.0))))))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.6e+213) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 <= (-3.6d+213)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (d <= (-1.65d-303)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((((m * d_1) / 2.0d0) / d) ** 2.0d0)))))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 <= -3.6e+213) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -3.6e+213: tmp = d * -math.sqrt(((1.0 / l) / h)) elif d <= -1.65e-303: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow((((M * D) / 2.0) / d), 2.0))))) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.6e+213) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (d <= -1.65e-303) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0)))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -3.6e+213) tmp = d * -sqrt(((1.0 / l) / h)); elseif (d <= -1.65e-303) tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * ((((M * D) / 2.0) / d) ^ 2.0))))); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.6e+213], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1.65e-303], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(N[(M * D), $MachinePrecision] / 2.0), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.6 \cdot 10^{+213}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{\frac{M \cdot D}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.6000000000000001e213Initial program 63.3%
Simplified72.1%
associate-*r/73.0%
add-sqr-sqrt49.2%
add-sqr-sqrt73.0%
div-inv73.0%
metadata-eval73.0%
Applied egg-rr73.0%
clear-num72.9%
sqrt-div72.9%
metadata-eval72.9%
Applied egg-rr72.9%
Taylor expanded in d around -inf 88.6%
mul-1-neg88.6%
distribute-rgt-neg-in88.6%
*-commutative88.6%
associate-/r*88.6%
Simplified88.6%
if -3.6000000000000001e213 < d < -1.6499999999999999e-303Initial program 68.5%
Simplified67.6%
frac-times68.5%
associate-/r*68.5%
Applied egg-rr68.5%
if -1.6499999999999999e-303 < d Initial program 61.5%
Simplified60.6%
Applied egg-rr38.6%
expm1-def54.5%
expm1-log1p78.8%
*-commutative78.8%
Simplified79.6%
fma-udef79.6%
associate-*r/78.8%
*-commutative78.8%
Applied egg-rr78.8%
associate-*l/79.8%
*-commutative79.8%
*-un-lft-identity79.8%
*-commutative79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification75.3%
(FPCore (d h l M D)
:precision binary64
(if (<= d -6e+212)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= d -1.65e-303)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (pow (* M (* (/ D d) 0.5)) 2.0) (/ l h)))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6e+212) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * pow(((M * D) / (d * 2.0)), 2.0))));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-6d+212)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (d <= (-1.65d-303)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (((m * ((d_1 / d) * 0.5d0)) ** 2.0d0) / (l / h))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((m * d_1) / (d * 2.0d0)) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6e+212) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (Math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -6e+212: tmp = d * -math.sqrt(((1.0 / l) / h)) elif d <= -1.65e-303: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h)))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + ((h / l) * (-0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -6e+212) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (d <= -1.65e-303) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64((Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0) / Float64(l / h))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0))))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -6e+212) tmp = d * -sqrt(((1.0 / l) / h)); elseif (d <= -1.65e-303) tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (((M * ((D / d) * 0.5)) ^ 2.0) / (l / h)))); else tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + ((h / l) * (-0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -6e+212], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1.65e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $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[(M * D), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6 \cdot 10^{+212}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if d < -6e212Initial program 64.9%
Simplified73.4%
associate-*r/74.2%
add-sqr-sqrt51.5%
add-sqr-sqrt74.2%
div-inv74.2%
metadata-eval74.2%
Applied egg-rr74.2%
clear-num74.1%
sqrt-div74.0%
metadata-eval74.0%
Applied egg-rr74.0%
Taylor expanded in d around -inf 89.1%
mul-1-neg89.1%
distribute-rgt-neg-in89.1%
*-commutative89.1%
associate-/r*89.2%
Simplified89.2%
if -6e212 < d < -1.6499999999999999e-303Initial program 68.2%
Simplified67.3%
associate-*r/69.8%
add-sqr-sqrt40.3%
add-sqr-sqrt69.8%
div-inv69.8%
metadata-eval69.8%
Applied egg-rr69.8%
expm1-log1p-u35.4%
expm1-udef22.1%
Applied egg-rr18.5%
expm1-def28.8%
expm1-log1p60.4%
*-commutative60.4%
Simplified60.4%
if -1.6499999999999999e-303 < d Initial program 61.5%
Simplified60.6%
Applied egg-rr38.6%
expm1-def54.5%
expm1-log1p78.8%
*-commutative78.8%
Simplified79.6%
fma-udef79.6%
associate-*r/78.8%
*-commutative78.8%
Applied egg-rr78.8%
Final simplification71.3%
(FPCore (d h l M D)
:precision binary64
(if (<= d -5.4e+212)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= d -1.65e-303)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (pow (* M (* (/ D d) 0.5)) 2.0) (/ l h)))))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -5.4e+212) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 <= (-5.4d+212)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (d <= (-1.65d-303)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (((m * ((d_1 / d) * 0.5d0)) ** 2.0d0) / (l / h))))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 <= -5.4e+212) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (d <= -1.65e-303) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (Math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -5.4e+212: tmp = d * -math.sqrt(((1.0 / l) / h)) elif d <= -1.65e-303: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h)))) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -5.4e+212) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (d <= -1.65e-303) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64((Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0) / Float64(l / h))))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -5.4e+212) tmp = d * -sqrt(((1.0 / l) / h)); elseif (d <= -1.65e-303) tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (((M * ((D / d) * 0.5)) ^ 2.0) / (l / h)))); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -5.4e+212], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -1.65e-303], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5.4 \cdot 10^{+212}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -5.4e212Initial program 64.9%
Simplified73.4%
associate-*r/74.2%
add-sqr-sqrt51.5%
add-sqr-sqrt74.2%
div-inv74.2%
metadata-eval74.2%
Applied egg-rr74.2%
clear-num74.1%
sqrt-div74.0%
metadata-eval74.0%
Applied egg-rr74.0%
Taylor expanded in d around -inf 89.1%
mul-1-neg89.1%
distribute-rgt-neg-in89.1%
*-commutative89.1%
associate-/r*89.2%
Simplified89.2%
if -5.4e212 < d < -1.6499999999999999e-303Initial program 68.2%
Simplified67.3%
associate-*r/69.8%
add-sqr-sqrt40.3%
add-sqr-sqrt69.8%
div-inv69.8%
metadata-eval69.8%
Applied egg-rr69.8%
expm1-log1p-u35.4%
expm1-udef22.1%
Applied egg-rr18.5%
expm1-def28.8%
expm1-log1p60.4%
*-commutative60.4%
Simplified60.4%
if -1.6499999999999999e-303 < d Initial program 61.5%
Simplified60.6%
Applied egg-rr38.6%
expm1-def54.5%
expm1-log1p78.8%
*-commutative78.8%
Simplified79.6%
fma-udef79.6%
associate-*r/78.8%
*-commutative78.8%
Applied egg-rr78.8%
associate-*l/79.8%
*-commutative79.8%
*-un-lft-identity79.8%
*-commutative79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification71.7%
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.65e-303)
(*
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))
(sqrt (/ d l)))
(sqrt (/ d h)))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.65e-303) {
tmp = ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 <= (-1.65d-303)) then
tmp = ((1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / l))) * sqrt((d / h))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 <= -1.65e-303) {
tmp = ((1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * Math.sqrt((d / l))) * Math.sqrt((d / h));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -1.65e-303: tmp = ((1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * math.sqrt((d / l))) * math.sqrt((d / h)) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.65e-303) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -1.65e-303) tmp = ((1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5))) * sqrt((d / l))) * sqrt((d / h)); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.65e-303], N[(N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.65 \cdot 10^{-303}:\\
\;\;\;\;\left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6499999999999999e-303Initial program 67.7%
Simplified68.3%
if -1.6499999999999999e-303 < d Initial program 61.5%
Simplified60.6%
Applied egg-rr38.6%
expm1-def54.5%
expm1-log1p78.8%
*-commutative78.8%
Simplified79.6%
fma-udef79.6%
associate-*r/78.8%
*-commutative78.8%
Applied egg-rr78.8%
associate-*l/79.8%
*-commutative79.8%
*-un-lft-identity79.8%
*-commutative79.8%
times-frac79.8%
metadata-eval79.8%
Applied egg-rr79.8%
Final simplification73.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (/ (* h (* -0.5 (pow (* (/ D d) (* M 0.5)) 2.0))) l))))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h * (-0.5 * pow(((D / d) * (M * 0.5)), 2.0))) / l)));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 (l <= (-5d-310)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h * ((-0.5d0) * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0))) / l)))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 (l <= -5e-310) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h * (-0.5 * Math.pow(((D / d) * (M * 0.5)), 2.0))) / l)));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h * (-0.5 * math.pow(((D / d) * (M * 0.5)), 2.0))) / l))) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) / l)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -5e-310) tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h * (-0.5 * (((D / d) * (M * 0.5)) ^ 2.0))) / l))); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
associate-*l/68.9%
Applied egg-rr68.9%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Applied egg-rr39.3%
expm1-def55.4%
expm1-log1p80.1%
*-commutative80.1%
Simplified81.0%
fma-udef81.0%
associate-*r/80.2%
*-commutative80.2%
Applied egg-rr80.2%
associate-*l/81.2%
*-commutative81.2%
*-un-lft-identity81.2%
*-commutative81.2%
times-frac81.2%
metadata-eval81.2%
Applied egg-rr81.2%
Final simplification74.4%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D d) (* M 0.5)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * pow(((D / d) * (M * 0.5)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 (l <= (-5d-310)) then
tmp = (1.0d0 - (0.5d0 * ((h * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0)) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * Math.pow(((D / d) * (M * 0.5)), 2.0)) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = (1.0 - (0.5 * ((h * math.pow(((D / d) * (M * 0.5)), 2.0)) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -5e-310) tmp = (1.0 - (0.5 * ((h * (((D / d) * (M * 0.5)) ^ 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h))); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D / d), $MachinePrecision] * N[(M * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{d} \cdot \left(M \cdot 0.5\right)\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
associate-*r/69.5%
add-sqr-sqrt41.5%
add-sqr-sqrt69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Applied egg-rr39.3%
expm1-def55.4%
expm1-log1p80.1%
*-commutative80.1%
Simplified81.0%
fma-udef81.0%
associate-*r/80.2%
*-commutative80.2%
Applied egg-rr80.2%
associate-*l/81.2%
*-commutative81.2%
*-un-lft-identity81.2%
*-commutative81.2%
times-frac81.2%
metadata-eval81.2%
Applied egg-rr81.2%
Final simplification74.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(- 1.0 (* 0.5 (/ (* h (pow (/ D (/ (* d 2.0) M)) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* 0.5 (/ (* M D) d)) 2.0))) l))
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * pow((D / ((d * 2.0) / M)), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (1.0 + ((h * (-0.5 * pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (sqrt(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 (l <= (-5d-310)) then
tmp = (1.0d0 - (0.5d0 * ((h * ((d_1 / ((d * 2.0d0) / m)) ** 2.0d0)) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (1.0d0 + ((h * ((-0.5d0) * ((0.5d0 * ((m * d_1) / d)) ** 2.0d0))) / l)) * (d / (sqrt(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 (l <= -5e-310) {
tmp = (1.0 - (0.5 * ((h * Math.pow((D / ((d * 2.0) / M)), 2.0)) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (1.0 + ((h * (-0.5 * Math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (Math.sqrt(h) * Math.sqrt(l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -5e-310: tmp = (1.0 - (0.5 * ((h * math.pow((D / ((d * 2.0) / M)), 2.0)) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (1.0 + ((h * (-0.5 * math.pow((0.5 * ((M * D) / d)), 2.0))) / l)) * (d / (math.sqrt(h) * math.sqrt(l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(D / Float64(Float64(d * 2.0) / M)) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(0.5 * Float64(Float64(M * D) / d)) ^ 2.0))) / l)) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -5e-310) tmp = (1.0 - (0.5 * ((h * ((D / ((d * 2.0) / M)) ^ 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h))); else tmp = (1.0 + ((h * (-0.5 * ((0.5 * ((M * D) / d)) ^ 2.0))) / l)) * (d / (sqrt(h) * sqrt(l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(D / N[(N[(d * 2.0), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(0.5 * N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D}{\frac{d \cdot 2}{M}}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(0.5 \cdot \frac{M \cdot D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.3%
clear-num67.3%
frac-times67.6%
*-un-lft-identity67.6%
associate-*l/67.6%
*-un-lft-identity67.6%
times-frac67.6%
metadata-eval67.6%
Applied egg-rr67.6%
associate-*r/69.8%
associate-*r/69.8%
Applied egg-rr69.8%
if -4.999999999999985e-310 < l Initial program 62.6%
Simplified61.7%
Applied egg-rr39.3%
expm1-def55.4%
expm1-log1p80.1%
*-commutative80.1%
Simplified81.0%
fma-udef81.0%
associate-*r/80.2%
*-commutative80.2%
Applied egg-rr80.2%
associate-*l/81.2%
*-commutative81.2%
*-un-lft-identity81.2%
*-commutative81.2%
times-frac81.2%
metadata-eval81.2%
Applied egg-rr81.2%
Final simplification74.9%
(FPCore (d h l M D)
:precision binary64
(if (<= l -1.7e-256)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l 4.1e-304)
(/ d (cbrt (pow (* l h) 1.5)))
(if (<= l 1.5e+145)
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))
(/ d (sqrt (* l h))))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.7e-256) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= 4.1e-304) {
tmp = d / cbrt(pow((l * h), 1.5));
} else if (l <= 1.5e+145) {
tmp = (1.0 + ((h / l) * (-0.5 * pow(((M * D) / (d * 2.0)), 2.0)))) * (d / sqrt((l * h)));
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1.7e-256) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= 4.1e-304) {
tmp = d / Math.cbrt(Math.pow((l * h), 1.5));
} else if (l <= 1.5e+145) {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / Math.sqrt((l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -1.7e-256) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= 4.1e-304) tmp = Float64(d / cbrt((Float64(l * h) ^ 1.5))); elseif (l <= 1.5e+145) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -1.7e-256], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 4.1e-304], N[(d / N[Power[N[Power[N[(l * h), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+145], N[(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] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{-256}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-304}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(\ell \cdot h\right)}^{1.5}}}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+145}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.7e-256Initial program 66.0%
Simplified66.6%
associate-*r/68.2%
add-sqr-sqrt40.7%
add-sqr-sqrt68.2%
div-inv68.2%
metadata-eval68.2%
Applied egg-rr68.2%
clear-num68.0%
sqrt-div68.0%
metadata-eval68.0%
Applied egg-rr68.0%
Taylor expanded in d around -inf 49.1%
mul-1-neg49.1%
distribute-rgt-neg-in49.1%
*-commutative49.1%
associate-/r*49.2%
Simplified49.2%
if -1.7e-256 < l < 4.10000000000000002e-304Initial program 69.1%
Simplified69.1%
associate-*r/77.1%
add-sqr-sqrt46.3%
add-sqr-sqrt77.1%
div-inv77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in d around inf 25.5%
unpow1/225.5%
rem-exp-log25.1%
exp-neg25.1%
exp-prod25.1%
distribute-lft-neg-out25.1%
distribute-rgt-neg-in25.1%
metadata-eval25.1%
exp-to-pow25.5%
rem-exp-log7.2%
rem-exp-log7.3%
exp-sum6.9%
log-pow6.9%
metadata-eval6.9%
associate-*r*6.9%
neg-mul-16.9%
distribute-rgt-neg-out6.9%
log-pow6.9%
unpow1/26.9%
sub-neg6.9%
log-div6.9%
Simplified25.5%
add-cbrt-cube40.5%
add-sqr-sqrt40.5%
pow140.5%
pow1/240.5%
pow-prod-up40.5%
*-commutative40.5%
metadata-eval40.5%
Applied egg-rr40.5%
if 4.10000000000000002e-304 < l < 1.5000000000000001e145Initial program 70.6%
Simplified69.3%
Applied egg-rr37.0%
expm1-def51.4%
expm1-log1p87.3%
*-commutative87.3%
Simplified88.5%
fma-udef88.5%
associate-*r/88.5%
*-commutative88.5%
Applied egg-rr88.5%
expm1-log1p-u86.9%
expm1-udef62.0%
sqrt-unprod59.8%
Applied egg-rr59.8%
expm1-def81.8%
expm1-log1p83.3%
Simplified83.3%
if 1.5000000000000001e145 < l Initial program 47.6%
Simplified47.6%
Taylor expanded in d around inf 53.8%
sqrt-div53.8%
metadata-eval53.8%
sqrt-unprod68.1%
div-inv68.1%
associate-/r*63.1%
Applied egg-rr63.1%
associate-/l/68.1%
Simplified68.1%
Final simplification61.7%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.4e+29)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l 5e-310)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* M (/ D (* d 2.0))) 2.0)))))
(if (<= l 1.05e+147)
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))
(/ d (sqrt (* l h))))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.4e+29) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= 5e-310) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * pow((M * (D / (d * 2.0))), 2.0))));
} else if (l <= 1.05e+147) {
tmp = (1.0 + ((h / l) * (-0.5 * pow(((M * D) / (d * 2.0)), 2.0)))) * (d / sqrt((l * h)));
} else {
tmp = d / (sqrt(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 (l <= (-2.4d+29)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (l <= 5d-310) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0))))
else if (l <= 1.05d+147) then
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)))) * (d / sqrt((l * h)))
else
tmp = d / (sqrt(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 (l <= -2.4e+29) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= 5e-310) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * Math.pow((M * (D / (d * 2.0))), 2.0))));
} else if (l <= 1.05e+147) {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / Math.sqrt((l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2.4e+29: tmp = d * -math.sqrt(((1.0 / l) / h)) elif l <= 5e-310: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * math.pow((M * (D / (d * 2.0))), 2.0)))) elif l <= 1.05e+147: tmp = (1.0 + ((h / l) * (-0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / math.sqrt((l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.4e+29) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= 5e-310) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0))))); elseif (l <= 1.05e+147) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2.4e+29) tmp = d * -sqrt(((1.0 / l) / h)); elseif (l <= 5e-310) tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * ((h / l) * ((M * (D / (d * 2.0))) ^ 2.0)))); elseif (l <= 1.05e+147) tmp = (1.0 + ((h / l) * (-0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))) * (d / sqrt((l * h))); else tmp = d / (sqrt(h) * sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.4e+29], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 5e-310], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e+147], N[(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] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+29}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+147}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.4000000000000001e29Initial program 59.2%
Simplified60.4%
associate-*r/58.9%
add-sqr-sqrt35.3%
add-sqr-sqrt58.9%
div-inv58.9%
metadata-eval58.9%
Applied egg-rr58.9%
clear-num58.5%
sqrt-div58.4%
metadata-eval58.4%
Applied egg-rr58.4%
Taylor expanded in d around -inf 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
*-commutative59.3%
associate-/r*59.4%
Simplified59.4%
if -2.4000000000000001e29 < l < 4.999999999999985e-310Initial program 74.0%
Simplified74.0%
clear-num74.0%
frac-times73.9%
*-un-lft-identity73.9%
associate-*l/74.0%
*-un-lft-identity74.0%
times-frac74.0%
metadata-eval74.0%
Applied egg-rr74.0%
expm1-log1p-u28.5%
expm1-udef23.1%
Applied egg-rr18.4%
expm1-def23.8%
expm1-log1p66.2%
rem-log-exp62.2%
exp-sum62.2%
log-prod62.2%
rem-log-exp62.2%
rem-log-exp66.2%
associate-/r/66.2%
*-commutative66.2%
Simplified66.2%
if 4.999999999999985e-310 < l < 1.05000000000000003e147Initial program 69.6%
Simplified68.4%
Applied egg-rr36.5%
expm1-def50.7%
expm1-log1p86.1%
*-commutative86.1%
Simplified87.4%
fma-udef87.4%
associate-*r/87.4%
*-commutative87.4%
Applied egg-rr87.4%
expm1-log1p-u85.8%
expm1-udef61.2%
sqrt-unprod59.0%
Applied egg-rr59.0%
expm1-def80.7%
expm1-log1p82.2%
Simplified82.2%
if 1.05000000000000003e147 < l Initial program 47.6%
Simplified47.6%
Taylor expanded in d around inf 53.8%
sqrt-div53.8%
metadata-eval53.8%
sqrt-unprod68.1%
div-inv68.1%
associate-/r*63.1%
Applied egg-rr63.1%
associate-/l/68.1%
Simplified68.1%
Final simplification69.5%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.35e+29)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -2e-308)
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* -0.5 (/ (pow (* M (* (/ D d) 0.5)) 2.0) (/ l h)))))
(if (<= l 7.2e+145)
(*
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* M D) (* d 2.0)) 2.0))))
(/ d (sqrt (* l h))))
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.35e+29) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -2e-308) {
tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else if (l <= 7.2e+145) {
tmp = (1.0 + ((h / l) * (-0.5 * pow(((M * D) / (d * 2.0)), 2.0)))) * (d / sqrt((l * h)));
} else {
tmp = d / (sqrt(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 (l <= (-2.35d+29)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (l <= (-2d-308)) then
tmp = sqrt(((d / l) * (d / h))) * (1.0d0 + ((-0.5d0) * (((m * ((d_1 / d) * 0.5d0)) ** 2.0d0) / (l / h))))
else if (l <= 7.2d+145) then
tmp = (1.0d0 + ((h / l) * ((-0.5d0) * (((m * d_1) / (d * 2.0d0)) ** 2.0d0)))) * (d / sqrt((l * h)))
else
tmp = d / (sqrt(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 (l <= -2.35e+29) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= -2e-308) {
tmp = Math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (Math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h))));
} else if (l <= 7.2e+145) {
tmp = (1.0 + ((h / l) * (-0.5 * Math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / Math.sqrt((l * h)));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= -2.35e+29: tmp = d * -math.sqrt(((1.0 / l) / h)) elif l <= -2e-308: tmp = math.sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (math.pow((M * ((D / d) * 0.5)), 2.0) / (l / h)))) elif l <= 7.2e+145: tmp = (1.0 + ((h / l) * (-0.5 * math.pow(((M * D) / (d * 2.0)), 2.0)))) * (d / math.sqrt((l * h))) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.35e+29) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -2e-308) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(-0.5 * Float64((Float64(M * Float64(Float64(D / d) * 0.5)) ^ 2.0) / Float64(l / h))))); elseif (l <= 7.2e+145) tmp = Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(M * D) / Float64(d * 2.0)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= -2.35e+29) tmp = d * -sqrt(((1.0 / l) / h)); elseif (l <= -2e-308) tmp = sqrt(((d / l) * (d / h))) * (1.0 + (-0.5 * (((M * ((D / d) * 0.5)) ^ 2.0) / (l / h)))); elseif (l <= 7.2e+145) tmp = (1.0 + ((h / l) * (-0.5 * (((M * D) / (d * 2.0)) ^ 2.0)))) * (d / sqrt((l * h))); else tmp = d / (sqrt(h) * sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.35e+29], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -2e-308], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(N[Power[N[(M * N[(N[(D / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.2e+145], N[(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] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.35 \cdot 10^{+29}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -2 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + -0.5 \cdot \frac{{\left(M \cdot \left(\frac{D}{d} \cdot 0.5\right)\right)}^{2}}{\frac{\ell}{h}}\right)\\
\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{+145}:\\
\;\;\;\;\left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{M \cdot D}{d \cdot 2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3500000000000001e29Initial program 59.2%
Simplified60.4%
associate-*r/58.9%
add-sqr-sqrt35.3%
add-sqr-sqrt58.9%
div-inv58.9%
metadata-eval58.9%
Applied egg-rr58.9%
clear-num58.5%
sqrt-div58.4%
metadata-eval58.4%
Applied egg-rr58.4%
Taylor expanded in d around -inf 59.3%
mul-1-neg59.3%
distribute-rgt-neg-in59.3%
*-commutative59.3%
associate-/r*59.4%
Simplified59.4%
if -2.3500000000000001e29 < l < -1.9999999999999998e-308Initial program 74.0%
Simplified74.0%
associate-*r/79.7%
add-sqr-sqrt47.5%
add-sqr-sqrt79.7%
div-inv79.7%
metadata-eval79.7%
Applied egg-rr79.7%
expm1-log1p-u31.4%
expm1-udef26.0%
Applied egg-rr19.7%
expm1-def25.0%
expm1-log1p67.6%
*-commutative67.6%
Simplified67.6%
if -1.9999999999999998e-308 < l < 7.19999999999999948e145Initial program 69.6%
Simplified68.4%
Applied egg-rr36.5%
expm1-def50.7%
expm1-log1p86.1%
*-commutative86.1%
Simplified87.4%
fma-udef87.4%
associate-*r/87.4%
*-commutative87.4%
Applied egg-rr87.4%
expm1-log1p-u85.8%
expm1-udef61.2%
sqrt-unprod59.0%
Applied egg-rr59.0%
expm1-def80.7%
expm1-log1p82.2%
Simplified82.2%
if 7.19999999999999948e145 < l Initial program 47.6%
Simplified47.6%
Taylor expanded in d around inf 53.8%
sqrt-div53.8%
metadata-eval53.8%
sqrt-unprod68.1%
div-inv68.1%
associate-/r*63.1%
Applied egg-rr63.1%
associate-/l/68.1%
Simplified68.1%
Final simplification69.9%
(FPCore (d h l M D) :precision binary64 (if (<= h 3.8e-304) (* d (- (sqrt (/ (/ 1.0 l) h)))) (/ d (* (sqrt h) (sqrt l)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3.8e-304) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d / (sqrt(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 (h <= 3.8d-304) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d / (sqrt(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 (h <= 3.8e-304) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 3.8e-304: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 3.8e-304) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 3.8e-304) tmp = d * -sqrt(((1.0 / l) / h)); else tmp = d / (sqrt(h) * sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3.8e-304], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.8 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < 3.79999999999999961e-304Initial program 66.8%
Simplified67.4%
associate-*r/69.5%
add-sqr-sqrt42.1%
add-sqr-sqrt69.5%
div-inv69.5%
metadata-eval69.5%
Applied egg-rr69.5%
clear-num69.3%
sqrt-div69.3%
metadata-eval69.3%
Applied egg-rr69.3%
Taylor expanded in d around -inf 46.2%
mul-1-neg46.2%
distribute-rgt-neg-in46.2%
*-commutative46.2%
associate-/r*46.2%
Simplified46.2%
if 3.79999999999999961e-304 < h Initial program 62.4%
Simplified61.5%
Taylor expanded in d around inf 51.2%
sqrt-div51.6%
metadata-eval51.6%
sqrt-unprod59.2%
div-inv59.2%
associate-/r*57.6%
Applied egg-rr57.6%
associate-/l/59.2%
Simplified59.2%
Final simplification51.9%
(FPCore (d h l M D) :precision binary64 (if (<= d -6.2e-215) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (pow (* l h) -0.5))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -6.2e-215) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * pow((l * 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 <= (-6.2d-215)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * ((l * 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 <= -6.2e-215) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -6.2e-215: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * math.pow((l * h), -0.5) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -6.2e-215) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -6.2e-215) tmp = d * -sqrt(((1.0 / l) / h)); else tmp = d * ((l * h) ^ -0.5); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -6.2e-215], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -6.2 \cdot 10^{-215}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -6.19999999999999987e-215Initial program 70.2%
Simplified71.0%
associate-*r/73.6%
add-sqr-sqrt44.0%
add-sqr-sqrt73.6%
div-inv73.6%
metadata-eval73.6%
Applied egg-rr73.6%
clear-num73.3%
sqrt-div73.4%
metadata-eval73.4%
Applied egg-rr73.4%
Taylor expanded in d around -inf 50.1%
mul-1-neg50.1%
distribute-rgt-neg-in50.1%
*-commutative50.1%
associate-/r*50.1%
Simplified50.1%
if -6.19999999999999987e-215 < d Initial program 60.1%
Simplified59.3%
associate-*r/59.4%
add-sqr-sqrt42.0%
add-sqr-sqrt59.4%
div-inv59.4%
metadata-eval59.4%
Applied egg-rr59.4%
Taylor expanded in d around inf 48.1%
unpow1/248.1%
rem-exp-log46.0%
exp-neg46.0%
exp-prod46.4%
distribute-lft-neg-out46.4%
distribute-rgt-neg-in46.4%
metadata-eval46.4%
exp-to-pow48.5%
Simplified48.5%
Final simplification49.3%
(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 64.9%
Simplified64.8%
associate-*r/66.1%
add-sqr-sqrt42.9%
add-sqr-sqrt66.1%
div-inv66.1%
metadata-eval66.1%
Applied egg-rr66.1%
Taylor expanded in d around inf 29.6%
unpow1/229.6%
rem-exp-log28.5%
exp-neg28.5%
exp-prod28.7%
distribute-lft-neg-out28.7%
distribute-rgt-neg-in28.7%
metadata-eval28.7%
exp-to-pow29.9%
Simplified29.9%
Final simplification29.9%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = d / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D): return d / math.sqrt((l * h))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((l * h)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 64.9%
Simplified64.8%
associate-*r/66.1%
add-sqr-sqrt42.9%
add-sqr-sqrt66.1%
div-inv66.1%
metadata-eval66.1%
Applied egg-rr66.1%
Taylor expanded in d around inf 29.6%
unpow1/229.6%
rem-exp-log28.5%
exp-neg28.5%
exp-prod28.7%
distribute-lft-neg-out28.7%
distribute-rgt-neg-in28.7%
metadata-eval28.7%
exp-to-pow29.9%
rem-exp-log21.5%
rem-exp-log21.5%
exp-sum21.3%
log-pow21.3%
metadata-eval21.3%
associate-*r*21.3%
neg-mul-121.3%
distribute-rgt-neg-out21.3%
log-pow21.3%
unpow1/221.3%
sub-neg21.3%
log-div24.4%
Simplified29.8%
Final simplification29.8%
herbie shell --seed 2024041
(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)))))