
(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 22 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}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -5e-310)
(*
(/ t_0 (sqrt (- l)))
(*
(/ t_0 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5)))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l)))))))assert(d < h && h < l && l < M && M < D);
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(-l)) * ((t_0 / sqrt(-h)) * (1.0 + ((h / l) * (pow((D * ((M / 2.0) / d)), 2.0) * -0.5))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) 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(-l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 65.6%
Simplified65.3%
frac-2neg65.3%
sqrt-div70.9%
Applied egg-rr70.9%
frac-2neg70.9%
sqrt-div84.1%
Applied egg-rr84.1%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.6%
Applied egg-rr80.3%
unpow180.3%
associate-*l/82.6%
associate-/l*82.6%
+-commutative82.6%
associate-*r*82.6%
fma-define82.6%
*-commutative82.6%
associate-*r/83.3%
*-commutative83.3%
times-frac82.6%
Simplified82.6%
Final simplification83.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -5e-310)
(*
(* (/ 1.0 (/ (sqrt (- h)) (sqrt (- d)))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (/ (* h (pow (* M (/ D (* d 2.0))) 2.0)) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -5e-310) {
tmp = ((1.0 / (sqrt(-h) / sqrt(-d))) * sqrt((d / l))) * (1.0 - (0.5 * ((h * pow((M * (D / (d * 2.0))), 2.0)) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(Float64(1.0 / Float64(sqrt(Float64(-h)) / sqrt(Float64(-d)))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -5e-310], N[(N[(N[(1.0 / N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{1}{\frac{\sqrt{-h}}{\sqrt{-d}}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
Simplified63.9%
associate-*r/66.5%
frac-times68.1%
associate-/l*66.5%
*-commutative66.5%
Applied egg-rr66.5%
clear-num66.5%
sqrt-div67.7%
metadata-eval67.7%
Applied egg-rr67.7%
frac-2neg67.7%
sqrt-div77.1%
Applied egg-rr77.1%
if -4.999999999999985e-310 < h Initial program 63.9%
Simplified63.6%
Applied egg-rr80.3%
unpow180.3%
associate-*l/82.6%
associate-/l*82.6%
+-commutative82.6%
associate-*r*82.6%
fma-define82.6%
*-commutative82.6%
associate-*r/83.3%
*-commutative83.3%
times-frac82.6%
Simplified82.6%
Final simplification80.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= d -7e-56)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M (/ D (* d 2.0))) 2.0)) l)))
(* t_0 (/ 1.0 (sqrt (/ h d)))))
(if (<= d -7.8e-308)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* t_0 (* (* (/ h l) (pow (* D (/ M d)) 2.0)) -0.125)))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (d <= -7e-56) {
tmp = (1.0 - (0.5 * ((h * pow((M * (D / (d * 2.0))), 2.0)) / l))) * (t_0 * (1.0 / sqrt((h / d))));
} else if (d <= -7.8e-308) {
tmp = (sqrt(-d) / sqrt(-h)) * (t_0 * (((h / l) * pow((D * (M / d)), 2.0)) * -0.125));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -7e-56) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(t_0 * Float64(1.0 / sqrt(Float64(h / d))))); elseif (d <= -7.8e-308) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(t_0 * Float64(Float64(Float64(h / l) * (Float64(D * Float64(M / d)) ^ 2.0)) * -0.125))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -7e-56], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.8e-308], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -7 \cdot 10^{-56}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(t\_0 \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)\\
\mathbf{elif}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(\left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.125\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -6.9999999999999996e-56Initial program 80.9%
Simplified79.4%
associate-*r/83.9%
frac-times85.4%
associate-/l*83.9%
*-commutative83.9%
Applied egg-rr83.9%
clear-num83.9%
sqrt-div86.1%
metadata-eval86.1%
Applied egg-rr86.1%
if -6.9999999999999996e-56 < d < -7.7999999999999999e-308Initial program 47.3%
Simplified45.6%
associate-*r/47.4%
Applied egg-rr47.4%
Taylor expanded in M around inf 23.6%
*-commutative23.6%
associate-*r*25.6%
times-frac25.7%
*-commutative25.7%
associate-/l*25.4%
unpow225.4%
unpow225.4%
unpow225.4%
times-frac37.3%
swap-sqr37.8%
unpow237.8%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.5%
Simplified39.5%
frac-2neg54.0%
sqrt-div73.7%
Applied egg-rr57.1%
if -7.7999999999999999e-308 < d Initial program 63.4%
Simplified63.1%
Applied egg-rr79.7%
unpow179.7%
associate-*l/82.0%
associate-/l*82.0%
+-commutative82.0%
associate-*r*82.0%
fma-define82.0%
*-commutative82.0%
associate-*r/82.7%
*-commutative82.7%
times-frac82.0%
Simplified82.0%
Final simplification78.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -5e-310)
(*
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5))))
(sqrt (/ d l)))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))assert(d < h && h < l && l < M && M < D);
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((D * ((M / 2.0) / d)), 2.0) * -0.5)))) * sqrt((d / l));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5)))) * sqrt(Float64(d / l))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -5e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right)\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 65.6%
Simplified65.3%
frac-2neg70.9%
sqrt-div84.1%
Applied egg-rr77.7%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.6%
Applied egg-rr80.3%
unpow180.3%
associate-*l/82.6%
associate-/l*82.6%
+-commutative82.6%
associate-*r*82.6%
fma-define82.6%
*-commutative82.6%
associate-*r/83.3%
*-commutative83.3%
times-frac82.6%
Simplified82.6%
Final simplification80.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 2.4e-281)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* D M) (* d 2.0)) 2.0)) l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (/ M 2.0) (/ D d)) 2.0) 1.0)
(* (sqrt h) (sqrt l))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 2.4e-281) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((D * M) / (d * 2.0)), 2.0)) / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M / 2.0) * (D / d)), 2.0), 1.0) / (sqrt(h) * sqrt(l)));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 2.4e-281) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0)) / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M / 2.0) * Float64(D / d)) ^ 2.0), 1.0) / Float64(sqrt(h) * sqrt(l)))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 2.4e-281], N[(N[(N[Sqrt[N[(d / 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 * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M / 2.0), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 2.4 \cdot 10^{-281}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M}{2} \cdot \frac{D}{d}\right)}^{2}, 1\right)}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if h < 2.4e-281Initial program 64.9%
Simplified63.1%
associate-*r/66.3%
frac-times68.1%
associate-/l*66.3%
*-commutative66.3%
Applied egg-rr66.3%
associate-*r/68.1%
Applied egg-rr68.1%
if 2.4e-281 < h Initial program 64.4%
Simplified64.4%
Applied egg-rr81.4%
unpow181.4%
associate-*l/83.9%
associate-/l*83.9%
+-commutative83.9%
associate-*r*83.9%
fma-define83.9%
*-commutative83.9%
associate-*r/83.9%
*-commutative83.9%
times-frac83.9%
Simplified83.9%
Final simplification76.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -3e-6)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l -5e-310)
(*
(sqrt (/ d h))
(* t_0 (* (pow (/ (* D M) d) 2.0) (/ (* h -0.125) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M d) 2.0)) 2.0))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -3e-6) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= -5e-310) {
tmp = sqrt((d / h)) * (t_0 * (pow(((D * M) / d), 2.0) * ((h * -0.125) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= (-3d-6)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= (-5d-310)) then
tmp = sqrt((d / h)) * (t_0 * ((((d_1 * m) / d) ** 2.0d0) * ((h * (-0.125d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
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 <= -3e-6) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= -5e-310) {
tmp = Math.sqrt((d / h)) * (t_0 * (Math.pow(((D * M) / d), 2.0) * ((h * -0.125) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -3e-6: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= -5e-310: tmp = math.sqrt((d / h)) * (t_0 * (math.pow(((D * M) / d), 2.0) * ((h * -0.125) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -3e-6) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64((Float64(Float64(D * M) / d) ^ 2.0) * Float64(Float64(h * -0.125) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -3e-6)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= -5e-310)
tmp = sqrt((d / h)) * (t_0 * ((((D * M) / d) ^ 2.0) * ((h * -0.125) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3e-6], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Power[N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.125), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -3 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{h \cdot -0.125}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -3.0000000000000001e-6Initial program 65.2%
Simplified65.3%
Taylor expanded in M around 0 52.3%
frac-2neg71.9%
sqrt-div82.2%
Applied egg-rr59.2%
if -3.0000000000000001e-6 < l < -4.999999999999985e-310Initial program 66.0%
Simplified62.3%
associate-*r/66.0%
Applied egg-rr66.0%
Taylor expanded in M around inf 26.9%
*-commutative26.9%
associate-*r*31.3%
times-frac31.3%
*-commutative31.3%
associate-/l*31.3%
unpow231.3%
unpow231.3%
unpow231.3%
times-frac41.0%
swap-sqr44.8%
unpow244.8%
associate-*r/48.5%
*-commutative48.5%
associate-*r/48.5%
Simplified48.5%
pow148.5%
associate-*l*48.5%
Applied egg-rr48.5%
unpow148.5%
associate-*r/48.5%
associate-*l/48.5%
Simplified48.5%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.6%
Applied egg-rr80.3%
unpow180.3%
associate-*r*80.3%
*-commutative80.3%
associate-*r/81.0%
*-commutative81.0%
associate-*r/79.8%
associate-*r*79.8%
associate-*r*79.8%
associate-/r*79.8%
Simplified79.8%
Final simplification68.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -1.35e-5)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 8.8e-120)
(*
(* t_0 (* (* (/ h l) (pow (* D (/ M d)) 2.0)) -0.125))
(sqrt (/ d h)))
(* d (* (pow l -0.5) (pow h -0.5)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -1.35e-5) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 8.8e-120) {
tmp = (t_0 * (((h / l) * pow((D * (M / d)), 2.0)) * -0.125)) * sqrt((d / h));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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.35d-5)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 8.8d-120) then
tmp = (t_0 * (((h / l) * ((d_1 * (m / d)) ** 2.0d0)) * (-0.125d0))) * sqrt((d / h))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
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.35e-5) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 8.8e-120) {
tmp = (t_0 * (((h / l) * Math.pow((D * (M / d)), 2.0)) * -0.125)) * Math.sqrt((d / h));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -1.35e-5: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 8.8e-120: tmp = (t_0 * (((h / l) * math.pow((D * (M / d)), 2.0)) * -0.125)) * math.sqrt((d / h)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.35e-5) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 8.8e-120) tmp = Float64(Float64(t_0 * Float64(Float64(Float64(h / l) * (Float64(D * Float64(M / d)) ^ 2.0)) * -0.125)) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.35e-5)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= 8.8e-120)
tmp = (t_0 * (((h / l) * ((D * (M / d)) ^ 2.0)) * -0.125)) * sqrt((d / h));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.35e-5], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 8.8e-120], N[(N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq 8.8 \cdot 10^{-120}:\\
\;\;\;\;\left(t\_0 \cdot \left(\left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}\right) \cdot -0.125\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -1.3499999999999999e-5Initial program 65.2%
Simplified65.3%
Taylor expanded in M around 0 52.3%
frac-2neg71.9%
sqrt-div82.2%
Applied egg-rr59.2%
if -1.3499999999999999e-5 < l < 8.8000000000000005e-120Initial program 69.4%
Simplified67.3%
Taylor expanded in M around inf 29.0%
associate-*r*31.6%
times-frac31.5%
*-commutative31.5%
associate-/l*32.6%
unpow232.6%
unpow232.6%
unpow232.6%
times-frac40.6%
swap-sqr47.3%
unpow247.3%
associate-*r/49.4%
*-commutative49.4%
associate-/l*49.4%
Simplified49.4%
if 8.8000000000000005e-120 < l Initial program 59.9%
Simplified59.9%
frac-2neg59.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 55.5%
unpow-155.5%
metadata-eval55.5%
pow-sqr55.5%
rem-sqrt-square55.5%
rem-square-sqrt55.3%
fabs-sqr55.3%
rem-square-sqrt55.5%
Simplified55.5%
*-commutative55.5%
unpow-prod-down63.0%
Applied egg-rr63.0%
Final simplification57.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -5.5e-5)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 4.1e-119)
(*
(sqrt (/ d h))
(* t_0 (* -0.125 (/ (* h (pow (* D (/ M d)) 2.0)) l))))
(* d (* (pow l -0.5) (pow h -0.5)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -5.5e-5) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 4.1e-119) {
tmp = sqrt((d / h)) * (t_0 * (-0.125 * ((h * pow((D * (M / d)), 2.0)) / l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= (-5.5d-5)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 4.1d-119) then
tmp = sqrt((d / h)) * (t_0 * ((-0.125d0) * ((h * ((d_1 * (m / d)) ** 2.0d0)) / l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
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 <= -5.5e-5) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 4.1e-119) {
tmp = Math.sqrt((d / h)) * (t_0 * (-0.125 * ((h * Math.pow((D * (M / d)), 2.0)) / l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -5.5e-5: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 4.1e-119: tmp = math.sqrt((d / h)) * (t_0 * (-0.125 * ((h * math.pow((D * (M / d)), 2.0)) / l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -5.5e-5) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 4.1e-119) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64(-0.125 * Float64(Float64(h * (Float64(D * Float64(M / d)) ^ 2.0)) / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -5.5e-5)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= 4.1e-119)
tmp = sqrt((d / h)) * (t_0 * (-0.125 * ((h * ((D * (M / d)) ^ 2.0)) / l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.5e-5], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 4.1e-119], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(-0.125 * N[(N[(h * N[Power[N[(D * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq 4.1 \cdot 10^{-119}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left(-0.125 \cdot \frac{h \cdot {\left(D \cdot \frac{M}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -5.5000000000000002e-5Initial program 65.2%
Simplified65.3%
Taylor expanded in M around 0 52.3%
frac-2neg71.9%
sqrt-div82.2%
Applied egg-rr59.2%
if -5.5000000000000002e-5 < l < 4.1000000000000002e-119Initial program 69.4%
Simplified67.3%
associate-*r/69.5%
Applied egg-rr69.5%
Taylor expanded in M around inf 29.0%
*-commutative29.0%
associate-*r*31.6%
times-frac31.5%
*-commutative31.5%
associate-/l*32.6%
unpow232.6%
unpow232.6%
unpow232.6%
times-frac40.6%
swap-sqr47.3%
unpow247.3%
associate-*r/49.4%
*-commutative49.4%
associate-*r/49.4%
Simplified49.4%
associate-*r/49.5%
Applied egg-rr49.5%
if 4.1000000000000002e-119 < l Initial program 59.9%
Simplified59.9%
frac-2neg59.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 55.5%
unpow-155.5%
metadata-eval55.5%
pow-sqr55.5%
rem-sqrt-square55.5%
rem-square-sqrt55.3%
fabs-sqr55.3%
rem-square-sqrt55.5%
Simplified55.5%
*-commutative55.5%
unpow-prod-down63.0%
Applied egg-rr63.0%
Final simplification57.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l))))
(if (<= l -3.5e-6)
(* (/ (sqrt (- d)) (sqrt (- h))) t_0)
(if (<= l 1.65e-119)
(*
(sqrt (/ d h))
(* t_0 (* (pow (/ (* D M) d) 2.0) (/ (* h -0.125) l))))
(* d (* (pow l -0.5) (pow h -0.5)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double tmp;
if (l <= -3.5e-6) {
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
} else if (l <= 1.65e-119) {
tmp = sqrt((d / h)) * (t_0 * (pow(((D * M) / d), 2.0) * ((h * -0.125) / l)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= (-3.5d-6)) then
tmp = (sqrt(-d) / sqrt(-h)) * t_0
else if (l <= 1.65d-119) then
tmp = sqrt((d / h)) * (t_0 * ((((d_1 * m) / d) ** 2.0d0) * ((h * (-0.125d0)) / l)))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
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 <= -3.5e-6) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * t_0;
} else if (l <= 1.65e-119) {
tmp = Math.sqrt((d / h)) * (t_0 * (Math.pow(((D * M) / d), 2.0) * ((h * -0.125) / l)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((d / l)) tmp = 0 if l <= -3.5e-6: tmp = (math.sqrt(-d) / math.sqrt(-h)) * t_0 elif l <= 1.65e-119: tmp = math.sqrt((d / h)) * (t_0 * (math.pow(((D * M) / d), 2.0) * ((h * -0.125) / l))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -3.5e-6) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_0); elseif (l <= 1.65e-119) tmp = Float64(sqrt(Float64(d / h)) * Float64(t_0 * Float64((Float64(Float64(D * M) / d) ^ 2.0) * Float64(Float64(h * -0.125) / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((d / l));
tmp = 0.0;
if (l <= -3.5e-6)
tmp = (sqrt(-d) / sqrt(-h)) * t_0;
elseif (l <= 1.65e-119)
tmp = sqrt((d / h)) * (t_0 * ((((D * M) / d) ^ 2.0) * ((h * -0.125) / l)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.5e-6], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[l, 1.65e-119], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[(N[Power[N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.125), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_0\\
\mathbf{elif}\;\ell \leq 1.65 \cdot 10^{-119}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(t\_0 \cdot \left({\left(\frac{D \cdot M}{d}\right)}^{2} \cdot \frac{h \cdot -0.125}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.49999999999999995e-6Initial program 65.2%
Simplified65.3%
Taylor expanded in M around 0 52.3%
frac-2neg71.9%
sqrt-div82.2%
Applied egg-rr59.2%
if -3.49999999999999995e-6 < l < 1.65000000000000004e-119Initial program 69.4%
Simplified67.3%
associate-*r/69.5%
Applied egg-rr69.5%
Taylor expanded in M around inf 29.0%
*-commutative29.0%
associate-*r*31.6%
times-frac31.5%
*-commutative31.5%
associate-/l*32.6%
unpow232.6%
unpow232.6%
unpow232.6%
times-frac40.6%
swap-sqr47.3%
unpow247.3%
associate-*r/49.4%
*-commutative49.4%
associate-*r/49.4%
Simplified49.4%
pow149.4%
associate-*l*49.4%
Applied egg-rr49.4%
unpow149.4%
associate-*r/49.4%
associate-*l/49.4%
Simplified49.4%
if 1.65000000000000004e-119 < l Initial program 59.9%
Simplified59.9%
frac-2neg59.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 55.5%
unpow-155.5%
metadata-eval55.5%
pow-sqr55.5%
rem-sqrt-square55.5%
rem-square-sqrt55.3%
fabs-sqr55.3%
rem-square-sqrt55.5%
Simplified55.5%
*-commutative55.5%
unpow-prod-down63.0%
Applied egg-rr63.0%
Final simplification57.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d 1.46e-302)
(*
(sqrt (/ d l))
(*
(+ 1.0 (* (/ h l) (* (pow (* D (/ (/ M 2.0) d)) 2.0) -0.5)))
(sqrt (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M d) 2.0)) 2.0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.46e-302) {
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (pow((D * ((M / 2.0) / d)), 2.0) * -0.5))) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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.46d-302) then
tmp = sqrt((d / l)) * ((1.0d0 + ((h / l) * (((d_1 * ((m / 2.0d0) / d)) ** 2.0d0) * (-0.5d0)))) * sqrt((d / h)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 1.46e-302) {
tmp = Math.sqrt((d / l)) * ((1.0 + ((h / l) * (Math.pow((D * ((M / 2.0) / d)), 2.0) * -0.5))) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 1.46e-302: tmp = math.sqrt((d / l)) * ((1.0 + ((h / l) * (math.pow((D * ((M / 2.0) / d)), 2.0) * -0.5))) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 1.46e-302) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(D * Float64(Float64(M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 1.46e-302)
tmp = sqrt((d / l)) * ((1.0 + ((h / l) * (((D * ((M / 2.0) / d)) ^ 2.0) * -0.5))) * sqrt((d / h)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 1.46e-302], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.46 \cdot 10^{-302}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\left(1 + \frac{h}{\ell} \cdot \left({\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2} \cdot -0.5\right)\right) \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if d < 1.46e-302Initial program 65.3%
Simplified65.1%
if 1.46e-302 < d Initial program 64.1%
Simplified63.8%
Applied egg-rr80.8%
unpow180.8%
associate-*r*80.8%
*-commutative80.8%
associate-*r/81.5%
*-commutative81.5%
associate-*r/80.2%
associate-*r*80.2%
associate-*r*80.2%
associate-/r*80.2%
Simplified80.2%
Final simplification73.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (pow (* D (/ (/ M d) 2.0)) 2.0)))
(if (<= d 1.46e-302)
(* (* (sqrt (/ d l)) (sqrt (/ d h))) (- 1.0 (* 0.5 (* (/ h l) t_0))))
(* (/ d (* (sqrt h) (sqrt l))) (+ 1.0 (* (* (/ h l) -0.5) t_0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((D * ((M / d) / 2.0)), 2.0);
double tmp;
if (d <= 1.46e-302) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * t_0)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * t_0));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (d_1 * ((m / d) / 2.0d0)) ** 2.0d0
if (d <= 1.46d-302) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h / l) * t_0)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * t_0))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((D * ((M / d) / 2.0)), 2.0);
double tmp;
if (d <= 1.46e-302) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * t_0)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * t_0));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.pow((D * ((M / d) / 2.0)), 2.0) tmp = 0 if d <= 1.46e-302: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * t_0))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * t_0)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0 tmp = 0.0 if (d <= 1.46e-302) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * t_0)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * t_0))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (D * ((M / d) / 2.0)) ^ 2.0;
tmp = 0.0;
if (d <= 1.46e-302)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h / l) * t_0)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * t_0));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, 1.46e-302], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\\
\mathbf{if}\;d \leq 1.46 \cdot 10^{-302}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot t\_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0\right)\\
\end{array}
\end{array}
if d < 1.46e-302Initial program 65.3%
Simplified63.7%
associate-*r/66.2%
frac-times67.8%
associate-/l*66.2%
*-commutative66.2%
Applied egg-rr66.2%
*-commutative66.2%
associate-*l/63.7%
associate-*r/65.3%
*-commutative65.3%
associate-*r/65.1%
associate-/r*65.1%
Simplified65.1%
if 1.46e-302 < d Initial program 64.1%
Simplified63.8%
Applied egg-rr80.8%
unpow180.8%
associate-*r*80.8%
*-commutative80.8%
associate-*r/81.5%
*-commutative81.5%
associate-*r/80.2%
associate-*r*80.2%
associate-*r*80.2%
associate-/r*80.2%
Simplified80.2%
Final simplification73.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 9.6e-231)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M (/ D (* d 2.0))) 2.0)) l)))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M d) 2.0)) 2.0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.6e-231) {
tmp = (1.0 - (0.5 * ((h * pow((M * (D / (d * 2.0))), 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= 9.6d-231) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m * (d_1 / (d * 2.0d0))) ** 2.0d0)) / l))) * (sqrt((d / l)) * sqrt((d / h)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9.6e-231) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M * (D / (d * 2.0))), 2.0)) / l))) * (Math.sqrt((d / l)) * Math.sqrt((d / h)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 9.6e-231: tmp = (1.0 - (0.5 * ((h * math.pow((M * (D / (d * 2.0))), 2.0)) / l))) * (math.sqrt((d / l)) * math.sqrt((d / h))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 9.6e-231) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M * Float64(D / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 9.6e-231)
tmp = (1.0 - (0.5 * ((h * ((M * (D / (d * 2.0))) ^ 2.0)) / l))) * (sqrt((d / l)) * sqrt((d / h)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 9.6e-231], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M * N[(D / N[(d * 2.0), $MachinePrecision]), $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[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9.6 \cdot 10^{-231}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M \cdot \frac{D}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 9.59999999999999967e-231Initial program 66.5%
Simplified65.1%
associate-*r/68.1%
frac-times69.5%
associate-/l*68.1%
*-commutative68.1%
Applied egg-rr68.1%
if 9.59999999999999967e-231 < l Initial program 62.6%
Simplified62.2%
Applied egg-rr80.7%
unpow180.7%
associate-*r*80.7%
*-commutative80.7%
associate-*r/81.6%
*-commutative81.6%
associate-*r/80.1%
associate-*r*80.1%
associate-*r*80.1%
associate-/r*80.1%
Simplified80.1%
Final simplification73.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h 3e-288)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (/ (* D M) (* d 2.0)) 2.0)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D (/ (/ M d) 2.0)) 2.0))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3e-288) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((D * M) / (d * 2.0)), 2.0)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= 3d-288) then
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0d0 - (0.5d0 * ((h * (((d_1 * m) / (d * 2.0d0)) ** 2.0d0)) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_1 * ((m / d) / 2.0d0)) ** 2.0d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= 3e-288) {
tmp = (Math.sqrt((d / l)) * Math.sqrt((d / h))) * (1.0 - (0.5 * ((h * Math.pow(((D * M) / (d * 2.0)), 2.0)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D * ((M / d) / 2.0)), 2.0)));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if h <= 3e-288: tmp = (math.sqrt((d / l)) * math.sqrt((d / h))) * (1.0 - (0.5 * ((h * math.pow(((D * M) / (d * 2.0)), 2.0)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((D * ((M / d) / 2.0)), 2.0))) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= 3e-288) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D * M) / Float64(d * 2.0)) ^ 2.0)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D * Float64(Float64(M / d) / 2.0)) ^ 2.0)))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= 3e-288)
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * (((D * M) / (d * 2.0)) ^ 2.0)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((D * ((M / d) / 2.0)) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, 3e-288], N[(N[(N[Sqrt[N[(d / 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 * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D * N[(N[(M / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3 \cdot 10^{-288}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D \cdot M}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D \cdot \frac{\frac{M}{d}}{2}\right)}^{2}\right)\\
\end{array}
\end{array}
if h < 2.99999999999999999e-288Initial program 65.4%
Simplified63.5%
associate-*r/66.8%
frac-times68.7%
associate-/l*66.8%
*-commutative66.8%
Applied egg-rr66.8%
associate-*r/68.7%
Applied egg-rr68.7%
if 2.99999999999999999e-288 < h Initial program 64.0%
Simplified64.0%
Applied egg-rr81.2%
unpow181.2%
associate-*r*81.2%
*-commutative81.2%
associate-*r/81.2%
*-commutative81.2%
associate-*r/79.9%
associate-*r*79.9%
associate-*r*79.9%
associate-/r*79.9%
Simplified79.9%
Final simplification74.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.1e-68)
(* d (- (sqrt (/ (/ 1.0 l) h))))
(if (<= l -5e-310)
(* d (log (exp (pow (* l h) -0.5))))
(* d (* (pow l -0.5) (pow h -0.5))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.1e-68) {
tmp = d * -sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d * log(exp(pow((l * h), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= (-3.1d-68)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else if (l <= (-5d-310)) then
tmp = d * log(exp(((l * h) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.1e-68) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((l * h), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -3.1e-68: tmp = d * -math.sqrt(((1.0 / l) / h)) elif l <= -5e-310: tmp = d * math.log(math.exp(math.pow((l * h), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.1e-68) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); elseif (l <= -5e-310) tmp = Float64(d * log(exp((Float64(l * h) ^ -0.5)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -3.1e-68)
tmp = d * -sqrt(((1.0 / l) / h));
elseif (l <= -5e-310)
tmp = d * log(exp(((l * h) ^ -0.5)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.1e-68], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.1 \cdot 10^{-68}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.0999999999999999e-68Initial program 66.0%
Simplified66.0%
associate-*r/64.7%
frac-times64.7%
associate-/l*64.7%
*-commutative64.7%
Applied egg-rr64.7%
clear-num64.7%
sqrt-div66.4%
metadata-eval66.4%
Applied egg-rr66.4%
Taylor expanded in d around -inf 53.5%
mul-1-neg53.5%
distribute-rgt-neg-in53.5%
*-commutative53.5%
associate-/r*54.5%
Simplified54.5%
if -3.0999999999999999e-68 < l < -4.999999999999985e-310Initial program 64.9%
Simplified60.6%
Taylor expanded in d around inf 13.6%
add-log-exp41.2%
inv-pow41.2%
sqrt-pow141.2%
metadata-eval41.2%
Applied egg-rr41.2%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.9%
frac-2neg63.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 46.9%
unpow-146.9%
metadata-eval46.9%
pow-sqr46.9%
rem-sqrt-square46.9%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt46.9%
Simplified46.9%
*-commutative46.9%
unpow-prod-down55.1%
Applied egg-rr55.1%
Final simplification52.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.9e-68)
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(if (<= l -5e-310)
(* d (log (exp (pow (* l h) -0.5))))
(* d (* (pow l -0.5) (pow h -0.5))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.9e-68) {
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * log(exp(pow((l * h), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: tmp
if (l <= (-4.9d-68)) then
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h))
else if (l <= (-5d-310)) then
tmp = d * log(exp(((l * h) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.9e-68) {
tmp = (Math.sqrt(-d) / Math.sqrt(-l)) * Math.sqrt((d / h));
} else if (l <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((l * h), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -4.9e-68: tmp = (math.sqrt(-d) / math.sqrt(-l)) * math.sqrt((d / h)) elif l <= -5e-310: tmp = d * math.log(math.exp(math.pow((l * h), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.9e-68) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))); elseif (l <= -5e-310) tmp = Float64(d * log(exp((Float64(l * h) ^ -0.5)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -4.9e-68)
tmp = (sqrt(-d) / sqrt(-l)) * sqrt((d / h));
elseif (l <= -5e-310)
tmp = d * log(exp(((l * h) ^ -0.5)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.9e-68], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -4.89999999999999977e-68Initial program 66.0%
Simplified66.0%
Taylor expanded in M around 0 50.2%
frac-2neg65.7%
sqrt-div73.3%
Applied egg-rr56.1%
if -4.89999999999999977e-68 < l < -4.999999999999985e-310Initial program 64.9%
Simplified60.6%
Taylor expanded in d around inf 13.6%
add-log-exp41.2%
inv-pow41.2%
sqrt-pow141.2%
metadata-eval41.2%
Applied egg-rr41.2%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.9%
frac-2neg63.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 46.9%
unpow-146.9%
metadata-eval46.9%
pow-sqr46.9%
rem-sqrt-square46.9%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt46.9%
Simplified46.9%
*-commutative46.9%
unpow-prod-down55.1%
Applied egg-rr55.1%
Final simplification53.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.1e-68)
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(if (<= l -5e-310)
(* d (log (exp (pow (* l h) -0.5))))
(* d (* (pow l -0.5) (pow h -0.5))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.1e-68) {
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * log(exp(pow((l * h), -0.5)));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= (-3.1d-68)) then
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l))
else if (l <= (-5d-310)) then
tmp = d * log(exp(((l * h) ** (-0.5d0))))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.1e-68) {
tmp = (Math.sqrt(-d) / Math.sqrt(-h)) * Math.sqrt((d / l));
} else if (l <= -5e-310) {
tmp = d * Math.log(Math.exp(Math.pow((l * h), -0.5)));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -3.1e-68: tmp = (math.sqrt(-d) / math.sqrt(-h)) * math.sqrt((d / l)) elif l <= -5e-310: tmp = d * math.log(math.exp(math.pow((l * h), -0.5))) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.1e-68) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))); elseif (l <= -5e-310) tmp = Float64(d * log(exp((Float64(l * h) ^ -0.5)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -3.1e-68)
tmp = (sqrt(-d) / sqrt(-h)) * sqrt((d / l));
elseif (l <= -5e-310)
tmp = d * log(exp(((l * h) ^ -0.5)));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.1e-68], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d * N[Log[N[Exp[N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.1 \cdot 10^{-68}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(\ell \cdot h\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -3.0999999999999999e-68Initial program 66.0%
Simplified66.0%
Taylor expanded in M around 0 50.2%
frac-2neg73.3%
sqrt-div82.6%
Applied egg-rr56.5%
if -3.0999999999999999e-68 < l < -4.999999999999985e-310Initial program 64.9%
Simplified60.6%
Taylor expanded in d around inf 13.6%
add-log-exp41.2%
inv-pow41.2%
sqrt-pow141.2%
metadata-eval41.2%
Applied egg-rr41.2%
if -4.999999999999985e-310 < l Initial program 63.9%
Simplified63.9%
frac-2neg63.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 46.9%
unpow-146.9%
metadata-eval46.9%
pow-sqr46.9%
rem-sqrt-square46.9%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt46.9%
Simplified46.9%
*-commutative46.9%
unpow-prod-down55.1%
Applied egg-rr55.1%
Final simplification53.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -3.9e-187)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d -4e-310)
(* d (cbrt (pow (/ 1.0 (* l h)) 1.5)))
(* d (* (pow l -0.5) (pow h -0.5))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.9e-187) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -4e-310) {
tmp = d * cbrt(pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -3.9e-187) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -4e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -3.9e-187) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -4e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(l * h)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -3.9e-187], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d * N[Power[N[Power[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -3.9 \cdot 10^{-187}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -3.8999999999999999e-187Initial program 73.7%
Simplified72.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.0%
neg-mul-152.0%
Simplified52.0%
if -3.8999999999999999e-187 < d < -3.999999999999988e-310Initial program 41.5%
Simplified38.4%
Taylor expanded in d around inf 12.5%
add-cbrt-cube28.7%
pow1/328.7%
add-sqr-sqrt28.7%
pow128.7%
pow1/228.7%
pow-prod-up28.7%
associate-/r*28.7%
metadata-eval28.7%
Applied egg-rr28.7%
unpow1/328.7%
associate-/r*28.7%
Simplified28.7%
if -3.999999999999988e-310 < d Initial program 63.9%
Simplified63.9%
frac-2neg63.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 46.9%
unpow-146.9%
metadata-eval46.9%
pow-sqr46.9%
rem-sqrt-square46.9%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt46.9%
Simplified46.9%
*-commutative46.9%
unpow-prod-down55.1%
Applied egg-rr55.1%
Final simplification50.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d 3e-309) (* d (- (sqrt (/ (/ 1.0 h) l)))) (* d (* (pow l -0.5) (pow h -0.5)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 3e-309) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -0.5));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= 3d-309) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-0.5d0)))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= 3e-309) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -0.5));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= 3e-309: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -0.5)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= 3e-309) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= 3e-309)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * ((l ^ -0.5) * (h ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, 3e-309], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 3 \cdot 10^{-309}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 3.000000000000001e-309Initial program 65.6%
Simplified63.9%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt42.6%
neg-mul-142.6%
Simplified42.6%
if 3.000000000000001e-309 < d Initial program 63.9%
Simplified63.9%
frac-2neg63.9%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 46.9%
unpow-146.9%
metadata-eval46.9%
pow-sqr46.9%
rem-sqrt-square46.9%
rem-square-sqrt46.8%
fabs-sqr46.8%
rem-square-sqrt46.9%
Simplified46.9%
*-commutative46.9%
unpow-prod-down55.1%
Applied egg-rr55.1%
Final simplification49.3%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -1.22e-294) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (pow (* l h) -0.5))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.22e-294) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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.22d-294)) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.22e-294) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -1.22e-294: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * math.pow((l * h), -0.5) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.22e-294) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -1.22e-294)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.22e-294], 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}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.22 \cdot 10^{-294}:\\
\;\;\;\;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 h < -1.21999999999999995e-294Initial program 65.2%
Simplified63.6%
associate-*r/66.2%
frac-times67.9%
associate-/l*66.2%
*-commutative66.2%
Applied egg-rr66.2%
clear-num66.2%
sqrt-div67.4%
metadata-eval67.4%
Applied egg-rr67.4%
Taylor expanded in d around -inf 43.4%
mul-1-neg43.4%
distribute-rgt-neg-in43.4%
*-commutative43.4%
associate-/r*44.1%
Simplified44.1%
if -1.21999999999999995e-294 < h Initial program 64.2%
Simplified64.2%
frac-2neg64.2%
sqrt-div2.1%
Applied egg-rr2.1%
Taylor expanded in d around inf 47.7%
unpow-147.7%
metadata-eval47.7%
pow-sqr47.7%
rem-sqrt-square47.7%
rem-square-sqrt47.6%
fabs-sqr47.6%
rem-square-sqrt47.7%
Simplified47.7%
Final simplification46.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= h -1.22e-294) (* d (- (sqrt (/ (/ 1.0 h) l)))) (* d (pow (* l h) -0.5))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.22e-294) {
tmp = d * -sqrt(((1.0 / h) / l));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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.22d-294)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.22e-294) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if h <= -1.22e-294: tmp = d * -math.sqrt(((1.0 / h) / l)) else: tmp = d * math.pow((l * h), -0.5) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.22e-294) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (h <= -1.22e-294)
tmp = d * -sqrt(((1.0 / h) / l));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.22e-294], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.22 \cdot 10^{-294}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if h < -1.21999999999999995e-294Initial program 65.2%
Simplified63.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.1%
neg-mul-144.1%
Simplified44.1%
if -1.21999999999999995e-294 < h Initial program 64.2%
Simplified64.2%
frac-2neg64.2%
sqrt-div2.1%
Applied egg-rr2.1%
Taylor expanded in d around inf 47.7%
unpow-147.7%
metadata-eval47.7%
pow-sqr47.7%
rem-sqrt-square47.7%
rem-square-sqrt47.6%
fabs-sqr47.6%
rem-square-sqrt47.7%
Simplified47.7%
Final simplification46.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (let* ((t_0 (pow (* l h) -0.5))) (if (<= h -1.22e-294) (* d (- t_0)) (* d t_0))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = pow((l * h), -0.5);
double tmp;
if (h <= -1.22e-294) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
real(8) :: t_0
real(8) :: tmp
t_0 = (l * h) ** (-0.5d0)
if (h <= (-1.22d-294)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.pow((l * h), -0.5);
double tmp;
if (h <= -1.22e-294) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = math.pow((l * h), -0.5) tmp = 0 if h <= -1.22e-294: tmp = d * -t_0 else: tmp = d * t_0 return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(l * h) ^ -0.5 tmp = 0.0 if (h <= -1.22e-294) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (l * h) ^ -0.5;
tmp = 0.0;
if (h <= -1.22e-294)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[h, -1.22e-294], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;h \leq -1.22 \cdot 10^{-294}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if h < -1.21999999999999995e-294Initial program 65.2%
Simplified63.6%
Taylor expanded in d around inf 5.8%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt43.4%
neg-mul-143.4%
unpow-143.4%
metadata-eval43.4%
pow-sqr43.4%
rem-sqrt-square43.4%
rem-square-sqrt43.3%
fabs-sqr43.3%
rem-square-sqrt43.4%
Simplified43.4%
if -1.21999999999999995e-294 < h Initial program 64.2%
Simplified64.2%
frac-2neg64.2%
sqrt-div2.1%
Applied egg-rr2.1%
Taylor expanded in d around inf 47.7%
unpow-147.7%
metadata-eval47.7%
pow-sqr47.7%
rem-sqrt-square47.7%
rem-square-sqrt47.6%
fabs-sqr47.6%
rem-square-sqrt47.7%
Simplified47.7%
Final simplification45.8%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (* d (pow (* l h) -0.5)))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 64.7%
Simplified64.6%
frac-2neg64.6%
sqrt-div32.9%
Applied egg-rr32.9%
Taylor expanded in d around inf 28.9%
unpow-128.9%
metadata-eval28.9%
pow-sqr28.9%
rem-sqrt-square28.9%
rem-square-sqrt28.8%
fabs-sqr28.8%
rem-square-sqrt28.9%
Simplified28.9%
Final simplification28.9%
herbie shell --seed 2024077
(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)))))