
(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 16 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: M should be positive before calling this function
NOTE: 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 -1.62e+103)
(*
(* (pow (/ d h) 0.5) (/ t_0 (sqrt (- l))))
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l)))
(if (<= l -4e-310)
(*
(/ t_0 (sqrt (- h)))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(fma (pow (* (* D -0.5) (/ M d)) 2.0) (* (/ h l) -0.5) 1.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -1.62e+103) {
tmp = (pow((d / h), 0.5) * (t_0 / sqrt(-l))) * (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l));
} else if (l <= -4e-310) {
tmp = (t_0 / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * fma(pow(((D * -0.5) * (M / d)), 2.0), ((h / l) * -0.5), 1.0);
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -1.62e+103) tmp = Float64(Float64((Float64(d / h) ^ 0.5) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l))); elseif (l <= -4e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * fma((Float64(Float64(D * -0.5) * Float64(M / d)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0)); end return tmp end
NOTE: M should be positive before calling this function
NOTE: 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, -1.62e+103], N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(N[(D * -0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -1.62 \cdot 10^{+103}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{0.5} \cdot \frac{t_0}{\sqrt{-\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right)\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{t_0}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \mathsf{fma}\left({\left(\left(D \cdot -0.5\right) \cdot \frac{M}{d}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\
\end{array}
\end{array}
if l < -1.62000000000000007e103Initial program 52.4%
associate-*r/55.1%
*-commutative55.1%
frac-times56.9%
div-inv56.9%
metadata-eval56.9%
metadata-eval56.9%
Applied egg-rr56.9%
metadata-eval56.9%
unpow1/256.9%
frac-2neg56.9%
sqrt-div70.7%
Applied egg-rr70.7%
if -1.62000000000000007e103 < l < -3.999999999999988e-310Initial program 59.7%
Simplified59.7%
frac-2neg59.7%
sqrt-div78.4%
Applied egg-rr78.4%
if -3.999999999999988e-310 < l Initial program 71.4%
Simplified71.3%
expm1-log1p-u38.3%
expm1-udef24.2%
Applied egg-rr32.6%
expm1-def49.3%
expm1-log1p87.4%
associate-*r*87.4%
Simplified87.4%
Final simplification82.2%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -4e-310)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(fma (pow (* (* D -0.5) (/ M d)) 2.0) (* (/ h l) -0.5) 1.0))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4e-310) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * fma(pow(((D * -0.5) * (M / d)), 2.0), ((h / l) * -0.5), 1.0);
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4e-310) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / l)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * fma((Float64(Float64(D * -0.5) * Float64(M / d)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0)); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4e-310], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(N[(D * -0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \mathsf{fma}\left({\left(\left(D \cdot -0.5\right) \cdot \frac{M}{d}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\
\end{array}
\end{array}
if l < -3.999999999999988e-310Initial program 57.4%
Simplified58.0%
frac-2neg58.0%
sqrt-div72.4%
Applied egg-rr72.4%
if -3.999999999999988e-310 < l Initial program 71.4%
Simplified71.3%
expm1-log1p-u38.3%
expm1-udef24.2%
Applied egg-rr32.6%
expm1-def49.3%
expm1-log1p87.4%
associate-*r*87.4%
Simplified87.4%
Final simplification80.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -1.4e+244)
(* d (sqrt (/ (cbrt (pow l -2.0)) (* h (cbrt l)))))
(if (<= h 3.4e-297)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* (pow (* (* 0.5 M) (/ D d)) 2.0) -0.5)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(fma (pow (* (* D -0.5) (/ M d)) 2.0) (* (/ h l) -0.5) 1.0)))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.4e+244) {
tmp = d * sqrt((cbrt(pow(l, -2.0)) / (h * cbrt(l))));
} else if (h <= 3.4e-297) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * fma(pow(((D * -0.5) * (M / d)), 2.0), ((h / l) * -0.5), 1.0);
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.4e+244) tmp = Float64(d * sqrt(Float64(cbrt((l ^ -2.0)) / Float64(h * cbrt(l))))); elseif (h <= 3.4e-297) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0) * -0.5)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * fma((Float64(Float64(D * -0.5) * Float64(M / d)) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0)); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.4e+244], N[(d * N[Sqrt[N[(N[Power[N[Power[l, -2.0], $MachinePrecision], 1/3], $MachinePrecision] / N[(h * N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.4e-297], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(N[(D * -0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.4 \cdot 10^{+244}:\\
\;\;\;\;d \cdot \sqrt{\frac{\sqrt[3]{{\ell}^{-2}}}{h \cdot \sqrt[3]{\ell}}}\\
\mathbf{elif}\;h \leq 3.4 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \mathsf{fma}\left({\left(\left(D \cdot -0.5\right) \cdot \frac{M}{d}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)\\
\end{array}
\end{array}
if h < -1.39999999999999995e244Initial program 20.0%
Simplified20.0%
Taylor expanded in d around inf 9.1%
*-commutative9.1%
associate-/r*9.1%
Simplified9.1%
div-inv9.1%
add-cube-cbrt9.1%
associate-*l*9.1%
cbrt-unprod61.2%
inv-pow61.2%
inv-pow61.2%
pow-prod-up61.2%
metadata-eval61.2%
cbrt-div61.2%
metadata-eval61.2%
Applied egg-rr61.2%
associate-*l/61.2%
*-lft-identity61.2%
associate-/r*61.2%
associate-*r/61.2%
*-rgt-identity61.2%
Simplified61.2%
if -1.39999999999999995e244 < h < 3.39999999999999983e-297Initial program 63.2%
Simplified63.9%
associate-*l/65.8%
add-sqr-sqrt38.9%
add-sqr-sqrt65.8%
div-inv65.8%
metadata-eval65.8%
Applied egg-rr65.8%
if 3.39999999999999983e-297 < h Initial program 71.2%
Simplified71.1%
expm1-log1p-u37.9%
expm1-udef24.4%
Applied egg-rr32.8%
expm1-def48.9%
expm1-log1p87.3%
associate-*r*87.3%
Simplified87.3%
Final simplification77.1%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= h -1.85e+245)
(* d (sqrt (/ (cbrt (pow l -2.0)) (* h (cbrt l)))))
(if (<= h 3.4e-297)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* (pow (* (* 0.5 M) (/ D d)) 2.0) -0.5)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.85e+245) {
tmp = d * sqrt((cbrt(pow(l, -2.0)) / (h * cbrt(l))));
} else if (h <= 3.4e-297) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (h <= -1.85e+245) {
tmp = d * Math.sqrt((Math.cbrt(Math.pow(l, -2.0)) / (h * Math.cbrt(l))));
} else if (h <= 3.4e-297) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (Math.pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (h <= -1.85e+245) tmp = Float64(d * sqrt(Float64(cbrt((l ^ -2.0)) / Float64(h * cbrt(l))))); elseif (h <= 3.4e-297) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0) * -0.5)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[h, -1.85e+245], N[(d * N[Sqrt[N[(N[Power[N[Power[l, -2.0], $MachinePrecision], 1/3], $MachinePrecision] / N[(h * N[Power[l, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 3.4e-297], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.85 \cdot 10^{+245}:\\
\;\;\;\;d \cdot \sqrt{\frac{\sqrt[3]{{\ell}^{-2}}}{h \cdot \sqrt[3]{\ell}}}\\
\mathbf{elif}\;h \leq 3.4 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)}{\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(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if h < -1.85e245Initial program 20.0%
Simplified20.0%
Taylor expanded in d around inf 9.1%
*-commutative9.1%
associate-/r*9.1%
Simplified9.1%
div-inv9.1%
add-cube-cbrt9.1%
associate-*l*9.1%
cbrt-unprod61.2%
inv-pow61.2%
inv-pow61.2%
pow-prod-up61.2%
metadata-eval61.2%
cbrt-div61.2%
metadata-eval61.2%
Applied egg-rr61.2%
associate-*l/61.2%
*-lft-identity61.2%
associate-/r*61.2%
associate-*r/61.2%
*-rgt-identity61.2%
Simplified61.2%
if -1.85e245 < h < 3.39999999999999983e-297Initial program 63.2%
Simplified63.9%
associate-*l/65.8%
add-sqr-sqrt38.9%
add-sqr-sqrt65.8%
div-inv65.8%
metadata-eval65.8%
Applied egg-rr65.8%
if 3.39999999999999983e-297 < h Initial program 71.2%
expm1-log1p-u38.0%
expm1-udef24.5%
Applied egg-rr32.9%
expm1-def50.4%
expm1-log1p88.8%
sub-neg88.8%
*-commutative88.8%
distribute-rgt-neg-in88.8%
metadata-eval88.8%
associate-*l*88.8%
associate-*l*88.8%
Simplified88.8%
Final simplification77.9%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.1e+235)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d -1.42e-139)
(*
(sqrt (/ (pow d 2.0) (* l h)))
(+ 1.0 (* (/ (pow (* D (/ M (/ d 0.5))) 2.0) l) (* h -0.5))))
(if (<= d -5e-310)
(* d (sqrt (log (exp (/ 1.0 (* l h))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.1e+235) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= -1.42e-139) {
tmp = sqrt((pow(d, 2.0) / (l * h))) * (1.0 + ((pow((D * (M / (d / 0.5))), 2.0) / l) * (h * -0.5)));
} else if (d <= -5e-310) {
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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.1d+235)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= (-1.42d-139)) then
tmp = sqrt(((d ** 2.0d0) / (l * h))) * (1.0d0 + ((((d_1 * (m / (d / 0.5d0))) ** 2.0d0) / l) * (h * (-0.5d0))))
else if (d <= (-5d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (l * h)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.1e+235) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= -1.42e-139) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h))) * (1.0 + ((Math.pow((D * (M / (d / 0.5))), 2.0) / l) * (h * -0.5)));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (l * h)))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -1.1e+235: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= -1.42e-139: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) * (1.0 + ((math.pow((D * (M / (d / 0.5))), 2.0) / l) * (h * -0.5))) elif d <= -5e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (l * h))))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.1e+235) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= -1.42e-139) tmp = Float64(sqrt(Float64((d ^ 2.0) / Float64(l * h))) * Float64(1.0 + Float64(Float64((Float64(D * Float64(M / Float64(d / 0.5))) ^ 2.0) / l) * Float64(h * -0.5)))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(l * h)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -1.1e+235)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= -1.42e-139)
tmp = sqrt(((d ^ 2.0) / (l * h))) * (1.0 + ((((D * (M / (d / 0.5))) ^ 2.0) / l) * (h * -0.5)));
elseif (d <= -5e-310)
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.1e+235], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.42e-139], N[(N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D * N[(M / N[(d / 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.1 \cdot 10^{+235}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq -1.42 \cdot 10^{-139}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}} \cdot \left(1 + \frac{{\left(D \cdot \frac{M}{\frac{d}{0.5}}\right)}^{2}}{\ell} \cdot \left(h \cdot -0.5\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{\ell \cdot h}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if d < -1.1e235Initial program 84.7%
Simplified92.2%
Taylor expanded in M around 0 75.5%
if -1.1e235 < d < -1.41999999999999997e-139Initial program 59.1%
associate-*r/64.0%
*-commutative64.0%
frac-times63.9%
div-inv63.9%
metadata-eval63.9%
metadata-eval63.9%
Applied egg-rr63.9%
sub-neg63.9%
distribute-rgt-in54.9%
*-un-lft-identity54.9%
pow-prod-down47.1%
metadata-eval47.1%
unpow1/247.1%
frac-times44.7%
pow244.7%
Applied egg-rr51.2%
Simplified65.3%
if -1.41999999999999997e-139 < d < -4.999999999999985e-310Initial program 46.8%
Simplified46.8%
Taylor expanded in d around inf 16.4%
*-commutative16.4%
associate-/r*16.4%
Simplified16.4%
add-log-exp29.9%
associate-/l/29.9%
Applied egg-rr29.9%
if -4.999999999999985e-310 < d Initial program 71.4%
expm1-log1p-u38.4%
expm1-udef24.3%
Applied egg-rr32.7%
expm1-def50.8%
expm1-log1p88.9%
sub-neg88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
metadata-eval88.9%
associate-*l*88.9%
associate-*l*88.9%
Simplified88.9%
Final simplification72.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 4.5e-201)
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (* 0.5 M) (/ D d)) 2.0))) l))
(* (pow (/ d h) 0.5) (sqrt (/ d l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4.5e-201) {
tmp = (1.0 - ((h * (0.5 * pow(((0.5 * M) * (D / d)), 2.0))) / l)) * (pow((d / h), 0.5) * sqrt((d / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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.5d-201) then
tmp = (1.0d0 - ((h * (0.5d0 * (((0.5d0 * m) * (d_1 / d)) ** 2.0d0))) / l)) * (((d / h) ** 0.5d0) * sqrt((d / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4.5e-201) {
tmp = (1.0 - ((h * (0.5 * Math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) * (Math.pow((d / h), 0.5) * Math.sqrt((d / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 4.5e-201: tmp = (1.0 - ((h * (0.5 * math.pow(((0.5 * M) * (D / d)), 2.0))) / l)) * (math.pow((d / h), 0.5) * math.sqrt((d / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 4.5e-201) tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0))) / l)) * Float64((Float64(d / h) ^ 0.5) * sqrt(Float64(d / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 4.5e-201)
tmp = (1.0 - ((h * (0.5 * (((0.5 * M) * (D / d)) ^ 2.0))) / l)) * (((d / h) ^ 0.5) * sqrt((d / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 4.5e-201], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Sqrt[N[(d / 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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.5 \cdot 10^{-201}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2}\right)}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{0.5} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 4.5000000000000002e-201Initial program 61.4%
associate-*r/64.4%
*-commutative64.4%
frac-times65.6%
div-inv65.6%
metadata-eval65.6%
metadata-eval65.6%
Applied egg-rr65.6%
metadata-eval65.6%
metadata-eval65.6%
pow-pow53.9%
pow1/355.7%
expm1-log1p-u55.0%
expm1-udef41.2%
pow1/341.0%
pow-pow45.4%
metadata-eval45.4%
unpow1/245.4%
Applied egg-rr45.4%
expm1-def64.2%
expm1-log1p65.6%
Simplified65.6%
if 4.5000000000000002e-201 < l Initial program 69.2%
expm1-log1p-u39.4%
expm1-udef22.9%
Applied egg-rr32.7%
expm1-def53.8%
expm1-log1p89.6%
sub-neg89.6%
*-commutative89.6%
distribute-rgt-neg-in89.6%
metadata-eval89.6%
associate-*l*89.6%
associate-*l*89.6%
Simplified89.6%
Final simplification76.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -3.5e-166)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -4e-310)
(* d (sqrt (log (exp (/ 1.0 (* l h))))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.5e-166) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -4e-310) {
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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.5d-166)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= (-4d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (l * h)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -3.5e-166) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -4e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (l * h)))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -3.5e-166: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -4e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (l * h))))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -3.5e-166) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -4e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(l * h)))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -3.5e-166)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= -4e-310)
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -3.5e-166], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-166}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{\ell \cdot h}}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -3.4999999999999999e-166Initial program 56.6%
Simplified57.7%
Taylor expanded in M around 0 42.0%
if -3.4999999999999999e-166 < l < -3.999999999999988e-310Initial program 60.4%
Simplified60.4%
Taylor expanded in d around inf 22.1%
*-commutative22.1%
associate-/r*22.1%
Simplified22.1%
add-log-exp41.3%
associate-/l/41.3%
Applied egg-rr41.3%
if -3.999999999999988e-310 < l Initial program 71.4%
expm1-log1p-u38.4%
expm1-udef24.3%
Applied egg-rr32.7%
expm1-def50.8%
expm1-log1p88.9%
sub-neg88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
metadata-eval88.9%
associate-*l*88.9%
associate-*l*88.9%
Simplified88.9%
Final simplification67.2%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 3.5e-307)
(*
(*
(sqrt (/ d l))
(- 1.0 (* 0.5 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (/ h l)))))
(sqrt (/ d h)))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.5e-307) {
tmp = (sqrt((d / l)) * (1.0 - (0.5 * (pow(((D / d) * (M / 2.0)), 2.0) * (h / l))))) * sqrt((d / h));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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.5d-307) then
tmp = (sqrt((d / l)) * (1.0d0 - (0.5d0 * ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (h / l))))) * sqrt((d / h))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.5e-307) {
tmp = (Math.sqrt((d / l)) * (1.0 - (0.5 * (Math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l))))) * Math.sqrt((d / h));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.5e-307: tmp = (math.sqrt((d / l)) * (1.0 - (0.5 * (math.pow(((D / d) * (M / 2.0)), 2.0) * (h / l))))) * math.sqrt((d / h)) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.5e-307) tmp = Float64(Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(h / 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(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.5e-307)
tmp = (sqrt((d / l)) * (1.0 - (0.5 * ((((D / d) * (M / 2.0)) ^ 2.0) * (h / l))))) * sqrt((d / h));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.5e-307], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.5 \cdot 10^{-307}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 3.5000000000000002e-307Initial program 57.8%
Simplified58.3%
if 3.5000000000000002e-307 < l Initial program 71.2%
expm1-log1p-u38.1%
expm1-udef23.8%
Applied egg-rr32.3%
expm1-def50.5%
expm1-log1p88.8%
sub-neg88.8%
*-commutative88.8%
distribute-rgt-neg-in88.8%
metadata-eval88.8%
associate-*l*88.8%
associate-*l*88.8%
Simplified88.8%
Final simplification74.6%
NOTE: M should be positive before calling this function
NOTE: 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-307)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* (pow (* (/ D d) (/ M 2.0)) 2.0) -0.5)))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.1e-307) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (pow(((D / d) * (M / 2.0)), 2.0) * -0.5))));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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-307) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((((d_1 / d) * (m / 2.0d0)) ** 2.0d0) * (-0.5d0)))))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.1e-307) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (Math.pow(((D / d) * (M / 2.0)), 2.0) * -0.5))));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.1e-307: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (math.pow(((D / d) * (M / 2.0)), 2.0) * -0.5)))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.1e-307) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * -0.5))))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.1e-307)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * ((((D / d) * (M / 2.0)) ^ 2.0) * -0.5))));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.1e-307], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.1 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot -0.5\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 3.0999999999999998e-307Initial program 57.8%
Simplified58.3%
if 3.0999999999999998e-307 < l Initial program 71.2%
expm1-log1p-u38.1%
expm1-udef23.8%
Applied egg-rr32.3%
expm1-def50.5%
expm1-log1p88.8%
sub-neg88.8%
*-commutative88.8%
distribute-rgt-neg-in88.8%
metadata-eval88.8%
associate-*l*88.8%
associate-*l*88.8%
Simplified88.8%
Final simplification74.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l 2.1e-202)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* (pow (* (* 0.5 M) (/ D d)) 2.0) -0.5)) l))))
(*
(/ d (* (sqrt h) (sqrt l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M (* 0.5 (/ D d))) 2.0))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.1e-202) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l)));
} else {
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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 <= 2.1d-202) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((((0.5d0 * m) * (d_1 / d)) ** 2.0d0) * (-0.5d0))) / l)))
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((m * (0.5d0 * (d_1 / d))) ** 2.0d0)))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.1e-202) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (Math.pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l)));
} else {
tmp = (d / (Math.sqrt(h) * Math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * Math.pow((M * (0.5 * (D / d))), 2.0)));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.1e-202: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (math.pow(((0.5 * M) * (D / d)), 2.0) * -0.5)) / l))) else: tmp = (d / (math.sqrt(h) * math.sqrt(l))) * (1.0 + (((h / l) * -0.5) * math.pow((M * (0.5 * (D / d))), 2.0))) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.1e-202) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64((Float64(Float64(0.5 * M) * Float64(D / d)) ^ 2.0) * -0.5)) / l)))); else tmp = Float64(Float64(d / Float64(sqrt(h) * sqrt(l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M * Float64(0.5 * Float64(D / d))) ^ 2.0)))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 2.1e-202)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * ((((0.5 * M) * (D / d)) ^ 2.0) * -0.5)) / l)));
else
tmp = (d / (sqrt(h) * sqrt(l))) * (1.0 + (((h / l) * -0.5) * ((M * (0.5 * (D / d))) ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.1e-202], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(N[Power[N[(N[(0.5 * M), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $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[(M * N[(0.5 * N[(D / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.1 \cdot 10^{-202}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left({\left(\left(0.5 \cdot M\right) \cdot \frac{D}{d}\right)}^{2} \cdot -0.5\right)}{\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(M \cdot \left(0.5 \cdot \frac{D}{d}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < 2.09999999999999985e-202Initial program 61.4%
Simplified61.9%
associate-*l/65.6%
add-sqr-sqrt40.2%
add-sqr-sqrt65.6%
div-inv65.6%
metadata-eval65.6%
Applied egg-rr65.6%
if 2.09999999999999985e-202 < l Initial program 69.2%
expm1-log1p-u39.4%
expm1-udef22.9%
Applied egg-rr32.7%
expm1-def53.8%
expm1-log1p89.6%
sub-neg89.6%
*-commutative89.6%
distribute-rgt-neg-in89.6%
metadata-eval89.6%
associate-*l*89.6%
associate-*l*89.6%
Simplified89.6%
Final simplification76.6%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= l -4.5e-165)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -4e-310)
(* d (sqrt (log (exp (/ 1.0 (* l h))))))
(* d (/ (pow l -0.5) (sqrt h))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-165) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -4e-310) {
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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.5d-165)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= (-4d-310)) then
tmp = d * sqrt(log(exp((1.0d0 / (l * h)))))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -4.5e-165) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -4e-310) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (l * h)))));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= -4.5e-165: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -4e-310: tmp = d * math.sqrt(math.log(math.exp((1.0 / (l * h))))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -4.5e-165) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -4e-310) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(l * h)))))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= -4.5e-165)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= -4e-310)
tmp = d * sqrt(log(exp((1.0 / (l * h)))));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, -4.5e-165], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4e-310], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{-165}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -4 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{\ell \cdot h}}\right)}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.49999999999999992e-165Initial program 56.6%
Simplified57.7%
Taylor expanded in M around 0 42.0%
if -4.49999999999999992e-165 < l < -3.999999999999988e-310Initial program 60.4%
Simplified60.4%
Taylor expanded in d around inf 22.1%
*-commutative22.1%
associate-/r*22.1%
Simplified22.1%
add-log-exp41.3%
associate-/l/41.3%
Applied egg-rr41.3%
if -3.999999999999988e-310 < l Initial program 71.4%
Simplified71.3%
Taylor expanded in d around inf 39.6%
*-commutative39.6%
associate-/r*39.6%
Simplified39.6%
expm1-log1p-u38.6%
expm1-udef25.3%
sqrt-div29.6%
inv-pow29.6%
sqrt-pow129.6%
metadata-eval29.6%
Applied egg-rr29.6%
expm1-def48.4%
expm1-log1p49.8%
Simplified49.8%
Final simplification46.1%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.7e-97)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d -5e-310)
(* d (cbrt (pow (/ 1.0 (* l h)) 1.5)))
(* d (/ (pow l -0.5) (sqrt h))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.7e-97) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * cbrt(pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.7e-97) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= -5e-310) {
tmp = d * Math.cbrt(Math.pow((1.0 / (l * h)), 1.5));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.7e-97) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= -5e-310) tmp = Float64(d * cbrt((Float64(1.0 / Float64(l * h)) ^ 1.5))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.7e-97], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, -5e-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[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{-97}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(\frac{1}{\ell \cdot h}\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.69999999999999985e-97Initial program 66.7%
Simplified68.2%
Taylor expanded in d around inf 5.3%
*-commutative5.3%
associate-/r*5.3%
Simplified5.3%
add-sqr-sqrt0.2%
sqrt-unprod40.6%
*-commutative40.6%
*-commutative40.6%
swap-sqr36.1%
add-sqr-sqrt36.2%
associate-/l/36.2%
pow236.2%
Applied egg-rr36.2%
associate-*l/36.9%
*-lft-identity36.9%
Simplified36.9%
if -2.69999999999999985e-97 < d < -4.999999999999985e-310Initial program 46.5%
Simplified46.5%
Taylor expanded in d around inf 17.4%
*-commutative17.4%
associate-/r*17.4%
Simplified17.4%
add-cbrt-cube21.0%
pow1/321.0%
add-sqr-sqrt21.0%
pow121.0%
pow1/221.0%
metadata-eval21.0%
pow-prod-up21.0%
associate-/l/21.0%
metadata-eval21.0%
metadata-eval21.0%
Applied egg-rr21.0%
unpow1/321.0%
Simplified21.0%
if -4.999999999999985e-310 < d Initial program 71.4%
Simplified71.3%
Taylor expanded in d around inf 39.6%
*-commutative39.6%
associate-/r*39.6%
Simplified39.6%
expm1-log1p-u38.6%
expm1-udef25.3%
sqrt-div29.6%
inv-pow29.6%
sqrt-pow129.6%
metadata-eval29.6%
Applied egg-rr29.6%
expm1-def48.4%
expm1-log1p49.8%
Simplified49.8%
Final simplification40.5%
NOTE: M should be positive before calling this function
NOTE: M and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -2.05e-97)
(sqrt (/ (pow d 2.0) (* l h)))
(if (<= d 1.7e-154)
(* d (sqrt (/ 1.0 (* l h))))
(* d (/ (pow l -0.5) (sqrt h))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.05e-97) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else if (d <= 1.7e-154) {
tmp = d * sqrt((1.0 / (l * h)));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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 <= (-2.05d-97)) then
tmp = sqrt(((d ** 2.0d0) / (l * h)))
else if (d <= 1.7d-154) then
tmp = d * sqrt((1.0d0 / (l * h)))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.05e-97) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else if (d <= 1.7e-154) {
tmp = d * Math.sqrt((1.0 / (l * h)));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -2.05e-97: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) elif d <= 1.7e-154: tmp = d * math.sqrt((1.0 / (l * h))) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.05e-97) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); elseif (d <= 1.7e-154) tmp = Float64(d * sqrt(Float64(1.0 / Float64(l * h)))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -2.05e-97)
tmp = sqrt(((d ^ 2.0) / (l * h)));
elseif (d <= 1.7e-154)
tmp = d * sqrt((1.0 / (l * h)));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.05e-97], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[d, 1.7e-154], N[(d * N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.05 \cdot 10^{-97}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 1.7 \cdot 10^{-154}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.04999999999999996e-97Initial program 66.7%
Simplified68.2%
Taylor expanded in d around inf 5.3%
*-commutative5.3%
associate-/r*5.3%
Simplified5.3%
add-sqr-sqrt0.2%
sqrt-unprod40.6%
*-commutative40.6%
*-commutative40.6%
swap-sqr36.1%
add-sqr-sqrt36.2%
associate-/l/36.2%
pow236.2%
Applied egg-rr36.2%
associate-*l/36.9%
*-lft-identity36.9%
Simplified36.9%
if -2.04999999999999996e-97 < d < 1.6999999999999999e-154Initial program 49.8%
Simplified49.7%
Taylor expanded in d around inf 23.4%
if 1.6999999999999999e-154 < d Initial program 75.1%
Simplified75.1%
Taylor expanded in d around inf 40.7%
*-commutative40.7%
associate-/r*40.7%
Simplified40.7%
expm1-log1p-u39.6%
expm1-udef24.4%
sqrt-div29.7%
inv-pow29.7%
sqrt-pow129.7%
metadata-eval29.7%
Applied egg-rr29.7%
expm1-def51.7%
expm1-log1p53.3%
Simplified53.3%
Final simplification39.7%
NOTE: M should be positive before calling this function NOTE: 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-307) (* (sqrt (/ d l)) (sqrt (/ d h))) (* d (/ (pow l -0.5) (sqrt h)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.1e-307) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = d * (pow(l, -0.5) / sqrt(h));
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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-307) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = d * ((l ** (-0.5d0)) / sqrt(h))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 3.1e-307) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = d * (Math.pow(l, -0.5) / Math.sqrt(h));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 3.1e-307: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = d * (math.pow(l, -0.5) / math.sqrt(h)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 3.1e-307) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(d * Float64((l ^ -0.5) / sqrt(h))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 3.1e-307)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = d * ((l ^ -0.5) / sqrt(h));
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 3.1e-307], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.1 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{\ell}^{-0.5}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 3.0999999999999998e-307Initial program 57.8%
Simplified58.6%
Taylor expanded in M around 0 36.5%
if 3.0999999999999998e-307 < l Initial program 71.2%
Simplified71.1%
Taylor expanded in d around inf 39.9%
*-commutative39.9%
associate-/r*39.9%
Simplified39.9%
expm1-log1p-u38.9%
expm1-udef25.4%
sqrt-div29.1%
inv-pow29.1%
sqrt-pow129.1%
metadata-eval29.1%
Applied egg-rr29.1%
expm1-def48.0%
expm1-log1p49.4%
Simplified49.4%
Final simplification43.4%
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= d -2.05e-97) (sqrt (/ (pow d 2.0) (* l h))) (* d (pow (* l h) -0.5))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.05e-97) {
tmp = sqrt((pow(d, 2.0) / (l * h)));
} else {
tmp = d * pow((l * h), -0.5);
}
return tmp;
}
NOTE: M should be positive before calling this function
NOTE: 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 <= (-2.05d-97)) then
tmp = sqrt(((d ** 2.0d0) / (l * h)))
else
tmp = d * ((l * h) ** (-0.5d0))
end if
code = tmp
end function
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -2.05e-97) {
tmp = Math.sqrt((Math.pow(d, 2.0) / (l * h)));
} else {
tmp = d * Math.pow((l * h), -0.5);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -2.05e-97: tmp = math.sqrt((math.pow(d, 2.0) / (l * h))) else: tmp = d * math.pow((l * h), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -2.05e-97) tmp = sqrt(Float64((d ^ 2.0) / Float64(l * h))); else tmp = Float64(d * (Float64(l * h) ^ -0.5)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -2.05e-97)
tmp = sqrt(((d ^ 2.0) / (l * h)));
else
tmp = d * ((l * h) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: M should be positive before calling this function NOTE: M and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -2.05e-97], N[Sqrt[N[(N[Power[d, 2.0], $MachinePrecision] / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.05 \cdot 10^{-97}:\\
\;\;\;\;\sqrt{\frac{{d}^{2}}{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -2.04999999999999996e-97Initial program 66.7%
Simplified68.2%
Taylor expanded in d around inf 5.3%
*-commutative5.3%
associate-/r*5.3%
Simplified5.3%
add-sqr-sqrt0.2%
sqrt-unprod40.6%
*-commutative40.6%
*-commutative40.6%
swap-sqr36.1%
add-sqr-sqrt36.2%
associate-/l/36.2%
pow236.2%
Applied egg-rr36.2%
associate-*l/36.9%
*-lft-identity36.9%
Simplified36.9%
if -2.04999999999999996e-97 < d Initial program 64.4%
associate-*r/63.3%
*-commutative63.3%
frac-times63.7%
div-inv63.7%
metadata-eval63.7%
metadata-eval63.7%
Applied egg-rr63.7%
Taylor expanded in d around inf 33.4%
unpow-133.4%
sqr-pow33.4%
rem-sqrt-square33.5%
metadata-eval33.5%
sqr-pow33.4%
fabs-sqr33.4%
sqr-pow33.5%
Simplified33.5%
Final simplification34.3%
NOTE: M should be positive before calling this function NOTE: 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)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((l * h), -0.5);
}
NOTE: M should be positive before calling this function
NOTE: 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
M = Math.abs(M);
assert M < D;
public static double code(double d, double h, double l, double M, double D) {
return d * Math.pow((l * h), -0.5);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((l * h), -0.5)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(l * h) ^ -0.5)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((l * h) ^ -0.5);
end
NOTE: M should be positive before calling this function NOTE: 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}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(\ell \cdot h\right)}^{-0.5}
\end{array}
Initial program 65.0%
associate-*r/65.3%
*-commutative65.3%
frac-times66.0%
div-inv66.0%
metadata-eval66.0%
metadata-eval66.0%
Applied egg-rr66.0%
Taylor expanded in d around inf 26.4%
unpow-126.4%
sqr-pow26.4%
rem-sqrt-square26.4%
metadata-eval26.4%
sqr-pow26.4%
fabs-sqr26.4%
sqr-pow26.4%
Simplified26.4%
Final simplification26.4%
herbie shell --seed 2023305
(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)))))