
(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 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
(FPCore (d h l M D)
:precision binary64
(if (<= d -1e-309)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))
(sqrt (/ d l))))
(if (<= d 5.5e-252)
(pow
(cbrt
(/
(* d (fma -0.5 (* (/ h l) (pow (/ (* D (* M 0.5)) d) 2.0)) 1.0))
(sqrt (* h l))))
3.0)
(*
(fma (/ h l) (* -0.5 (pow (* M (/ D (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l)))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1e-309) {
tmp = (sqrt(-d) / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else if (d <= 5.5e-252) {
tmp = pow(cbrt(((d * fma(-0.5, ((h / l) * pow(((D * (M * 0.5)) / d), 2.0)), 1.0)) / sqrt((h * l)))), 3.0);
} else {
tmp = fma((h / l), (-0.5 * pow((M * (D / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (d <= -1e-309) 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 (d <= 5.5e-252) tmp = cbrt(Float64(Float64(d * fma(-0.5, Float64(Float64(h / l) * (Float64(Float64(D * Float64(M * 0.5)) / d) ^ 2.0)), 1.0)) / sqrt(Float64(h * l)))) ^ 3.0; else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1e-309], 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[d, 5.5e-252], N[Power[N[Power[N[(N[(d * N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D * N[(M * 0.5), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $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 \cdot 10^{-309}:\\
\;\;\;\;\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}\;d \leq 5.5 \cdot 10^{-252}:\\
\;\;\;\;{\left(\sqrt[3]{\frac{d \cdot \mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(\frac{D \cdot \left(M \cdot 0.5\right)}{d}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.000000000000002e-309Initial program 70.7%
Simplified69.8%
frac-2neg69.8%
sqrt-div81.6%
Applied egg-rr81.6%
if -1.000000000000002e-309 < d < 5.5e-252Initial program 17.3%
Simplified15.9%
add-cube-cbrt15.9%
pow315.9%
Applied egg-rr16.6%
associate-*l/40.0%
Applied egg-rr47.4%
if 5.5e-252 < d Initial program 72.1%
Simplified72.2%
expm1-log1p-u41.5%
expm1-udef24.5%
Applied egg-rr33.2%
expm1-def54.3%
expm1-log1p88.8%
*-commutative88.8%
Simplified88.8%
Final simplification83.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= h -2e+32)
(*
t_0
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* (/ D d) (* M 0.5)) 2.0))) l))
(sqrt (/ d l))))
(if (<= h -5e-310)
(*
t_0
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))
(/ (sqrt (- d)) (sqrt (- l)))))
(*
(fma (/ h l) (* -0.5 (pow (* M (/ D (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / h));
double tmp;
if (h <= -2e+32) {
tmp = t_0 * ((1.0 + ((h * (-0.5 * pow(((D / d) * (M * 0.5)), 2.0))) / l)) * sqrt((d / l)));
} else if (h <= -5e-310) {
tmp = t_0 * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * (sqrt(-d) / sqrt(-l)));
} else {
tmp = fma((h / l), (-0.5 * pow((M * (D / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (h <= -2e+32) tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) / l)) * sqrt(Float64(d / l)))); elseif (h <= -5e-310) tmp = Float64(t_0 * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * 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[h, -2e+32], N[(t$95$0 * N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(t$95$0 * 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[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;h \leq -2 \cdot 10^{+32}:\\
\;\;\;\;t_0 \cdot \left(\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) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0 \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 \frac{\sqrt{-d}}{\sqrt{-\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -2.00000000000000011e32Initial program 63.5%
Simplified61.7%
associate-*l/70.7%
Applied egg-rr70.7%
if -2.00000000000000011e32 < h < -4.999999999999985e-310Initial program 76.2%
Simplified76.1%
frac-2neg51.5%
sqrt-div59.0%
Applied egg-rr83.8%
if -4.999999999999985e-310 < h Initial program 66.6%
Simplified66.6%
expm1-log1p-u38.1%
expm1-udef22.8%
Applied egg-rr30.6%
expm1-def49.6%
expm1-log1p81.5%
*-commutative81.5%
Simplified81.5%
Final simplification79.8%
(FPCore (d h l M D)
:precision binary64
(if (<= l -2.85e-308)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5)))
(sqrt (/ d l))))
(*
(fma (/ h l) (* -0.5 (pow (* M (/ D (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -2.85e-308) {
tmp = (sqrt(-d) / sqrt(-h)) * ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * sqrt((d / l)));
} else {
tmp = fma((h / l), (-0.5 * pow((M * (D / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (l <= -2.85e-308) 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)))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, -2.85e-308], 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], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $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 -2.85 \cdot 10^{-308}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.85000000000000019e-308Initial program 71.3%
Simplified70.4%
frac-2neg70.4%
sqrt-div82.3%
Applied egg-rr82.3%
if -2.85000000000000019e-308 < l Initial program 66.1%
Simplified66.1%
expm1-log1p-u37.8%
expm1-udef22.6%
Applied egg-rr30.4%
expm1-def49.2%
expm1-log1p80.9%
*-commutative80.9%
Simplified80.9%
Final simplification81.6%
(FPCore (d h l M D)
:precision binary64
(if (<= h 1.65e-295)
(*
(sqrt (/ d h))
(*
(+ 1.0 (/ (* h (* -0.5 (pow (* (/ D d) (* M 0.5)) 2.0))) l))
(sqrt (/ d l))))
(*
(fma (/ h l) (* -0.5 (pow (* M (/ D (* d 2.0))) 2.0)) 1.0)
(/ d (* (sqrt h) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.65e-295) {
tmp = sqrt((d / h)) * ((1.0 + ((h * (-0.5 * pow(((D / d) * (M * 0.5)), 2.0))) / l)) * sqrt((d / l)));
} else {
tmp = fma((h / l), (-0.5 * pow((M * (D / (d * 2.0))), 2.0)), 1.0) * (d / (sqrt(h) * sqrt(l)));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.65e-295) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) / l)) * sqrt(Float64(d / l)))); else tmp = Float64(fma(Float64(h / l), Float64(-0.5 * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)), 1.0) * Float64(d / Float64(sqrt(h) * sqrt(l)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.65e-295], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(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] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.65 \cdot 10^{-295}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\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) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}, 1\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < 1.6499999999999999e-295Initial program 70.6%
Simplified69.8%
associate-*l/74.4%
Applied egg-rr74.4%
if 1.6499999999999999e-295 < h Initial program 66.6%
Simplified66.6%
expm1-log1p-u38.3%
expm1-udef22.6%
Applied egg-rr30.7%
expm1-def50.1%
expm1-log1p81.9%
*-commutative81.9%
Simplified81.9%
Final simplification78.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (* (sqrt (* h (pow l -3.0))) (* -0.125 (/ (pow (* M D) 2.0) d))))
(t_2 (* t_0 (/ (sqrt d) (sqrt h)))))
(if (<= l -5e-310)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 2.25e-165)
t_1
(if (<= l 1.06e-85)
t_2
(if (<= l 4.1e-67)
t_1
(if (<= l 2e-36)
(* (sqrt (/ d h)) (* (sqrt d) (sqrt (/ 1.0 l))))
(if (<= l 1.4e+41) t_1 t_2))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((h * pow(l, -3.0))) * (-0.125 * (pow((M * D), 2.0) / d));
double t_2 = t_0 * (sqrt(d) / sqrt(h));
double tmp;
if (l <= -5e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 2.25e-165) {
tmp = t_1;
} else if (l <= 1.06e-85) {
tmp = t_2;
} else if (l <= 4.1e-67) {
tmp = t_1;
} else if (l <= 2e-36) {
tmp = sqrt((d / h)) * (sqrt(d) * sqrt((1.0 / l)));
} else if (l <= 1.4e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((h * (l ** (-3.0d0)))) * ((-0.125d0) * (((m * d_1) ** 2.0d0) / d))
t_2 = t_0 * (sqrt(d) / sqrt(h))
if (l <= (-5d-310)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 2.25d-165) then
tmp = t_1
else if (l <= 1.06d-85) then
tmp = t_2
else if (l <= 4.1d-67) then
tmp = t_1
else if (l <= 2d-36) then
tmp = sqrt((d / h)) * (sqrt(d) * sqrt((1.0d0 / l)))
else if (l <= 1.4d+41) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((h * Math.pow(l, -3.0))) * (-0.125 * (Math.pow((M * D), 2.0) / d));
double t_2 = t_0 * (Math.sqrt(d) / Math.sqrt(h));
double tmp;
if (l <= -5e-310) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 2.25e-165) {
tmp = t_1;
} else if (l <= 1.06e-85) {
tmp = t_2;
} else if (l <= 4.1e-67) {
tmp = t_1;
} else if (l <= 2e-36) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(d) * Math.sqrt((1.0 / l)));
} else if (l <= 1.4e+41) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((h * math.pow(l, -3.0))) * (-0.125 * (math.pow((M * D), 2.0) / d)) t_2 = t_0 * (math.sqrt(d) / math.sqrt(h)) tmp = 0 if l <= -5e-310: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 2.25e-165: tmp = t_1 elif l <= 1.06e-85: tmp = t_2 elif l <= 4.1e-67: tmp = t_1 elif l <= 2e-36: tmp = math.sqrt((d / h)) * (math.sqrt(d) * math.sqrt((1.0 / l))) elif l <= 1.4e+41: tmp = t_1 else: tmp = t_2 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64(-0.125 * Float64((Float64(M * D) ^ 2.0) / d))) t_2 = Float64(t_0 * Float64(sqrt(d) / sqrt(h))) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 2.25e-165) tmp = t_1; elseif (l <= 1.06e-85) tmp = t_2; elseif (l <= 4.1e-67) tmp = t_1; elseif (l <= 2e-36) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) * sqrt(Float64(1.0 / l)))); elseif (l <= 1.4e+41) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); t_1 = sqrt((h * (l ^ -3.0))) * (-0.125 * (((M * D) ^ 2.0) / d)); t_2 = t_0 * (sqrt(d) / sqrt(h)); tmp = 0.0; if (l <= -5e-310) tmp = (sqrt(-d) / sqrt(-h)) * t_0; elseif (l <= 2.25e-165) tmp = t_1; elseif (l <= 1.06e-85) tmp = t_2; elseif (l <= 4.1e-67) tmp = t_1; elseif (l <= 2e-36) tmp = sqrt((d / h)) * (sqrt(d) * sqrt((1.0 / l))); elseif (l <= 1.4e+41) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 2.25e-165], t$95$1, If[LessEqual[l, 1.06e-85], t$95$2, If[LessEqual[l, 4.1e-67], t$95$1, If[LessEqual[l, 2e-36], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.4e+41], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{h \cdot {\ell}^{-3}} \cdot \left(-0.125 \cdot \frac{{\left(M \cdot D\right)}^{2}}{d}\right)\\
t_2 := t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;\ell \leq 2.25 \cdot 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.06 \cdot 10^{-85}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{d} \cdot \sqrt{\frac{1}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 1.4 \cdot 10^{+41}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 70.7%
Simplified70.0%
Taylor expanded in h around 0 48.8%
frac-2neg69.8%
sqrt-div81.6%
Applied egg-rr55.8%
if -4.999999999999985e-310 < l < 2.24999999999999996e-165 or 1.0599999999999999e-85 < l < 4.0999999999999997e-67 or 1.9999999999999999e-36 < l < 1.4e41Initial program 82.3%
Simplified82.3%
Taylor expanded in d around 0 52.4%
associate-*r*52.4%
*-commutative52.4%
associate-/l*48.5%
associate-/r/52.6%
Simplified52.6%
expm1-log1p-u0.1%
expm1-udef0.1%
div-inv0.1%
pow-flip0.1%
metadata-eval0.1%
*-commutative0.1%
associate-*l/0.1%
pow-prod-down1.4%
*-commutative1.4%
Applied egg-rr1.4%
expm1-def2.1%
expm1-log1p65.4%
*-commutative65.4%
*-commutative65.4%
Simplified65.4%
if 2.24999999999999996e-165 < l < 1.0599999999999999e-85 or 1.4e41 < l Initial program 56.5%
Simplified56.6%
Taylor expanded in h around 0 46.6%
sqrt-div60.9%
Applied egg-rr60.9%
if 4.0999999999999997e-67 < l < 1.9999999999999999e-36Initial program 80.0%
Simplified80.0%
Taylor expanded in h around 0 81.0%
pow1/281.0%
div-inv81.0%
unpow-prod-down100.0%
pow1/2100.0%
Applied egg-rr100.0%
unpow1/2100.0%
Simplified100.0%
Final simplification59.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -8e+197)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 1.56e+60)
(*
(* (+ 1.0 (* (/ h l) (* (pow (* (/ M 2.0) (/ D d)) 2.0) -0.5))) t_0)
(sqrt (/ d h)))
(* t_0 (/ (sqrt d) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -8e+197) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 1.56e+60) {
tmp = ((1.0 + ((h / l) * (pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * t_0) * sqrt((d / h));
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-8d+197)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 1.56d+60) then
tmp = ((1.0d0 + ((h / l) * ((((m / 2.0d0) * (d_1 / d)) ** 2.0d0) * (-0.5d0)))) * t_0) * sqrt((d / h))
else
tmp = t_0 * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -8e+197) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 1.56e+60) {
tmp = ((1.0 + ((h / l) * (Math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * t_0) * Math.sqrt((d / h));
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -8e+197: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 1.56e+60: tmp = ((1.0 + ((h / l) * (math.pow(((M / 2.0) * (D / d)), 2.0) * -0.5))) * t_0) * math.sqrt((d / h)) else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -8e+197) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 1.56e+60) tmp = Float64(Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0) * -0.5))) * t_0) * sqrt(Float64(d / h))); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (l <= -8e+197) tmp = (sqrt(-d) / sqrt(-h)) * t_0; elseif (l <= 1.56e+60) tmp = ((1.0 + ((h / l) * ((((M / 2.0) * (D / d)) ^ 2.0) * -0.5))) * t_0) * sqrt((d / h)); else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -8e+197], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 1.56e+60], 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] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -8 \cdot 10^{+197}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;\ell \leq 1.56 \cdot 10^{+60}:\\
\;\;\;\;\left(\left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot t_0\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -7.9999999999999996e197Initial program 58.2%
Simplified53.8%
Taylor expanded in h around 0 58.5%
frac-2neg57.5%
sqrt-div70.8%
Applied egg-rr71.8%
if -7.9999999999999996e197 < l < 1.56000000000000009e60Initial program 75.0%
Simplified74.5%
if 1.56000000000000009e60 < l Initial program 53.2%
Simplified53.2%
Taylor expanded in h around 0 46.9%
sqrt-div62.9%
Applied egg-rr62.9%
Final simplification71.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -1.4e+198)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 1.05e+60)
(*
(sqrt (/ d h))
(* (+ 1.0 (/ (* h (* -0.5 (pow (* (/ D d) (* M 0.5)) 2.0))) l)) t_0))
(* t_0 (/ (sqrt d) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -1.4e+198) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 1.05e+60) {
tmp = sqrt((d / h)) * ((1.0 + ((h * (-0.5 * pow(((D / d) * (M * 0.5)), 2.0))) / l)) * t_0);
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= (-1.4d+198)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 1.05d+60) then
tmp = sqrt((d / h)) * ((1.0d0 + ((h * ((-0.5d0) * (((d_1 / d) * (m * 0.5d0)) ** 2.0d0))) / l)) * t_0)
else
tmp = t_0 * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= -1.4e+198) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 1.05e+60) {
tmp = Math.sqrt((d / h)) * ((1.0 + ((h * (-0.5 * Math.pow(((D / d) * (M * 0.5)), 2.0))) / l)) * t_0);
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -1.4e+198: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 1.05e+60: tmp = math.sqrt((d / h)) * ((1.0 + ((h * (-0.5 * math.pow(((D / d) * (M * 0.5)), 2.0))) / l)) * t_0) else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.4e+198) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 1.05e+60) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(Float64(D / d) * Float64(M * 0.5)) ^ 2.0))) / l)) * t_0)); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (l <= -1.4e+198) tmp = (sqrt(-d) / sqrt(-h)) * t_0; elseif (l <= 1.05e+60) tmp = sqrt((d / h)) * ((1.0 + ((h * (-0.5 * (((D / d) * (M * 0.5)) ^ 2.0))) / l)) * t_0); else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.4e+198], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 1.05e+60], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(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] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+198}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{+60}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\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) \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.4e198Initial program 58.2%
Simplified53.8%
Taylor expanded in h around 0 58.5%
frac-2neg57.5%
sqrt-div70.8%
Applied egg-rr71.8%
if -1.4e198 < l < 1.0500000000000001e60Initial program 75.0%
Simplified74.5%
associate-*l/78.4%
Applied egg-rr78.4%
if 1.0500000000000001e60 < l Initial program 53.2%
Simplified53.2%
Taylor expanded in h around 0 46.9%
sqrt-div62.9%
Applied egg-rr62.9%
Final simplification74.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -2.3e+93)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 4.4e+42)
(*
(sqrt (* (/ d l) (/ d h)))
(fma -0.5 (* (/ h l) (pow (/ (* M 0.5) (/ d D)) 2.0)) 1.0))
(* t_0 (/ (sqrt d) (sqrt h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -2.3e+93) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 4.4e+42) {
tmp = sqrt(((d / l) * (d / h))) * fma(-0.5, ((h / l) * pow(((M * 0.5) / (d / D)), 2.0)), 1.0);
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.3e+93) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 4.4e+42) tmp = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * fma(-0.5, Float64(Float64(h / l) * (Float64(Float64(M * 0.5) / Float64(d / D)) ^ 2.0)), 1.0)); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.3e+93], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 4.4e+42], N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M * 0.5), $MachinePrecision] / N[(d / D), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{+93}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{elif}\;\ell \leq 4.4 \cdot 10^{+42}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot {\left(\frac{M \cdot 0.5}{\frac{d}{D}}\right)}^{2}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.3000000000000002e93Initial program 67.2%
Simplified65.2%
Taylor expanded in h around 0 63.0%
frac-2neg66.9%
sqrt-div77.0%
Applied egg-rr73.0%
if -2.3000000000000002e93 < l < 4.4000000000000003e42Initial program 75.5%
Simplified74.9%
add-cbrt-cube67.7%
pow1/366.4%
add-sqr-sqrt66.4%
pow166.4%
pow1/266.4%
pow-prod-up66.4%
metadata-eval66.4%
Applied egg-rr66.4%
unpow1/367.7%
Simplified67.7%
Applied egg-rr19.6%
expm1-def25.4%
expm1-log1p65.7%
unpow1/265.7%
associate-/l*65.1%
Simplified65.1%
if 4.4000000000000003e42 < l Initial program 53.8%
Simplified53.8%
Taylor expanded in h around 0 46.4%
sqrt-div62.7%
Applied egg-rr62.7%
Final simplification65.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l 9.8e+59)
(*
(sqrt (/ d h))
(* t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (/ (/ (* M D) 2.0) d) 2.0))))))
(* t_0 (/ (sqrt d) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= 9.8e+59) {
tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (l <= 9.8d+59) then
tmp = sqrt((d / h)) * (t_0 * (1.0d0 + ((h / l) * ((-0.5d0) * ((((m * d_1) / 2.0d0) / d) ** 2.0d0)))))
else
tmp = t_0 * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (l <= 9.8e+59) {
tmp = Math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * Math.pow((((M * D) / 2.0) / d), 2.0)))));
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= 9.8e+59: tmp = math.sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * math.pow((((M * D) / 2.0) / d), 2.0))))) else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= 9.8e+59) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(Float64(M * D) / 2.0) / d) ^ 2.0)))))); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (l <= 9.8e+59) tmp = sqrt((d / h)) * (t_0 * (1.0 + ((h / l) * (-0.5 * ((((M * D) / 2.0) / d) ^ 2.0))))); else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 9.8e+59], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * 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[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq 9.8 \cdot 10^{+59}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t_0 \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}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 9.80000000000000015e59Initial program 73.2%
Simplified72.7%
frac-times73.2%
associate-/r*73.2%
Applied egg-rr73.2%
if 9.80000000000000015e59 < l Initial program 53.2%
Simplified53.2%
Taylor expanded in h around 0 46.9%
sqrt-div62.9%
Applied egg-rr62.9%
Final simplification70.9%
(FPCore (d h l M D)
:precision binary64
(if (<= h 1.4e-271)
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d))))
(if (<= h 1.45e-227)
(* d (sqrt (/ 1.0 (* h l))))
(* (sqrt (/ d h)) (/ (sqrt d) (sqrt l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 1.4e-271) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else if (h <= 1.45e-227) {
tmp = d * sqrt((1.0 / (h * l)));
} else {
tmp = sqrt((d / h)) * (sqrt(d) / 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 <= 1.4d-271) then
tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
else if (h <= 1.45d-227) then
tmp = d * sqrt((1.0d0 / (h * l)))
else
tmp = sqrt((d / h)) * (sqrt(d) / 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 <= 1.4e-271) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else if (h <= 1.45e-227) {
tmp = d * Math.sqrt((1.0 / (h * l)));
} else {
tmp = Math.sqrt((d / h)) * (Math.sqrt(d) / Math.sqrt(l));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= 1.4e-271: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) elif h <= 1.45e-227: tmp = d * math.sqrt((1.0 / (h * l))) else: tmp = math.sqrt((d / h)) * (math.sqrt(d) / math.sqrt(l)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= 1.4e-271) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); elseif (h <= 1.45e-227) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(d) / sqrt(l))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= 1.4e-271) tmp = sqrt((d / l)) * (1.0 / sqrt((h / d))); elseif (h <= 1.45e-227) tmp = d * sqrt((1.0 / (h * l))); else tmp = sqrt((d / h)) * (sqrt(d) / sqrt(l)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, 1.4e-271], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.45e-227], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq 1.4 \cdot 10^{-271}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{elif}\;h \leq 1.45 \cdot 10^{-227}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if h < 1.3999999999999999e-271Initial program 70.1%
Simplified69.4%
Taylor expanded in h around 0 47.1%
clear-num46.9%
sqrt-div47.5%
metadata-eval47.5%
Applied egg-rr47.5%
if 1.3999999999999999e-271 < h < 1.45000000000000005e-227Initial program 42.8%
Simplified43.2%
Taylor expanded in d around inf 74.1%
if 1.45000000000000005e-227 < h Initial program 70.5%
Simplified70.5%
Taylor expanded in h around 0 39.5%
sqrt-div44.6%
Applied egg-rr44.6%
Final simplification47.9%
(FPCore (d h l M D) :precision binary64 (if (<= d -1e-309) (* (sqrt (/ d h)) (/ (sqrt (- d)) (sqrt (- l)))) (* (sqrt (/ d l)) (/ (sqrt d) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1e-309) {
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l));
} else {
tmp = sqrt((d / l)) * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (d <= (-1d-309)) then
tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l))
else
tmp = sqrt((d / l)) * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1e-309) {
tmp = Math.sqrt((d / h)) * (Math.sqrt(-d) / Math.sqrt(-l));
} else {
tmp = Math.sqrt((d / l)) * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if d <= -1e-309: tmp = math.sqrt((d / h)) * (math.sqrt(-d) / math.sqrt(-l)) else: tmp = math.sqrt((d / l)) * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (d <= -1e-309) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); else tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (d <= -1e-309) tmp = sqrt((d / h)) * (sqrt(-d) / sqrt(-l)); else tmp = sqrt((d / l)) * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1e-309], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.000000000000002e-309Initial program 70.7%
Simplified70.0%
Taylor expanded in h around 0 48.8%
frac-2neg48.8%
sqrt-div54.2%
Applied egg-rr54.2%
if -1.000000000000002e-309 < d Initial program 66.6%
Simplified65.9%
Taylor expanded in h around 0 37.1%
sqrt-div45.7%
Applied egg-rr45.7%
Final simplification49.9%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -1e-309)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(* t_0 (/ (sqrt d) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -1e-309) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (d <= (-1d-309)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else
tmp = t_0 * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (d <= -1e-309) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if d <= -1e-309: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1e-309) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (d <= -1e-309) tmp = (sqrt(-d) / sqrt(-h)) * t_0; else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1e-309], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.000000000000002e-309Initial program 70.7%
Simplified70.0%
Taylor expanded in h around 0 48.8%
frac-2neg69.8%
sqrt-div81.6%
Applied egg-rr55.8%
if -1.000000000000002e-309 < d Initial program 66.6%
Simplified65.9%
Taylor expanded in h around 0 37.1%
sqrt-div45.7%
Applied egg-rr45.7%
Final simplification50.7%
(FPCore (d h l M D) :precision binary64 (let* ((t_0 (sqrt (/ d l)))) (if (<= d 5e-68) (* (sqrt (/ d h)) t_0) (* t_0 (/ (sqrt d) (sqrt h))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= 5e-68) {
tmp = sqrt((d / h)) * t_0;
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / l))
if (d <= 5d-68) then
tmp = sqrt((d / h)) * t_0
else
tmp = t_0 * (sqrt(d) / sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((d / l));
double tmp;
if (d <= 5e-68) {
tmp = Math.sqrt((d / h)) * t_0;
} else {
tmp = t_0 * (Math.sqrt(d) / Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if d <= 5e-68: tmp = math.sqrt((d / h)) * t_0 else: tmp = t_0 * (math.sqrt(d) / math.sqrt(h)) return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= 5e-68) tmp = Float64(sqrt(Float64(d / h)) * t_0); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((d / l)); tmp = 0.0; if (d <= 5e-68) tmp = sqrt((d / h)) * t_0; else tmp = t_0 * (sqrt(d) / sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, 5e-68], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 4.99999999999999971e-68Initial program 65.6%
Simplified64.6%
Taylor expanded in h around 0 41.8%
if 4.99999999999999971e-68 < d Initial program 75.4%
Simplified75.5%
Taylor expanded in h around 0 45.4%
sqrt-div59.5%
Applied egg-rr59.5%
Final simplification47.3%
(FPCore (d h l M D) :precision binary64 (if (<= M 0.165) (* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d)))) (* d (sqrt (/ (/ 1.0 l) h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 0.165) {
tmp = sqrt((d / l)) * (1.0 / sqrt((h / d)));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (m <= 0.165d0) then
tmp = sqrt((d / l)) * (1.0d0 / sqrt((h / d)))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 0.165) {
tmp = Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d)));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if M <= 0.165: tmp = math.sqrt((d / l)) * (1.0 / math.sqrt((h / d))) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (M <= 0.165) tmp = Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (M <= 0.165) tmp = sqrt((d / l)) * (1.0 / sqrt((h / d))); else tmp = d * sqrt(((1.0 / l) / h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 0.165], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 0.165:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if M < 0.165000000000000008Initial program 69.0%
Simplified68.1%
Taylor expanded in h around 0 46.1%
clear-num46.0%
sqrt-div46.8%
metadata-eval46.8%
Applied egg-rr46.8%
if 0.165000000000000008 < M Initial program 67.3%
Simplified67.4%
Taylor expanded in d around inf 14.9%
*-commutative14.9%
associate-/r*14.9%
Simplified14.9%
Final simplification40.1%
(FPCore (d h l M D) :precision binary64 (if (<= M 0.066) (* (sqrt (/ d h)) (sqrt (/ d l))) (* d (sqrt (/ (/ 1.0 l) h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 0.066) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (m <= 0.066d0) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (M <= 0.066) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if M <= 0.066: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (M <= 0.066) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (M <= 0.066) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = d * sqrt(((1.0 / l) / h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[M, 0.066], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 0.066:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if M < 0.066000000000000003Initial program 69.0%
Simplified68.1%
Taylor expanded in h around 0 46.1%
if 0.066000000000000003 < M Initial program 67.3%
Simplified67.4%
Taylor expanded in d around inf 14.9%
*-commutative14.9%
associate-/r*14.9%
Simplified14.9%
Final simplification39.5%
(FPCore (d h l M D) :precision binary64 (if (<= h -3.4e-304) (sqrt (* (/ d l) (/ d h))) (* d (sqrt (/ 1.0 (* h l))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.4e-304) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = d * sqrt((1.0 / (h * l)));
}
return tmp;
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (h <= (-3.4d-304)) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = d * sqrt((1.0d0 / (h * l)))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -3.4e-304) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if h <= -3.4e-304: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = d * math.sqrt((1.0 / (h * l))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (h <= -3.4e-304) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (h <= -3.4e-304) tmp = sqrt(((d / l) * (d / h))); else tmp = d * sqrt((1.0 / (h * l))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[h, -3.4e-304], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;h \leq -3.4 \cdot 10^{-304}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if h < -3.3999999999999999e-304Initial program 71.0%
Simplified70.3%
Taylor expanded in h around 0 49.6%
*-rgt-identity49.6%
pow1/249.6%
metadata-eval49.6%
pow-pow35.6%
pow1/337.2%
expm1-log1p-u36.2%
expm1-udef25.1%
pow1/325.1%
pow-pow30.8%
metadata-eval30.8%
pow1/230.8%
*-rgt-identity30.8%
*-commutative30.8%
*-rgt-identity30.8%
pow1/230.8%
pow1/230.8%
pow-prod-down26.7%
Applied egg-rr26.7%
expm1-def41.7%
expm1-log1p42.8%
unpow1/242.8%
Simplified42.8%
if -3.3999999999999999e-304 < h Initial program 66.4%
Simplified66.4%
Taylor expanded in d around inf 37.7%
Final simplification40.2%
(FPCore (d h l M D) :precision binary64 (sqrt (* (/ d l) (/ d h))))
double code(double d, double h, double l, double M, double D) {
return sqrt(((d / l) * (d / 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 = sqrt(((d / l) * (d / h)))
end function
public static double code(double d, double h, double l, double M, double D) {
return Math.sqrt(((d / l) * (d / h)));
}
def code(d, h, l, M, D): return math.sqrt(((d / l) * (d / h)))
function code(d, h, l, M, D) return sqrt(Float64(Float64(d / l) * Float64(d / h))) end
function tmp = code(d, h, l, M, D) tmp = sqrt(((d / l) * (d / h))); end
code[d_, h_, l_, M_, D_] := N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}
\end{array}
Initial program 68.7%
Simplified68.0%
Taylor expanded in h around 0 42.9%
*-rgt-identity42.9%
pow1/242.9%
metadata-eval42.9%
pow-pow31.4%
pow1/332.8%
expm1-log1p-u31.9%
expm1-udef22.7%
pow1/322.7%
pow-pow26.8%
metadata-eval26.8%
pow1/226.8%
*-rgt-identity26.8%
*-commutative26.8%
*-rgt-identity26.8%
pow1/226.8%
pow1/226.8%
pow-prod-down22.2%
Applied egg-rr22.2%
expm1-def33.7%
expm1-log1p34.5%
unpow1/234.5%
Simplified34.5%
Final simplification34.5%
herbie shell --seed 2024019
(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)))))