
(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: 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
(/
(fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d))
(sqrt (* h l))))
(t_1
(*
(/ (sqrt (/ d h)) (sqrt (/ l d)))
(- 1.0 (* h (/ 0.5 (/ l (pow (* M (/ (/ D d) 2.0)) 2.0))))))))
(if (<= d -7.5e+225)
t_1
(if (<= d -2.85e+41)
t_0
(if (<= d -1.8e-109)
t_1
(if (<= d 4e-309)
t_0
(*
(* (/ (sqrt d) (sqrt h)) (sqrt (/ d l)))
(- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))) l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
double t_1 = (sqrt((d / h)) / sqrt((l / d))) * (1.0 - (h * (0.5 / (l / pow((M * ((D / d) / 2.0)), 2.0)))));
double tmp;
if (d <= -7.5e+225) {
tmp = t_1;
} else if (d <= -2.85e+41) {
tmp = t_0;
} else if (d <= -1.8e-109) {
tmp = t_1;
} else if (d <= 4e-309) {
tmp = t_0;
} else {
tmp = ((sqrt(d) / sqrt(h)) * sqrt((d / l))) * (1.0 - ((h * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))) / l));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))) t_1 = Float64(Float64(sqrt(Float64(d / h)) / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.5 / Float64(l / (Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0)))))) tmp = 0.0 if (d <= -7.5e+225) tmp = t_1; elseif (d <= -2.85e+41) tmp = t_0; elseif (d <= -1.8e-109) tmp = t_1; elseif (d <= 4e-309) tmp = t_0; else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))) / l))); 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[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.5 / N[(l / N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.5e+225], t$95$1, If[LessEqual[d, -2.85e+41], t$95$0, If[LessEqual[d, -1.8e-109], t$95$1, If[LessEqual[d, 4e-309], t$95$0, N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
t_1 := \frac{\sqrt{\frac{d}{h}}}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \frac{0.5}{\frac{\ell}{{\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}}\right)\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{+225}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq -2.85 \cdot 10^{+41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.8 \cdot 10^{-109}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-309}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.49999999999999938e225 or -2.8500000000000001e41 < d < -1.8e-109Initial program 89.1%
metadata-eval89.1%
unpow1/289.1%
metadata-eval89.1%
unpow1/289.1%
*-commutative89.1%
associate-*l*89.1%
times-frac87.2%
metadata-eval87.2%
Simplified87.2%
Applied egg-rr37.5%
expm1-def45.5%
expm1-log1p69.7%
rem-log-exp64.4%
associate-*r/52.0%
associate-/l*64.4%
exp-diff64.4%
log-div64.4%
rem-log-exp64.4%
rem-log-exp69.7%
Simplified69.7%
sqrt-div88.9%
Applied egg-rr88.9%
pow188.9%
associate-/r/88.9%
Applied egg-rr88.9%
Simplified92.4%
if -7.49999999999999938e225 < d < -2.8500000000000001e41 or -1.8e-109 < d < 3.9999999999999977e-309Initial program 51.3%
metadata-eval51.3%
unpow1/251.3%
metadata-eval51.3%
unpow1/251.3%
*-commutative51.3%
associate-*l*51.3%
times-frac50.0%
metadata-eval50.0%
Simplified50.0%
Applied egg-rr19.6%
expm1-def24.2%
expm1-log1p43.9%
rem-log-exp39.2%
associate-*r/37.0%
associate-/l*38.3%
exp-diff38.3%
log-div38.3%
rem-log-exp38.3%
rem-log-exp43.1%
Simplified43.1%
Taylor expanded in d around -inf 66.2%
pow166.2%
*-commutative66.2%
associate-/r/66.2%
mul-1-neg66.2%
sqrt-div66.4%
metadata-eval66.4%
Applied egg-rr66.4%
unpow166.4%
distribute-rgt-neg-out66.4%
associate-*r/66.3%
*-rgt-identity66.3%
associate-*r/70.3%
distribute-neg-frac70.3%
Simplified70.3%
Taylor expanded in M around 0 54.8%
fma-def54.8%
unpow254.8%
associate-*r*60.3%
*-commutative60.3%
unpow260.3%
*-commutative60.3%
associate-/l*60.4%
*-commutative60.4%
associate-*r*69.1%
associate-*r*75.4%
*-commutative75.4%
neg-mul-175.4%
Simplified75.4%
if 3.9999999999999977e-309 < d Initial program 63.1%
metadata-eval63.1%
unpow1/263.1%
metadata-eval63.1%
unpow1/263.1%
*-commutative63.1%
associate-*l*63.1%
times-frac63.1%
metadata-eval63.1%
Simplified63.1%
associate-*r*63.1%
frac-times63.1%
*-commutative63.1%
metadata-eval63.1%
associate-*r/68.2%
metadata-eval68.2%
*-commutative68.2%
frac-times68.1%
*-commutative68.1%
div-inv68.1%
metadata-eval68.1%
Applied egg-rr68.1%
sqrt-div75.9%
Applied egg-rr75.9%
Final simplification79.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
(let* ((t_0
(/
(fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d))
(sqrt (* h l))))
(t_1 (sqrt (/ d h)))
(t_2
(*
(/ t_1 (sqrt (/ l d)))
(- 1.0 (* h (/ 0.5 (/ l (pow (* M (/ (/ D d) 2.0)) 2.0))))))))
(if (<= d -2.2e+225)
t_2
(if (<= d -1.25e+45)
t_0
(if (<= d -1.8e-109)
t_2
(if (<= d 5e-309)
t_0
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))) l))
(* t_1 (/ (sqrt d) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
double t_1 = sqrt((d / h));
double t_2 = (t_1 / sqrt((l / d))) * (1.0 - (h * (0.5 / (l / pow((M * ((D / d) / 2.0)), 2.0)))));
double tmp;
if (d <= -2.2e+225) {
tmp = t_2;
} else if (d <= -1.25e+45) {
tmp = t_0;
} else if (d <= -1.8e-109) {
tmp = t_2;
} else if (d <= 5e-309) {
tmp = t_0;
} else {
tmp = (1.0 - ((h * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))) / l)) * (t_1 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))) t_1 = sqrt(Float64(d / h)) t_2 = Float64(Float64(t_1 / sqrt(Float64(l / d))) * Float64(1.0 - Float64(h * Float64(0.5 / Float64(l / (Float64(M * Float64(Float64(D / d) / 2.0)) ^ 2.0)))))) tmp = 0.0 if (d <= -2.2e+225) tmp = t_2; elseif (d <= -1.25e+45) tmp = t_0; elseif (d <= -1.8e-109) tmp = t_2; elseif (d <= 5e-309) tmp = t_0; else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))) / l)) * Float64(t_1 * Float64(sqrt(d) / sqrt(l)))); 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[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$1 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.5 / N[(l / N[Power[N[(M * N[(N[(D / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.2e+225], t$95$2, If[LessEqual[d, -1.25e+45], t$95$0, If[LessEqual[d, -1.8e-109], t$95$2, If[LessEqual[d, 5e-309], t$95$0, N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \frac{t_1}{\sqrt{\frac{\ell}{d}}} \cdot \left(1 - h \cdot \frac{0.5}{\frac{\ell}{{\left(M \cdot \frac{\frac{D}{d}}{2}\right)}^{2}}}\right)\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{+225}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq -1.25 \cdot 10^{+45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq -1.8 \cdot 10^{-109}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d \leq 5 \cdot 10^{-309}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)}{\ell}\right) \cdot \left(t_1 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -2.20000000000000014e225 or -1.25e45 < d < -1.8e-109Initial program 89.1%
metadata-eval89.1%
unpow1/289.1%
metadata-eval89.1%
unpow1/289.1%
*-commutative89.1%
associate-*l*89.1%
times-frac87.2%
metadata-eval87.2%
Simplified87.2%
Applied egg-rr37.5%
expm1-def45.5%
expm1-log1p69.7%
rem-log-exp64.4%
associate-*r/52.0%
associate-/l*64.4%
exp-diff64.4%
log-div64.4%
rem-log-exp64.4%
rem-log-exp69.7%
Simplified69.7%
sqrt-div88.9%
Applied egg-rr88.9%
pow188.9%
associate-/r/88.9%
Applied egg-rr88.9%
Simplified92.4%
if -2.20000000000000014e225 < d < -1.25e45 or -1.8e-109 < d < 4.9999999999999995e-309Initial program 51.3%
metadata-eval51.3%
unpow1/251.3%
metadata-eval51.3%
unpow1/251.3%
*-commutative51.3%
associate-*l*51.3%
times-frac50.0%
metadata-eval50.0%
Simplified50.0%
Applied egg-rr19.6%
expm1-def24.2%
expm1-log1p43.9%
rem-log-exp39.2%
associate-*r/37.0%
associate-/l*38.3%
exp-diff38.3%
log-div38.3%
rem-log-exp38.3%
rem-log-exp43.1%
Simplified43.1%
Taylor expanded in d around -inf 66.2%
pow166.2%
*-commutative66.2%
associate-/r/66.2%
mul-1-neg66.2%
sqrt-div66.4%
metadata-eval66.4%
Applied egg-rr66.4%
unpow166.4%
distribute-rgt-neg-out66.4%
associate-*r/66.3%
*-rgt-identity66.3%
associate-*r/70.3%
distribute-neg-frac70.3%
Simplified70.3%
Taylor expanded in M around 0 54.8%
fma-def54.8%
unpow254.8%
associate-*r*60.3%
*-commutative60.3%
unpow260.3%
*-commutative60.3%
associate-/l*60.4%
*-commutative60.4%
associate-*r*69.1%
associate-*r*75.4%
*-commutative75.4%
neg-mul-175.4%
Simplified75.4%
if 4.9999999999999995e-309 < d Initial program 63.1%
metadata-eval63.1%
unpow1/263.1%
metadata-eval63.1%
unpow1/263.1%
*-commutative63.1%
associate-*l*63.1%
times-frac63.1%
metadata-eval63.1%
Simplified63.1%
associate-*r*63.1%
frac-times63.1%
*-commutative63.1%
metadata-eval63.1%
associate-*r/68.2%
metadata-eval68.2%
*-commutative68.2%
frac-times68.1%
*-commutative68.1%
div-inv68.1%
metadata-eval68.1%
Applied egg-rr68.1%
sqrt-div75.0%
Applied egg-rr75.0%
Final simplification78.8%
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 -1e-274)
(/ (fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d)) (sqrt (* h l)))
(if (<= l 1.8e+82)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* (pow (* (/ D d) (/ M 2.0)) 2.0) (* 0.5 (/ h l)))))
(* d (/ (sqrt (/ 1.0 l)) (sqrt h))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -1e-274) {
tmp = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
} else if (l <= 1.8e+82) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (pow(((D / d) * (M / 2.0)), 2.0) * (0.5 * (h / l))));
} else {
tmp = d * (sqrt((1.0 / l)) / sqrt(h));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -1e-274) tmp = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))); elseif (l <= 1.8e+82) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64((Float64(Float64(D / d) * Float64(M / 2.0)) ^ 2.0) * Float64(0.5 * Float64(h / l))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / 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[l, -1e-274], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.8e+82], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[Power[N[(N[(D / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $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 -1 \cdot 10^{-274}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 1.8 \cdot 10^{+82}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - {\left(\frac{D}{d} \cdot \frac{M}{2}\right)}^{2} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -9.99999999999999966e-275Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr26.5%
expm1-def32.8%
expm1-log1p53.8%
rem-log-exp49.3%
associate-*r/43.4%
associate-/l*48.7%
exp-diff48.7%
log-div48.7%
rem-log-exp48.7%
rem-log-exp53.3%
Simplified53.3%
Taylor expanded in d around -inf 72.0%
pow172.0%
*-commutative72.0%
associate-/r/72.0%
mul-1-neg72.0%
sqrt-div72.1%
metadata-eval72.1%
Applied egg-rr72.1%
unpow172.1%
distribute-rgt-neg-out72.1%
associate-*r/72.0%
*-rgt-identity72.0%
associate-*r/74.5%
distribute-neg-frac74.5%
Simplified74.5%
Taylor expanded in M around 0 58.5%
fma-def58.5%
unpow258.5%
associate-*r*65.9%
*-commutative65.9%
unpow265.9%
*-commutative65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r*72.9%
associate-*r*76.8%
*-commutative76.8%
neg-mul-176.8%
Simplified76.8%
if -9.99999999999999966e-275 < l < 1.80000000000000007e82Initial program 68.8%
metadata-eval68.8%
unpow1/268.8%
metadata-eval68.8%
unpow1/268.8%
*-commutative68.8%
associate-*l*68.8%
times-frac68.8%
metadata-eval68.8%
Simplified68.8%
if 1.80000000000000007e82 < l Initial program 53.8%
metadata-eval53.8%
unpow1/253.8%
metadata-eval53.8%
unpow1/253.8%
*-commutative53.8%
associate-*l*53.8%
times-frac53.6%
metadata-eval53.6%
Simplified53.6%
associate-*r*53.6%
frac-times53.8%
*-commutative53.8%
metadata-eval53.8%
associate-*r/58.1%
metadata-eval58.1%
*-commutative58.1%
frac-times57.9%
*-commutative57.9%
div-inv57.9%
metadata-eval57.9%
Applied egg-rr57.9%
Taylor expanded in d around inf 37.9%
*-commutative37.9%
associate-/r*39.6%
Simplified39.6%
sqrt-div62.2%
Applied egg-rr62.2%
Final simplification71.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 (<= l -5.4e-279)
(/ (fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d)) (sqrt (* h l)))
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* D (/ (/ M 2.0) 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 <= -5.4e-279) {
tmp = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
} else {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow((D * ((M / 2.0) / 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 <= -5.4e-279) tmp = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))); else tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(D * Float64(Float64(M / 2.0) / 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[l, -5.4e-279], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{-279}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -5.4000000000000003e-279Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr26.5%
expm1-def32.8%
expm1-log1p53.8%
rem-log-exp49.3%
associate-*r/43.4%
associate-/l*48.7%
exp-diff48.7%
log-div48.7%
rem-log-exp48.7%
rem-log-exp53.3%
Simplified53.3%
Taylor expanded in d around -inf 72.0%
pow172.0%
*-commutative72.0%
associate-/r/72.0%
mul-1-neg72.0%
sqrt-div72.1%
metadata-eval72.1%
Applied egg-rr72.1%
unpow172.1%
distribute-rgt-neg-out72.1%
associate-*r/72.0%
*-rgt-identity72.0%
associate-*r/74.5%
distribute-neg-frac74.5%
Simplified74.5%
Taylor expanded in M around 0 58.5%
fma-def58.5%
unpow258.5%
associate-*r*65.9%
*-commutative65.9%
unpow265.9%
*-commutative65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r*72.9%
associate-*r*76.8%
*-commutative76.8%
neg-mul-176.8%
Simplified76.8%
if -5.4000000000000003e-279 < l Initial program 63.3%
metadata-eval63.3%
unpow1/263.3%
metadata-eval63.3%
unpow1/263.3%
*-commutative63.3%
associate-*l*63.3%
times-frac63.3%
metadata-eval63.3%
Simplified63.3%
associate-*r*63.3%
frac-times63.3%
*-commutative63.3%
metadata-eval63.3%
expm1-log1p-u62.9%
expm1-udef62.9%
Applied egg-rr63.3%
+-commutative63.3%
associate--l+63.3%
metadata-eval63.3%
+-rgt-identity63.3%
*-commutative63.3%
associate-*l*63.3%
Simplified63.3%
Final simplification70.0%
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 -6.6e-279)
(/ (fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d)) (sqrt (* h l)))
(*
(- 1.0 (/ (* h (* 0.5 (pow (* (/ D d) (* 0.5 M)) 2.0))) l))
(* (sqrt (/ d h)) (sqrt (/ d l))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= -6.6e-279) {
tmp = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
} else {
tmp = (1.0 - ((h * (0.5 * pow(((D / d) * (0.5 * M)), 2.0))) / l)) * (sqrt((d / h)) * sqrt((d / l)));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= -6.6e-279) tmp = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))); else tmp = Float64(Float64(1.0 - Float64(Float64(h * Float64(0.5 * (Float64(Float64(D / d) * Float64(0.5 * M)) ^ 2.0))) / l)) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); 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, -6.6e-279], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h * N[(0.5 * N[Power[N[(N[(D / d), $MachinePrecision] * N[(0.5 * M), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -6.6 \cdot 10^{-279}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h \cdot \left(0.5 \cdot {\left(\frac{D}{d} \cdot \left(0.5 \cdot M\right)\right)}^{2}\right)}{\ell}\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if l < -6.6e-279Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr26.5%
expm1-def32.8%
expm1-log1p53.8%
rem-log-exp49.3%
associate-*r/43.4%
associate-/l*48.7%
exp-diff48.7%
log-div48.7%
rem-log-exp48.7%
rem-log-exp53.3%
Simplified53.3%
Taylor expanded in d around -inf 72.0%
pow172.0%
*-commutative72.0%
associate-/r/72.0%
mul-1-neg72.0%
sqrt-div72.1%
metadata-eval72.1%
Applied egg-rr72.1%
unpow172.1%
distribute-rgt-neg-out72.1%
associate-*r/72.0%
*-rgt-identity72.0%
associate-*r/74.5%
distribute-neg-frac74.5%
Simplified74.5%
Taylor expanded in M around 0 58.5%
fma-def58.5%
unpow258.5%
associate-*r*65.9%
*-commutative65.9%
unpow265.9%
*-commutative65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r*72.9%
associate-*r*76.8%
*-commutative76.8%
neg-mul-176.8%
Simplified76.8%
if -6.6e-279 < l Initial program 63.3%
metadata-eval63.3%
unpow1/263.3%
metadata-eval63.3%
unpow1/263.3%
*-commutative63.3%
associate-*l*63.3%
times-frac63.3%
metadata-eval63.3%
Simplified63.3%
associate-*r*63.3%
frac-times63.3%
*-commutative63.3%
metadata-eval63.3%
associate-*r/68.1%
metadata-eval68.1%
*-commutative68.1%
frac-times68.1%
*-commutative68.1%
div-inv68.1%
metadata-eval68.1%
Applied egg-rr68.1%
Final simplification72.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 (<= l -3.5e-278)
(/ (fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d)) (sqrt (* h l)))
(if (<= l 5.3e-6)
(*
(sqrt (/ (/ d h) (/ l d)))
(- 1.0 (* (/ 0.125 l) (* h (pow (/ (* M D) d) 2.0)))))
(* d (/ (sqrt (/ 1.0 l)) (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.5e-278) {
tmp = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
} else if (l <= 5.3e-6) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - ((0.125 / l) * (h * pow(((M * D) / d), 2.0))));
} else {
tmp = d * (sqrt((1.0 / l)) / 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.5e-278) tmp = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))); elseif (l <= 5.3e-6) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - Float64(Float64(0.125 / l) * Float64(h * (Float64(Float64(M * D) / d) ^ 2.0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / l)) / 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[l, -3.5e-278], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.3e-6], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(0.125 / l), $MachinePrecision] * N[(h * N[Power[N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $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.5 \cdot 10^{-278}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 5.3 \cdot 10^{-6}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - \frac{0.125}{\ell} \cdot \left(h \cdot {\left(\frac{M \cdot D}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -3.4999999999999997e-278Initial program 66.6%
metadata-eval66.6%
unpow1/266.6%
metadata-eval66.6%
unpow1/266.6%
*-commutative66.6%
associate-*l*66.6%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr26.5%
expm1-def32.8%
expm1-log1p53.8%
rem-log-exp49.3%
associate-*r/43.4%
associate-/l*48.7%
exp-diff48.7%
log-div48.7%
rem-log-exp48.7%
rem-log-exp53.3%
Simplified53.3%
Taylor expanded in d around -inf 72.0%
pow172.0%
*-commutative72.0%
associate-/r/72.0%
mul-1-neg72.0%
sqrt-div72.1%
metadata-eval72.1%
Applied egg-rr72.1%
unpow172.1%
distribute-rgt-neg-out72.1%
associate-*r/72.0%
*-rgt-identity72.0%
associate-*r/74.5%
distribute-neg-frac74.5%
Simplified74.5%
Taylor expanded in M around 0 58.5%
fma-def58.5%
unpow258.5%
associate-*r*65.9%
*-commutative65.9%
unpow265.9%
*-commutative65.9%
associate-/l*65.9%
*-commutative65.9%
associate-*r*72.9%
associate-*r*76.8%
*-commutative76.8%
neg-mul-176.8%
Simplified76.8%
if -3.4999999999999997e-278 < l < 5.3000000000000001e-6Initial program 66.1%
metadata-eval66.1%
unpow1/266.1%
metadata-eval66.1%
unpow1/266.1%
*-commutative66.1%
associate-*l*66.1%
times-frac66.1%
metadata-eval66.1%
Simplified66.1%
Applied egg-rr10.7%
expm1-def16.2%
expm1-log1p58.1%
rem-log-exp50.2%
associate-*r/42.1%
associate-/l*50.2%
exp-diff50.2%
log-div50.2%
rem-log-exp50.2%
rem-log-exp58.2%
Simplified58.2%
associate-*r/58.2%
div-inv58.2%
metadata-eval58.2%
Applied egg-rr58.2%
Taylor expanded in M around 0 39.6%
associate-*r/39.6%
unpow239.6%
times-frac41.1%
*-commutative41.1%
associate-*r*37.1%
*-commutative37.1%
unpow237.1%
associate-*r/38.5%
unpow238.5%
unpow238.5%
associate-*l*44.1%
unpow244.1%
times-frac61.1%
swap-sqr64.2%
Simplified64.2%
if 5.3000000000000001e-6 < l Initial program 60.0%
metadata-eval60.0%
unpow1/260.0%
metadata-eval60.0%
unpow1/260.0%
*-commutative60.0%
associate-*l*60.0%
times-frac59.9%
metadata-eval59.9%
Simplified59.9%
associate-*r*59.9%
frac-times60.0%
*-commutative60.0%
metadata-eval60.0%
associate-*r/63.4%
metadata-eval63.4%
*-commutative63.4%
frac-times63.3%
*-commutative63.3%
div-inv63.3%
metadata-eval63.3%
Applied egg-rr63.3%
Taylor expanded in d around inf 45.5%
*-commutative45.5%
associate-/r*46.9%
Simplified46.9%
sqrt-div64.8%
Applied egg-rr64.8%
Final simplification70.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -2.6e-154)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (<= d 8.5e-162)
(* -0.125 (/ (* (* D D) (* M M)) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= d 3e+128)
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -2.6e-154) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if (d <= 8.5e-162) {
tmp = -0.125 * (((D * D) * (M * M)) / (d / sqrt((h / pow(l, 3.0)))));
} else if (d <= 3e+128) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-2.6d-154)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if (d <= 8.5d-162) then
tmp = (-0.125d0) * (((d_1 * d_1) * (m * m)) / (d / sqrt((h / (l ** 3.0d0)))))
else if (d <= 3d+128) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -2.6e-154) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if (d <= 8.5e-162) {
tmp = -0.125 * (((D * D) * (M * M)) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (d <= 3e+128) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -2.6e-154: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif d <= 8.5e-162: tmp = -0.125 * (((D * D) * (M * M)) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif d <= 3e+128: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -2.6e-154) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif (d <= 8.5e-162) tmp = Float64(-0.125 * Float64(Float64(Float64(D * D) * Float64(M * M)) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (d <= 3e+128) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -2.6e-154)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif (d <= 8.5e-162)
tmp = -0.125 * (((D * D) * (M * M)) / (d / sqrt((h / (l ^ 3.0)))));
elseif (d <= 3e+128)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.6e-154], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e-162], N[(-0.125 * N[(N[(N[(D * D), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+128], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -2.6 \cdot 10^{-154}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-162}:\\
\;\;\;\;-0.125 \cdot \frac{\left(D \cdot D\right) \cdot \left(M \cdot M\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+128}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -2.6e-154Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -2.6e-154 < d < -3.999999999999988e-310Initial program 28.1%
metadata-eval28.1%
unpow1/228.1%
metadata-eval28.1%
unpow1/228.1%
*-commutative28.1%
associate-*l*28.1%
times-frac24.3%
metadata-eval24.3%
Simplified24.3%
Applied egg-rr7.5%
expm1-def10.0%
expm1-log1p17.3%
rem-log-exp17.1%
associate-*r/14.5%
associate-/l*14.7%
exp-diff14.7%
log-div14.7%
rem-log-exp14.7%
rem-log-exp14.9%
Simplified14.9%
Taylor expanded in d around -inf 36.2%
pow136.2%
*-commutative36.2%
associate-/r/36.2%
mul-1-neg36.2%
sqrt-div36.2%
metadata-eval36.2%
Applied egg-rr36.2%
unpow136.2%
distribute-rgt-neg-out36.2%
associate-*r/36.2%
*-rgt-identity36.2%
associate-*r/47.5%
distribute-neg-frac47.5%
Simplified47.5%
Taylor expanded in M around inf 39.7%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.7%
unpow239.7%
associate-*r*41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
associate-/l*41.1%
*-commutative41.1%
associate-*r*51.5%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if -3.999999999999988e-310 < d < 8.49999999999999955e-162Initial program 35.7%
metadata-eval35.7%
unpow1/235.7%
metadata-eval35.7%
unpow1/235.7%
*-commutative35.7%
associate-*l*35.7%
times-frac35.7%
metadata-eval35.7%
Simplified35.7%
Taylor expanded in d around 0 33.6%
associate-*l/33.7%
associate-/l*33.7%
unpow233.7%
unpow233.7%
Simplified33.7%
if 8.49999999999999955e-162 < d < 2.9999999999999998e128Initial program 79.2%
metadata-eval79.2%
unpow1/279.2%
metadata-eval79.2%
unpow1/279.2%
*-commutative79.2%
associate-*l*79.2%
times-frac79.1%
metadata-eval79.1%
Simplified79.1%
Applied egg-rr9.3%
expm1-def32.2%
expm1-log1p70.1%
rem-log-exp62.3%
associate-*r/59.2%
associate-/l*61.0%
exp-diff61.0%
log-div61.0%
rem-log-exp61.0%
rem-log-exp68.8%
Simplified68.8%
Taylor expanded in M around 0 57.0%
*-commutative57.0%
times-frac63.3%
unpow263.3%
unpow263.3%
times-frac65.1%
associate-/l*62.0%
unpow262.0%
Simplified62.0%
if 2.9999999999999998e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
sqrt-div73.9%
Applied egg-rr73.9%
Final simplification64.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -1.1e-152)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (<= d 8.5e-167)
(* -0.125 (/ (* D (* D (* M M))) (/ d (sqrt (/ h (pow l 3.0))))))
(if (<= d 2.2e+128)
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.1e-152) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if (d <= 8.5e-167) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / sqrt((h / pow(l, 3.0)))));
} else if (d <= 2.2e+128) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-1.1d-152)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if (d <= 8.5d-167) then
tmp = (-0.125d0) * ((d_1 * (d_1 * (m * m))) / (d / sqrt((h / (l ** 3.0d0)))))
else if (d <= 2.2d+128) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.1e-152) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if (d <= 8.5e-167) {
tmp = -0.125 * ((D * (D * (M * M))) / (d / Math.sqrt((h / Math.pow(l, 3.0)))));
} else if (d <= 2.2e+128) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -1.1e-152: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif d <= 8.5e-167: tmp = -0.125 * ((D * (D * (M * M))) / (d / math.sqrt((h / math.pow(l, 3.0))))) elif d <= 2.2e+128: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -1.1e-152) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif (d <= 8.5e-167) tmp = Float64(-0.125 * Float64(Float64(D * Float64(D * Float64(M * M))) / Float64(d / sqrt(Float64(h / (l ^ 3.0)))))); elseif (d <= 2.2e+128) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -1.1e-152)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif (d <= 8.5e-167)
tmp = -0.125 * ((D * (D * (M * M))) / (d / sqrt((h / (l ^ 3.0)))));
elseif (d <= 2.2e+128)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.1e-152], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e-167], N[(-0.125 * N[(N[(D * N[(D * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d / N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e+128], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -1.1 \cdot 10^{-152}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-167}:\\
\;\;\;\;-0.125 \cdot \frac{D \cdot \left(D \cdot \left(M \cdot M\right)\right)}{\frac{d}{\sqrt{\frac{h}{{\ell}^{3}}}}}\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+128}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -1.09999999999999992e-152Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -1.09999999999999992e-152 < d < -3.999999999999988e-310Initial program 28.1%
metadata-eval28.1%
unpow1/228.1%
metadata-eval28.1%
unpow1/228.1%
*-commutative28.1%
associate-*l*28.1%
times-frac24.3%
metadata-eval24.3%
Simplified24.3%
Applied egg-rr7.5%
expm1-def10.0%
expm1-log1p17.3%
rem-log-exp17.1%
associate-*r/14.5%
associate-/l*14.7%
exp-diff14.7%
log-div14.7%
rem-log-exp14.7%
rem-log-exp14.9%
Simplified14.9%
Taylor expanded in d around -inf 36.2%
pow136.2%
*-commutative36.2%
associate-/r/36.2%
mul-1-neg36.2%
sqrt-div36.2%
metadata-eval36.2%
Applied egg-rr36.2%
unpow136.2%
distribute-rgt-neg-out36.2%
associate-*r/36.2%
*-rgt-identity36.2%
associate-*r/47.5%
distribute-neg-frac47.5%
Simplified47.5%
Taylor expanded in M around inf 39.7%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.7%
unpow239.7%
associate-*r*41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
associate-/l*41.1%
*-commutative41.1%
associate-*r*51.5%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if -3.999999999999988e-310 < d < 8.4999999999999994e-167Initial program 35.7%
metadata-eval35.7%
unpow1/235.7%
metadata-eval35.7%
unpow1/235.7%
*-commutative35.7%
associate-*l*35.7%
times-frac35.7%
metadata-eval35.7%
Simplified35.7%
Applied egg-rr10.3%
expm1-def16.5%
expm1-log1p29.3%
rem-log-exp23.1%
associate-*r/14.7%
associate-/l*23.1%
exp-diff23.1%
log-div23.1%
rem-log-exp23.1%
rem-log-exp29.3%
Simplified29.3%
sqrt-div35.7%
Applied egg-rr35.7%
pow135.7%
associate-/r/35.7%
Applied egg-rr35.7%
Simplified35.9%
Taylor expanded in d around 0 33.6%
associate-*l/33.7%
associate-/l*33.7%
*-commutative33.7%
unpow233.7%
associate-*r*37.1%
unpow237.1%
Simplified37.1%
if 8.4999999999999994e-167 < d < 2.20000000000000017e128Initial program 79.2%
metadata-eval79.2%
unpow1/279.2%
metadata-eval79.2%
unpow1/279.2%
*-commutative79.2%
associate-*l*79.2%
times-frac79.1%
metadata-eval79.1%
Simplified79.1%
Applied egg-rr9.3%
expm1-def32.2%
expm1-log1p70.1%
rem-log-exp62.3%
associate-*r/59.2%
associate-/l*61.0%
exp-diff61.0%
log-div61.0%
rem-log-exp61.0%
rem-log-exp68.8%
Simplified68.8%
Taylor expanded in M around 0 57.0%
*-commutative57.0%
times-frac63.3%
unpow263.3%
unpow263.3%
times-frac65.1%
associate-/l*62.0%
unpow262.0%
Simplified62.0%
if 2.20000000000000017e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
sqrt-div73.9%
Applied egg-rr73.9%
Final simplification64.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -2.6e-155)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (<= d 7.2e-116)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (/ (* D D) (/ (/ d M) M))))
(if (<= d 1.2e+129)
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -2.6e-155) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if (d <= 7.2e-116) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * ((D * D) / ((d / M) / M)));
} else if (d <= 1.2e+129) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-2.6d-155)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if (d <= 7.2d-116) then
tmp = sqrt((h / (l ** 3.0d0))) * ((-0.125d0) * ((d_1 * d_1) / ((d / m) / m)))
else if (d <= 1.2d+129) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -2.6e-155) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if (d <= 7.2e-116) {
tmp = Math.sqrt((h / Math.pow(l, 3.0))) * (-0.125 * ((D * D) / ((d / M) / M)));
} else if (d <= 1.2e+129) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -2.6e-155: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif d <= 7.2e-116: tmp = math.sqrt((h / math.pow(l, 3.0))) * (-0.125 * ((D * D) / ((d / M) / M))) elif d <= 1.2e+129: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -2.6e-155) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif (d <= 7.2e-116) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(Float64(D * D) / Float64(Float64(d / M) / M)))); elseif (d <= 1.2e+129) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -2.6e-155)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif (d <= 7.2e-116)
tmp = sqrt((h / (l ^ 3.0))) * (-0.125 * ((D * D) / ((d / M) / M)));
elseif (d <= 1.2e+129)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.6e-155], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.2e-116], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e+129], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -2.6 \cdot 10^{-155}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-116}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{M}}\right)\\
\mathbf{elif}\;d \leq 1.2 \cdot 10^{+129}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -2.60000000000000008e-155Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -2.60000000000000008e-155 < d < -3.999999999999988e-310Initial program 28.1%
metadata-eval28.1%
unpow1/228.1%
metadata-eval28.1%
unpow1/228.1%
*-commutative28.1%
associate-*l*28.1%
times-frac24.3%
metadata-eval24.3%
Simplified24.3%
Applied egg-rr7.5%
expm1-def10.0%
expm1-log1p17.3%
rem-log-exp17.1%
associate-*r/14.5%
associate-/l*14.7%
exp-diff14.7%
log-div14.7%
rem-log-exp14.7%
rem-log-exp14.9%
Simplified14.9%
Taylor expanded in d around -inf 36.2%
pow136.2%
*-commutative36.2%
associate-/r/36.2%
mul-1-neg36.2%
sqrt-div36.2%
metadata-eval36.2%
Applied egg-rr36.2%
unpow136.2%
distribute-rgt-neg-out36.2%
associate-*r/36.2%
*-rgt-identity36.2%
associate-*r/47.5%
distribute-neg-frac47.5%
Simplified47.5%
Taylor expanded in M around inf 39.7%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.7%
unpow239.7%
associate-*r*41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
associate-/l*41.1%
*-commutative41.1%
associate-*r*51.5%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if -3.999999999999988e-310 < d < 7.19999999999999951e-116Initial program 40.8%
metadata-eval40.8%
unpow1/240.8%
metadata-eval40.8%
unpow1/240.8%
*-commutative40.8%
associate-*l*40.8%
times-frac40.6%
metadata-eval40.6%
Simplified40.6%
associate-*r*40.6%
frac-times40.8%
*-commutative40.8%
metadata-eval40.8%
associate-*r/43.6%
metadata-eval43.6%
*-commutative43.6%
frac-times43.4%
*-commutative43.4%
div-inv43.4%
metadata-eval43.4%
Applied egg-rr43.4%
Taylor expanded in d around 0 31.1%
associate-*r*31.1%
*-commutative31.1%
associate-/l*30.9%
unpow230.9%
unpow230.9%
associate-/r*39.1%
Simplified39.1%
if 7.19999999999999951e-116 < d < 1.1999999999999999e129Initial program 80.5%
metadata-eval80.5%
unpow1/280.5%
metadata-eval80.5%
unpow1/280.5%
*-commutative80.5%
associate-*l*80.5%
times-frac80.5%
metadata-eval80.5%
Simplified80.5%
Applied egg-rr10.2%
expm1-def33.8%
expm1-log1p70.5%
rem-log-exp63.5%
associate-*r/60.2%
associate-/l*62.1%
exp-diff62.1%
log-div62.1%
rem-log-exp62.1%
rem-log-exp69.1%
Simplified69.1%
Taylor expanded in M around 0 59.5%
*-commutative59.5%
times-frac64.7%
unpow264.7%
unpow264.7%
times-frac66.7%
associate-/l*65.1%
unpow265.1%
Simplified65.1%
if 1.1999999999999999e129 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
sqrt-div73.9%
Applied egg-rr73.9%
Final simplification65.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
(if (<= d -4e-310)
(/ (fma 0.125 (/ D (/ (* d l) (* M (* D (* h M))))) (- d)) (sqrt (* h l)))
(if (<= d 2e-113)
(* (sqrt (/ h (pow l 3.0))) (* -0.125 (/ (* D D) (/ (/ d M) M))))
(if (<= d 4.7e+128)
(*
(sqrt (/ (/ d h) (/ l d)))
(- 1.0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h))))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -4e-310) {
tmp = fma(0.125, (D / ((d * l) / (M * (D * (h * M))))), -d) / sqrt((h * l));
} else if (d <= 2e-113) {
tmp = sqrt((h / pow(l, 3.0))) * (-0.125 * ((D * D) / ((d / M) / M)));
} else if (d <= 4.7e+128) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -4e-310) tmp = Float64(fma(0.125, Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M))))), Float64(-d)) / sqrt(Float64(h * l))); elseif (d <= 2e-113) tmp = Float64(sqrt(Float64(h / (l ^ 3.0))) * Float64(-0.125 * Float64(Float64(D * D) / Float64(Float64(d / M) / M)))); elseif (d <= 4.7e+128) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); 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, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + (-d)), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-113], N[(N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(N[(D * D), $MachinePrecision] / N[(N[(d / M), $MachinePrecision] / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.7e+128], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.125, \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}, -d\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-113}:\\
\;\;\;\;\sqrt{\frac{h}{{\ell}^{3}}} \cdot \left(-0.125 \cdot \frac{D \cdot D}{\frac{\frac{d}{M}}{M}}\right)\\
\mathbf{elif}\;d \leq 4.7 \cdot 10^{+128}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -3.999999999999988e-310Initial program 67.2%
metadata-eval67.2%
unpow1/267.2%
metadata-eval67.2%
unpow1/267.2%
*-commutative67.2%
associate-*l*67.2%
times-frac65.6%
metadata-eval65.6%
Simplified65.6%
Applied egg-rr27.1%
expm1-def33.1%
expm1-log1p54.8%
rem-log-exp49.8%
associate-*r/43.4%
associate-/l*49.3%
exp-diff49.3%
log-div49.3%
rem-log-exp49.3%
rem-log-exp54.3%
Simplified54.3%
Taylor expanded in d around -inf 70.9%
pow170.9%
*-commutative70.9%
associate-/r/70.9%
mul-1-neg70.9%
sqrt-div71.0%
metadata-eval71.0%
Applied egg-rr71.0%
unpow171.0%
distribute-rgt-neg-out71.0%
associate-*r/71.0%
*-rgt-identity71.0%
associate-*r/73.4%
distribute-neg-frac73.4%
Simplified73.4%
Taylor expanded in M around 0 57.9%
fma-def57.9%
unpow257.9%
associate-*r*65.0%
*-commutative65.0%
unpow265.0%
*-commutative65.0%
associate-/l*65.0%
*-commutative65.0%
associate-*r*71.7%
associate-*r*75.5%
*-commutative75.5%
neg-mul-175.5%
Simplified75.5%
if -3.999999999999988e-310 < d < 1.99999999999999996e-113Initial program 40.8%
metadata-eval40.8%
unpow1/240.8%
metadata-eval40.8%
unpow1/240.8%
*-commutative40.8%
associate-*l*40.8%
times-frac40.6%
metadata-eval40.6%
Simplified40.6%
associate-*r*40.6%
frac-times40.8%
*-commutative40.8%
metadata-eval40.8%
associate-*r/43.6%
metadata-eval43.6%
*-commutative43.6%
frac-times43.4%
*-commutative43.4%
div-inv43.4%
metadata-eval43.4%
Applied egg-rr43.4%
Taylor expanded in d around 0 31.1%
associate-*r*31.1%
*-commutative31.1%
associate-/l*30.9%
unpow230.9%
unpow230.9%
associate-/r*39.1%
Simplified39.1%
if 1.99999999999999996e-113 < d < 4.6999999999999998e128Initial program 80.5%
metadata-eval80.5%
unpow1/280.5%
metadata-eval80.5%
unpow1/280.5%
*-commutative80.5%
associate-*l*80.5%
times-frac80.5%
metadata-eval80.5%
Simplified80.5%
Applied egg-rr10.2%
expm1-def33.8%
expm1-log1p70.5%
rem-log-exp63.5%
associate-*r/60.2%
associate-/l*62.1%
exp-diff62.1%
log-div62.1%
rem-log-exp62.1%
rem-log-exp69.1%
Simplified69.1%
Taylor expanded in M around 0 59.5%
*-commutative59.5%
times-frac64.7%
unpow264.7%
unpow264.7%
times-frac66.7%
associate-/l*65.1%
unpow265.1%
Simplified65.1%
if 4.6999999999999998e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
sqrt-div73.9%
Applied egg-rr73.9%
Final simplification67.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -1.05e-152)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (or (<= d 2.5e-114) (not (<= d 9.5e+128)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.05e-152) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if ((d <= 2.5e-114) || !(d <= 9.5e+128)) {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
} else {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-1.05d-152)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if ((d <= 2.5d-114) .or. (.not. (d <= 9.5d+128))) then
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
else
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.05e-152) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if ((d <= 2.5e-114) || !(d <= 9.5e+128)) {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
} else {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -1.05e-152: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif (d <= 2.5e-114) or not (d <= 9.5e+128): tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) else: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -1.05e-152) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif ((d <= 2.5e-114) || !(d <= 9.5e+128)) tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); else tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -1.05e-152)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif ((d <= 2.5e-114) || ~((d <= 9.5e+128)))
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
else
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.05e-152], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 2.5e-114], N[Not[LessEqual[d, 9.5e+128]], $MachinePrecision]], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -1.05 \cdot 10^{-152}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-114} \lor \neg \left(d \leq 9.5 \cdot 10^{+128}\right):\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -1.04999999999999999e-152Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -1.04999999999999999e-152 < d < -3.999999999999988e-310Initial program 28.1%
metadata-eval28.1%
unpow1/228.1%
metadata-eval28.1%
unpow1/228.1%
*-commutative28.1%
associate-*l*28.1%
times-frac24.3%
metadata-eval24.3%
Simplified24.3%
Applied egg-rr7.5%
expm1-def10.0%
expm1-log1p17.3%
rem-log-exp17.1%
associate-*r/14.5%
associate-/l*14.7%
exp-diff14.7%
log-div14.7%
rem-log-exp14.7%
rem-log-exp14.9%
Simplified14.9%
Taylor expanded in d around -inf 36.2%
pow136.2%
*-commutative36.2%
associate-/r/36.2%
mul-1-neg36.2%
sqrt-div36.2%
metadata-eval36.2%
Applied egg-rr36.2%
unpow136.2%
distribute-rgt-neg-out36.2%
associate-*r/36.2%
*-rgt-identity36.2%
associate-*r/47.5%
distribute-neg-frac47.5%
Simplified47.5%
Taylor expanded in M around inf 39.7%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.7%
unpow239.7%
associate-*r*41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
associate-/l*41.1%
*-commutative41.1%
associate-*r*51.5%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if -3.999999999999988e-310 < d < 2.49999999999999995e-114 or 9.50000000000000014e128 < d Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac47.8%
metadata-eval47.8%
Simplified47.8%
Taylor expanded in d around inf 43.4%
*-commutative43.4%
*-commutative43.4%
associate-/r*43.7%
Simplified43.7%
sqrt-div50.5%
Applied egg-rr50.5%
if 2.49999999999999995e-114 < d < 9.50000000000000014e128Initial program 80.5%
metadata-eval80.5%
unpow1/280.5%
metadata-eval80.5%
unpow1/280.5%
*-commutative80.5%
associate-*l*80.5%
times-frac80.5%
metadata-eval80.5%
Simplified80.5%
Applied egg-rr10.2%
expm1-def33.8%
expm1-log1p70.5%
rem-log-exp63.5%
associate-*r/60.2%
associate-/l*62.1%
exp-diff62.1%
log-div62.1%
rem-log-exp62.1%
rem-log-exp69.1%
Simplified69.1%
Taylor expanded in M around 0 59.5%
*-commutative59.5%
times-frac64.7%
unpow264.7%
unpow264.7%
times-frac66.7%
associate-/l*65.1%
unpow265.1%
Simplified65.1%
Final simplification64.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -1.9e-153)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (or (<= d 3e-113) (not (<= d 2.9e+128)))
(/ d (* (sqrt h) (sqrt l)))
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.9e-153) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if ((d <= 3e-113) || !(d <= 2.9e+128)) {
tmp = d / (sqrt(h) * sqrt(l));
} else {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-1.9d-153)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if ((d <= 3d-113) .or. (.not. (d <= 2.9d+128))) then
tmp = d / (sqrt(h) * sqrt(l))
else
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.9e-153) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if ((d <= 3e-113) || !(d <= 2.9e+128)) {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
} else {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -1.9e-153: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif (d <= 3e-113) or not (d <= 2.9e+128): tmp = d / (math.sqrt(h) * math.sqrt(l)) else: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -1.9e-153) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif ((d <= 3e-113) || !(d <= 2.9e+128)) tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); else tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -1.9e-153)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif ((d <= 3e-113) || ~((d <= 2.9e+128)))
tmp = d / (sqrt(h) * sqrt(l));
else
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.9e-153], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d, 3e-113], N[Not[LessEqual[d, 2.9e+128]], $MachinePrecision]], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -1.9 \cdot 10^{-153}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{-113} \lor \neg \left(d \leq 2.9 \cdot 10^{+128}\right):\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -1.90000000000000011e-153Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -1.90000000000000011e-153 < d < -3.999999999999988e-310Initial program 28.1%
metadata-eval28.1%
unpow1/228.1%
metadata-eval28.1%
unpow1/228.1%
*-commutative28.1%
associate-*l*28.1%
times-frac24.3%
metadata-eval24.3%
Simplified24.3%
Applied egg-rr7.5%
expm1-def10.0%
expm1-log1p17.3%
rem-log-exp17.1%
associate-*r/14.5%
associate-/l*14.7%
exp-diff14.7%
log-div14.7%
rem-log-exp14.7%
rem-log-exp14.9%
Simplified14.9%
Taylor expanded in d around -inf 36.2%
pow136.2%
*-commutative36.2%
associate-/r/36.2%
mul-1-neg36.2%
sqrt-div36.2%
metadata-eval36.2%
Applied egg-rr36.2%
unpow136.2%
distribute-rgt-neg-out36.2%
associate-*r/36.2%
*-rgt-identity36.2%
associate-*r/47.5%
distribute-neg-frac47.5%
Simplified47.5%
Taylor expanded in M around inf 39.7%
associate-*r/39.7%
*-commutative39.7%
associate-*r/39.7%
unpow239.7%
associate-*r*41.1%
*-commutative41.1%
unpow241.1%
*-commutative41.1%
associate-/l*41.1%
*-commutative41.1%
associate-*r*51.5%
associate-*r*58.6%
*-commutative58.6%
Simplified58.6%
if -3.999999999999988e-310 < d < 3.0000000000000001e-113 or 2.9e128 < d Initial program 47.9%
metadata-eval47.9%
unpow1/247.9%
metadata-eval47.9%
unpow1/247.9%
*-commutative47.9%
associate-*l*47.9%
times-frac47.8%
metadata-eval47.8%
Simplified47.8%
associate-*r*47.8%
frac-times47.9%
*-commutative47.9%
metadata-eval47.9%
associate-*r/52.8%
metadata-eval52.8%
*-commutative52.8%
frac-times52.7%
*-commutative52.7%
div-inv52.7%
metadata-eval52.7%
Applied egg-rr52.7%
Taylor expanded in d around inf 43.4%
*-commutative43.4%
associate-/r*43.7%
Simplified43.7%
associate-/r*43.4%
add-cbrt-cube26.7%
pow126.7%
add-cbrt-cube43.4%
sqrt-div43.4%
metadata-eval43.4%
Applied egg-rr43.4%
unpow143.4%
associate-*r/43.3%
*-rgt-identity43.3%
*-commutative43.3%
Simplified43.3%
sqrt-prod50.4%
Applied egg-rr50.4%
if 3.0000000000000001e-113 < d < 2.9e128Initial program 80.5%
metadata-eval80.5%
unpow1/280.5%
metadata-eval80.5%
unpow1/280.5%
*-commutative80.5%
associate-*l*80.5%
times-frac80.5%
metadata-eval80.5%
Simplified80.5%
Applied egg-rr10.2%
expm1-def33.8%
expm1-log1p70.5%
rem-log-exp63.5%
associate-*r/60.2%
associate-/l*62.1%
exp-diff62.1%
log-div62.1%
rem-log-exp62.1%
rem-log-exp69.1%
Simplified69.1%
Taylor expanded in M around 0 59.5%
*-commutative59.5%
times-frac64.7%
unpow264.7%
unpow264.7%
times-frac66.7%
associate-/l*65.1%
unpow265.1%
Simplified65.1%
Final simplification64.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h)))))
(t_1 (* M (* D (* h M))))
(t_2 (* d (sqrt (/ 1.0 (* h l))))))
(if (<= d -1.16e+159)
(* t_2 (+ t_0 -1.0))
(if (<= d -1.46e-154)
(* t_2 (+ -1.0 (* 0.125 (/ (* D t_1) (* l (* d d))))))
(if (<= d 3e-218)
(/ (* 0.125 (/ D (/ (* d l) t_1))) (sqrt (* h l)))
(if (<= d 6.2e+128)
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))
(* d (sqrt (/ (/ 1.0 h) l)))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.46e-154) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= 3e-218) {
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
} else if (d <= 6.2e+128) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
t_1 = m * (d_1 * (h * m))
t_2 = d * sqrt((1.0d0 / (h * l)))
if (d <= (-1.16d+159)) then
tmp = t_2 * (t_0 + (-1.0d0))
else if (d <= (-1.46d-154)) then
tmp = t_2 * ((-1.0d0) + (0.125d0 * ((d_1 * t_1) / (l * (d * d)))))
else if (d <= 3d-218) then
tmp = (0.125d0 * (d_1 / ((d * l) / t_1))) / sqrt((h * l))
else if (d <= 6.2d+128) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double t_1 = M * (D * (h * M));
double t_2 = d * Math.sqrt((1.0 / (h * l)));
double tmp;
if (d <= -1.16e+159) {
tmp = t_2 * (t_0 + -1.0);
} else if (d <= -1.46e-154) {
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
} else if (d <= 3e-218) {
tmp = (0.125 * (D / ((d * l) / t_1))) / Math.sqrt((h * l));
} else if (d <= 6.2e+128) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) t_1 = M * (D * (h * M)) t_2 = d * math.sqrt((1.0 / (h * l))) tmp = 0 if d <= -1.16e+159: tmp = t_2 * (t_0 + -1.0) elif d <= -1.46e-154: tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d))))) elif d <= 3e-218: tmp = (0.125 * (D / ((d * l) / t_1))) / math.sqrt((h * l)) elif d <= 6.2e+128: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) t_1 = Float64(M * Float64(D * Float64(h * M))) t_2 = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) tmp = 0.0 if (d <= -1.16e+159) tmp = Float64(t_2 * Float64(t_0 + -1.0)); elseif (d <= -1.46e-154) tmp = Float64(t_2 * Float64(-1.0 + Float64(0.125 * Float64(Float64(D * t_1) / Float64(l * Float64(d * d)))))); elseif (d <= 3e-218) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / t_1))) / sqrt(Float64(h * l))); elseif (d <= 6.2e+128) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
t_1 = M * (D * (h * M));
t_2 = d * sqrt((1.0 / (h * l)));
tmp = 0.0;
if (d <= -1.16e+159)
tmp = t_2 * (t_0 + -1.0);
elseif (d <= -1.46e-154)
tmp = t_2 * (-1.0 + (0.125 * ((D * t_1) / (l * (d * d)))));
elseif (d <= 3e-218)
tmp = (0.125 * (D / ((d * l) / t_1))) / sqrt((h * l));
elseif (d <= 6.2e+128)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
else
tmp = d * sqrt(((1.0 / h) / l));
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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.16e+159], N[(t$95$2 * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.46e-154], N[(t$95$2 * N[(-1.0 + N[(0.125 * N[(N[(D * t$95$1), $MachinePrecision] / N[(l * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e-218], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e+128], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
t_1 := M \cdot \left(D \cdot \left(h \cdot M\right)\right)\\
t_2 := d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{if}\;d \leq -1.16 \cdot 10^{+159}:\\
\;\;\;\;t_2 \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq -1.46 \cdot 10^{-154}:\\
\;\;\;\;t_2 \cdot \left(-1 + 0.125 \cdot \frac{D \cdot t_1}{\ell \cdot \left(d \cdot d\right)}\right)\\
\mathbf{elif}\;d \leq 3 \cdot 10^{-218}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{t_1}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{+128}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -1.1600000000000001e159Initial program 74.2%
metadata-eval74.2%
unpow1/274.2%
metadata-eval74.2%
unpow1/274.2%
*-commutative74.2%
associate-*l*74.2%
times-frac71.5%
metadata-eval71.5%
Simplified71.5%
Applied egg-rr43.7%
expm1-def48.9%
expm1-log1p64.0%
rem-log-exp64.0%
associate-*r/53.8%
associate-/l*64.1%
exp-diff64.1%
log-div64.1%
rem-log-exp64.1%
rem-log-exp64.1%
Simplified64.1%
Taylor expanded in d around -inf 76.0%
Taylor expanded in M around 0 43.5%
*-commutative38.9%
times-frac41.6%
unpow241.6%
unpow241.6%
times-frac58.1%
associate-/l*55.2%
unpow255.2%
Simplified62.4%
if -1.1600000000000001e159 < d < -1.46000000000000007e-154Initial program 79.6%
metadata-eval79.6%
unpow1/279.6%
metadata-eval79.6%
unpow1/279.6%
*-commutative79.6%
associate-*l*79.6%
times-frac79.6%
metadata-eval79.6%
Simplified79.6%
Applied egg-rr26.1%
expm1-def34.0%
expm1-log1p65.4%
rem-log-exp55.6%
associate-*r/49.8%
associate-/l*55.6%
exp-diff55.6%
log-div55.6%
rem-log-exp55.6%
rem-log-exp65.4%
Simplified65.4%
Taylor expanded in d around -inf 82.7%
Taylor expanded in M around 0 61.5%
*-commutative61.5%
associate-*r*58.6%
unpow258.6%
unpow258.6%
unpow258.6%
Simplified58.6%
Taylor expanded in D around 0 61.5%
unpow261.5%
associate-*r*70.5%
*-commutative70.5%
unpow270.5%
associate-*r*76.0%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
if -1.46000000000000007e-154 < d < 2.9999999999999998e-218Initial program 31.2%
metadata-eval31.2%
unpow1/231.2%
metadata-eval31.2%
unpow1/231.2%
*-commutative31.2%
associate-*l*31.2%
times-frac29.1%
metadata-eval29.1%
Simplified29.1%
Applied egg-rr10.3%
expm1-def13.5%
expm1-log1p21.4%
rem-log-exp17.5%
associate-*r/12.9%
associate-/l*16.2%
exp-diff16.2%
log-div16.2%
rem-log-exp16.2%
rem-log-exp20.1%
Simplified20.1%
Taylor expanded in d around -inf 26.0%
pow126.0%
*-commutative26.0%
associate-/r/26.0%
mul-1-neg26.0%
sqrt-div26.0%
metadata-eval26.0%
Applied egg-rr26.0%
unpow126.0%
distribute-rgt-neg-out26.0%
associate-*r/26.0%
*-rgt-identity26.0%
associate-*r/32.2%
distribute-neg-frac32.2%
Simplified32.2%
Taylor expanded in M around inf 28.2%
associate-*r/28.2%
*-commutative28.2%
associate-*r/28.2%
unpow228.2%
associate-*r*29.0%
*-commutative29.0%
unpow229.0%
*-commutative29.0%
associate-/l*29.0%
*-commutative29.0%
associate-*r*34.8%
associate-*r*38.6%
*-commutative38.6%
Simplified38.6%
if 2.9999999999999998e-218 < d < 6.20000000000000008e128Initial program 74.5%
metadata-eval74.5%
unpow1/274.5%
metadata-eval74.5%
unpow1/274.5%
*-commutative74.5%
associate-*l*74.5%
times-frac74.4%
metadata-eval74.4%
Simplified74.4%
Applied egg-rr8.3%
expm1-def29.9%
expm1-log1p66.4%
rem-log-exp59.5%
associate-*r/55.4%
associate-/l*58.3%
exp-diff58.3%
log-div58.3%
rem-log-exp58.3%
rem-log-exp65.2%
Simplified65.2%
Taylor expanded in M around 0 53.4%
*-commutative53.4%
times-frac58.9%
unpow258.9%
unpow258.9%
times-frac61.9%
associate-/l*59.2%
unpow259.2%
Simplified59.2%
if 6.20000000000000008e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
Final simplification61.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
(let* ((t_0
(*
(sqrt (/ (/ d h) (/ l d)))
(- 1.0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h))))))))
(if (<= d -8.8e-13)
t_0
(if (<= d 2.7e-218)
(/ (* 0.125 (/ D (/ (* d l) (* M (* D (* h M)))))) (sqrt (* h l)))
(if (<= d 2.5e+128) t_0 (* d (sqrt (/ (/ 1.0 h) l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(((d / h) / (l / d))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
double tmp;
if (d <= -8.8e-13) {
tmp = t_0;
} else if (d <= 2.7e-218) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / sqrt((h * l));
} else if (d <= 2.5e+128) {
tmp = t_0;
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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) :: t_0
real(8) :: tmp
t_0 = sqrt(((d / h) / (l / d))) * (1.0d0 - (0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))))
if (d <= (-8.8d-13)) then
tmp = t_0
else if (d <= 2.7d-218) then
tmp = (0.125d0 * (d_1 / ((d * l) / (m * (d_1 * (h * m)))))) / sqrt((h * l))
else if (d <= 2.5d+128) then
tmp = t_0
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 t_0 = Math.sqrt(((d / h) / (l / d))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
double tmp;
if (d <= -8.8e-13) {
tmp = t_0;
} else if (d <= 2.7e-218) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / Math.sqrt((h * l));
} else if (d <= 2.5e+128) {
tmp = t_0;
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt(((d / h) / (l / d))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))))) tmp = 0 if d <= -8.8e-13: tmp = t_0 elif d <= 2.7e-218: tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / math.sqrt((h * l)) elif d <= 2.5e+128: tmp = t_0 else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))))) tmp = 0.0 if (d <= -8.8e-13) tmp = t_0; elseif (d <= 2.7e-218) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M)))))) / sqrt(Float64(h * l))); elseif (d <= 2.5e+128) tmp = t_0; else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt(((d / h) / (l / d))) * (1.0 - (0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)))));
tmp = 0.0;
if (d <= -8.8e-13)
tmp = t_0;
elseif (d <= 2.7e-218)
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / sqrt((h * l));
elseif (d <= 2.5e+128)
tmp = t_0;
else
tmp = d * sqrt(((1.0 / h) / l));
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_] := Block[{t$95$0 = N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.8e-13], t$95$0, If[LessEqual[d, 2.7e-218], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e+128], t$95$0, N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\right)\\
\mathbf{if}\;d \leq -8.8 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d \leq 2.7 \cdot 10^{-218}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{+128}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -8.79999999999999986e-13 or 2.7e-218 < d < 2.5e128Initial program 77.1%
metadata-eval77.1%
unpow1/277.1%
metadata-eval77.1%
unpow1/277.1%
*-commutative77.1%
associate-*l*77.1%
times-frac76.3%
metadata-eval76.3%
Simplified76.3%
Applied egg-rr26.2%
expm1-def39.7%
expm1-log1p68.6%
rem-log-exp63.3%
associate-*r/56.1%
associate-/l*62.8%
exp-diff62.8%
log-div62.8%
rem-log-exp62.8%
rem-log-exp68.1%
Simplified68.1%
Taylor expanded in M around 0 49.7%
*-commutative49.7%
times-frac53.0%
unpow253.0%
unpow253.0%
times-frac59.4%
associate-/l*57.4%
unpow257.4%
Simplified57.4%
if -8.79999999999999986e-13 < d < 2.7e-218Initial program 46.4%
metadata-eval46.4%
unpow1/246.4%
metadata-eval46.4%
unpow1/246.4%
*-commutative46.4%
associate-*l*46.4%
times-frac45.0%
metadata-eval45.0%
Simplified45.0%
Applied egg-rr8.3%
expm1-def14.0%
expm1-log1p31.8%
rem-log-exp24.6%
associate-*r/21.6%
associate-/l*23.8%
exp-diff23.8%
log-div23.8%
rem-log-exp23.8%
rem-log-exp31.0%
Simplified31.0%
Taylor expanded in d around -inf 44.5%
pow144.5%
*-commutative44.5%
associate-/r/44.5%
mul-1-neg44.5%
sqrt-div44.5%
metadata-eval44.5%
Applied egg-rr44.5%
unpow144.5%
distribute-rgt-neg-out44.5%
associate-*r/44.5%
*-rgt-identity44.5%
associate-*r/48.4%
distribute-neg-frac48.4%
Simplified48.4%
Taylor expanded in M around inf 36.0%
associate-*r/36.0%
*-commutative36.0%
associate-*r/36.0%
unpow236.0%
associate-*r*39.1%
*-commutative39.1%
unpow239.1%
*-commutative39.1%
associate-/l*39.2%
*-commutative39.2%
associate-*r*45.2%
associate-*r*47.7%
*-commutative47.7%
Simplified47.7%
if 2.5e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
Final simplification54.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
(let* ((t_0 (* 0.125 (* (* (/ D d) (/ D d)) (/ (* M M) (/ l h))))))
(if (<= d -3.4e-13)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ t_0 -1.0))
(if (<= d 3.3e-218)
(/ (* 0.125 (/ D (/ (* d l) (* M (* D (* h M)))))) (sqrt (* h l)))
(if (<= d 6e+128)
(* (sqrt (/ (/ d h) (/ l d))) (- 1.0 t_0))
(* d (sqrt (/ (/ 1.0 h) l))))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double tmp;
if (d <= -3.4e-13) {
tmp = (d * sqrt((1.0 / (h * l)))) * (t_0 + -1.0);
} else if (d <= 3.3e-218) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / sqrt((h * l));
} else if (d <= 6e+128) {
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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) :: t_0
real(8) :: tmp
t_0 = 0.125d0 * (((d_1 / d) * (d_1 / d)) * ((m * m) / (l / h)))
if (d <= (-3.4d-13)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * (t_0 + (-1.0d0))
else if (d <= 3.3d-218) then
tmp = (0.125d0 * (d_1 / ((d * l) / (m * (d_1 * (h * m)))))) / sqrt((h * l))
else if (d <= 6d+128) then
tmp = sqrt(((d / h) / (l / d))) * (1.0d0 - t_0)
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
double tmp;
if (d <= -3.4e-13) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (t_0 + -1.0);
} else if (d <= 3.3e-218) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / Math.sqrt((h * l));
} else if (d <= 6e+128) {
tmp = Math.sqrt(((d / h) / (l / d))) * (1.0 - t_0);
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h))) tmp = 0 if d <= -3.4e-13: tmp = (d * math.sqrt((1.0 / (h * l)))) * (t_0 + -1.0) elif d <= 3.3e-218: tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / math.sqrt((h * l)) elif d <= 6e+128: tmp = math.sqrt(((d / h) / (l / d))) * (1.0 - t_0) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = Float64(0.125 * Float64(Float64(Float64(D / d) * Float64(D / d)) * Float64(Float64(M * M) / Float64(l / h)))) tmp = 0.0 if (d <= -3.4e-13) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(t_0 + -1.0)); elseif (d <= 3.3e-218) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M)))))) / sqrt(Float64(h * l))); elseif (d <= 6e+128) tmp = Float64(sqrt(Float64(Float64(d / h) / Float64(l / d))) * Float64(1.0 - t_0)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = 0.125 * (((D / d) * (D / d)) * ((M * M) / (l / h)));
tmp = 0.0;
if (d <= -3.4e-13)
tmp = (d * sqrt((1.0 / (h * l)))) * (t_0 + -1.0);
elseif (d <= 3.3e-218)
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / sqrt((h * l));
elseif (d <= 6e+128)
tmp = sqrt(((d / h) / (l / d))) * (1.0 - t_0);
else
tmp = d * sqrt(((1.0 / h) / l));
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_] := Block[{t$95$0 = N[(0.125 * N[(N[(N[(D / d), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.4e-13], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.3e-218], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6e+128], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] / N[(l / d), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := 0.125 \cdot \left(\left(\frac{D}{d} \cdot \frac{D}{d}\right) \cdot \frac{M \cdot M}{\frac{\ell}{h}}\right)\\
\mathbf{if}\;d \leq -3.4 \cdot 10^{-13}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(t_0 + -1\right)\\
\mathbf{elif}\;d \leq 3.3 \cdot 10^{-218}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 6 \cdot 10^{+128}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{h}}{\frac{\ell}{d}}} \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -3.40000000000000015e-13Initial program 79.5%
metadata-eval79.5%
unpow1/279.5%
metadata-eval79.5%
unpow1/279.5%
*-commutative79.5%
associate-*l*79.5%
times-frac78.1%
metadata-eval78.1%
Simplified78.1%
Applied egg-rr43.0%
expm1-def48.8%
expm1-log1p70.7%
rem-log-exp66.9%
associate-*r/56.8%
associate-/l*67.0%
exp-diff67.0%
log-div67.0%
rem-log-exp67.0%
rem-log-exp70.7%
Simplified70.7%
Taylor expanded in d around -inf 81.6%
Taylor expanded in M around 0 51.0%
*-commutative46.2%
times-frac47.5%
unpow247.5%
unpow247.5%
times-frac57.1%
associate-/l*55.7%
unpow255.7%
Simplified63.0%
if -3.40000000000000015e-13 < d < 3.30000000000000023e-218Initial program 46.4%
metadata-eval46.4%
unpow1/246.4%
metadata-eval46.4%
unpow1/246.4%
*-commutative46.4%
associate-*l*46.4%
times-frac45.0%
metadata-eval45.0%
Simplified45.0%
Applied egg-rr8.3%
expm1-def14.0%
expm1-log1p31.8%
rem-log-exp24.6%
associate-*r/21.6%
associate-/l*23.8%
exp-diff23.8%
log-div23.8%
rem-log-exp23.8%
rem-log-exp31.0%
Simplified31.0%
Taylor expanded in d around -inf 44.5%
pow144.5%
*-commutative44.5%
associate-/r/44.5%
mul-1-neg44.5%
sqrt-div44.5%
metadata-eval44.5%
Applied egg-rr44.5%
unpow144.5%
distribute-rgt-neg-out44.5%
associate-*r/44.5%
*-rgt-identity44.5%
associate-*r/48.4%
distribute-neg-frac48.4%
Simplified48.4%
Taylor expanded in M around inf 36.0%
associate-*r/36.0%
*-commutative36.0%
associate-*r/36.0%
unpow236.0%
associate-*r*39.1%
*-commutative39.1%
unpow239.1%
*-commutative39.1%
associate-/l*39.2%
*-commutative39.2%
associate-*r*45.2%
associate-*r*47.7%
*-commutative47.7%
Simplified47.7%
if 3.30000000000000023e-218 < d < 5.9999999999999997e128Initial program 74.5%
metadata-eval74.5%
unpow1/274.5%
metadata-eval74.5%
unpow1/274.5%
*-commutative74.5%
associate-*l*74.5%
times-frac74.4%
metadata-eval74.4%
Simplified74.4%
Applied egg-rr8.3%
expm1-def29.9%
expm1-log1p66.4%
rem-log-exp59.5%
associate-*r/55.4%
associate-/l*58.3%
exp-diff58.3%
log-div58.3%
rem-log-exp58.3%
rem-log-exp65.2%
Simplified65.2%
Taylor expanded in M around 0 53.4%
*-commutative53.4%
times-frac58.9%
unpow258.9%
unpow258.9%
times-frac61.9%
associate-/l*59.2%
unpow259.2%
Simplified59.2%
if 5.9999999999999997e128 < d Initial program 56.4%
metadata-eval56.4%
unpow1/256.4%
metadata-eval56.4%
unpow1/256.4%
*-commutative56.4%
associate-*l*56.4%
times-frac56.4%
metadata-eval56.4%
Simplified56.4%
Taylor expanded in d around inf 61.3%
*-commutative61.3%
*-commutative61.3%
associate-/r*62.1%
Simplified62.1%
Final simplification57.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
(let* ((t_0 (sqrt (* h l))))
(if (<= d -4100.0)
(/ (- d) t_0)
(if (<= d -4e-310)
(/ (* 0.125 (* (* (/ h l) (* D D)) (/ M (/ d M)))) t_0)
(* d (sqrt (/ (/ 1.0 h) l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (d <= -4100.0) {
tmp = -d / t_0;
} else if (d <= -4e-310) {
tmp = (0.125 * (((h / l) * (D * D)) * (M / (d / M)))) / t_0;
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (d <= (-4100.0d0)) then
tmp = -d / t_0
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (((h / l) * (d_1 * d_1)) * (m / (d / m)))) / t_0
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 t_0 = Math.sqrt((h * l));
double tmp;
if (d <= -4100.0) {
tmp = -d / t_0;
} else if (d <= -4e-310) {
tmp = (0.125 * (((h / l) * (D * D)) * (M / (d / M)))) / t_0;
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if d <= -4100.0: tmp = -d / t_0 elif d <= -4e-310: tmp = (0.125 * (((h / l) * (D * D)) * (M / (d / M)))) / t_0 else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (d <= -4100.0) tmp = Float64(Float64(-d) / t_0); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(Float64(Float64(h / l) * Float64(D * D)) * Float64(M / Float64(d / M)))) / t_0); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (d <= -4100.0)
tmp = -d / t_0;
elseif (d <= -4e-310)
tmp = (0.125 * (((h / l) * (D * D)) * (M / (d / M)))) / t_0;
else
tmp = d * sqrt(((1.0 / h) / l));
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_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4100.0], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(N[(N[(h / l), $MachinePrecision] * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(M / N[(d / M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;d \leq -4100:\\
\;\;\;\;\frac{-d}{t_0}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \left(\left(\frac{h}{\ell} \cdot \left(D \cdot D\right)\right) \cdot \frac{M}{\frac{d}{M}}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -4100Initial program 78.9%
metadata-eval78.9%
unpow1/278.9%
metadata-eval78.9%
unpow1/278.9%
*-commutative78.9%
associate-*l*78.9%
times-frac77.6%
metadata-eval77.6%
Simplified77.6%
Applied egg-rr43.5%
expm1-def48.8%
expm1-log1p69.9%
rem-log-exp66.0%
associate-*r/55.6%
associate-/l*66.0%
exp-diff66.0%
log-div66.0%
rem-log-exp66.0%
rem-log-exp69.9%
Simplified69.9%
Taylor expanded in d around -inf 81.1%
pow181.1%
*-commutative81.1%
associate-/r/81.1%
mul-1-neg81.1%
sqrt-div81.2%
metadata-eval81.2%
Applied egg-rr81.2%
unpow181.2%
distribute-rgt-neg-out81.2%
associate-*r/81.2%
*-rgt-identity81.2%
associate-*r/81.2%
distribute-neg-frac81.2%
Simplified81.2%
Taylor expanded in M around 0 63.9%
neg-mul-163.9%
Simplified63.9%
if -4100 < d < -3.999999999999988e-310Initial program 52.6%
metadata-eval52.6%
unpow1/252.6%
metadata-eval52.6%
unpow1/252.6%
*-commutative52.6%
associate-*l*52.6%
times-frac50.8%
metadata-eval50.8%
Simplified50.8%
Applied egg-rr6.7%
expm1-def13.7%
expm1-log1p36.2%
rem-log-exp29.8%
associate-*r/28.4%
associate-/l*28.6%
exp-diff28.6%
log-div28.6%
rem-log-exp28.6%
rem-log-exp35.0%
Simplified35.0%
Taylor expanded in d around -inf 58.4%
pow158.4%
*-commutative58.4%
associate-/r/58.4%
mul-1-neg58.4%
sqrt-div58.4%
metadata-eval58.4%
Applied egg-rr58.4%
unpow158.4%
distribute-rgt-neg-out58.4%
associate-*r/58.4%
*-rgt-identity58.4%
associate-*r/63.7%
distribute-neg-frac63.7%
Simplified63.7%
Taylor expanded in M around inf 45.0%
associate-*r/45.0%
*-commutative45.0%
associate-*r/45.0%
*-commutative45.0%
associate-*r*43.3%
*-commutative43.3%
unpow243.3%
*-commutative43.3%
times-frac41.8%
unpow241.8%
associate-/l*43.4%
associate-/r/40.1%
unpow240.1%
unpow240.1%
associate-/l*45.4%
Simplified45.4%
if -3.999999999999988e-310 < d Initial program 62.6%
metadata-eval62.6%
unpow1/262.6%
metadata-eval62.6%
unpow1/262.6%
*-commutative62.6%
associate-*l*62.6%
times-frac62.6%
metadata-eval62.6%
Simplified62.6%
Taylor expanded in d around inf 37.3%
*-commutative37.3%
*-commutative37.3%
associate-/r*38.0%
Simplified38.0%
Final simplification47.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
(let* ((t_0 (sqrt (* h l))))
(if (<= d -7700.0)
(/ (- d) t_0)
(if (<= d -4e-310)
(/ (* 0.125 (/ D (/ (* d l) (* M (* D (* h M)))))) t_0)
(* d (sqrt (/ (/ 1.0 h) l)))))))M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h * l));
double tmp;
if (d <= -7700.0) {
tmp = -d / t_0;
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / t_0;
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (d <= (-7700.0d0)) then
tmp = -d / t_0
else if (d <= (-4d-310)) then
tmp = (0.125d0 * (d_1 / ((d * l) / (m * (d_1 * (h * m)))))) / t_0
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 t_0 = Math.sqrt((h * l));
double tmp;
if (d <= -7700.0) {
tmp = -d / t_0;
} else if (d <= -4e-310) {
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / t_0;
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): t_0 = math.sqrt((h * l)) tmp = 0 if d <= -7700.0: tmp = -d / t_0 elif d <= -4e-310: tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / t_0 else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(h * l)) tmp = 0.0 if (d <= -7700.0) tmp = Float64(Float64(-d) / t_0); elseif (d <= -4e-310) tmp = Float64(Float64(0.125 * Float64(D / Float64(Float64(d * l) / Float64(M * Float64(D * Float64(h * M)))))) / t_0); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = sqrt((h * l));
tmp = 0.0;
if (d <= -7700.0)
tmp = -d / t_0;
elseif (d <= -4e-310)
tmp = (0.125 * (D / ((d * l) / (M * (D * (h * M)))))) / t_0;
else
tmp = d * sqrt(((1.0 / h) / l));
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_] := Block[{t$95$0 = N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -7700.0], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(0.125 * N[(D / N[(N[(d * l), $MachinePrecision] / N[(M * N[(D * N[(h * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;d \leq -7700:\\
\;\;\;\;\frac{-d}{t_0}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{0.125 \cdot \frac{D}{\frac{d \cdot \ell}{M \cdot \left(D \cdot \left(h \cdot M\right)\right)}}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -7700Initial program 78.9%
metadata-eval78.9%
unpow1/278.9%
metadata-eval78.9%
unpow1/278.9%
*-commutative78.9%
associate-*l*78.9%
times-frac77.6%
metadata-eval77.6%
Simplified77.6%
Applied egg-rr43.5%
expm1-def48.8%
expm1-log1p69.9%
rem-log-exp66.0%
associate-*r/55.6%
associate-/l*66.0%
exp-diff66.0%
log-div66.0%
rem-log-exp66.0%
rem-log-exp69.9%
Simplified69.9%
Taylor expanded in d around -inf 81.1%
pow181.1%
*-commutative81.1%
associate-/r/81.1%
mul-1-neg81.1%
sqrt-div81.2%
metadata-eval81.2%
Applied egg-rr81.2%
unpow181.2%
distribute-rgt-neg-out81.2%
associate-*r/81.2%
*-rgt-identity81.2%
associate-*r/81.2%
distribute-neg-frac81.2%
Simplified81.2%
Taylor expanded in M around 0 63.9%
neg-mul-163.9%
Simplified63.9%
if -7700 < d < -3.999999999999988e-310Initial program 52.6%
metadata-eval52.6%
unpow1/252.6%
metadata-eval52.6%
unpow1/252.6%
*-commutative52.6%
associate-*l*52.6%
times-frac50.8%
metadata-eval50.8%
Simplified50.8%
Applied egg-rr6.7%
expm1-def13.7%
expm1-log1p36.2%
rem-log-exp29.8%
associate-*r/28.4%
associate-/l*28.6%
exp-diff28.6%
log-div28.6%
rem-log-exp28.6%
rem-log-exp35.0%
Simplified35.0%
Taylor expanded in d around -inf 58.4%
pow158.4%
*-commutative58.4%
associate-/r/58.4%
mul-1-neg58.4%
sqrt-div58.4%
metadata-eval58.4%
Applied egg-rr58.4%
unpow158.4%
distribute-rgt-neg-out58.4%
associate-*r/58.4%
*-rgt-identity58.4%
associate-*r/63.7%
distribute-neg-frac63.7%
Simplified63.7%
Taylor expanded in M around inf 45.0%
associate-*r/45.0%
*-commutative45.0%
associate-*r/45.0%
unpow245.0%
associate-*r*49.2%
*-commutative49.2%
unpow249.2%
*-commutative49.2%
associate-/l*49.2%
*-commutative49.2%
associate-*r*57.4%
associate-*r*60.8%
*-commutative60.8%
Simplified60.8%
if -3.999999999999988e-310 < d Initial program 62.6%
metadata-eval62.6%
unpow1/262.6%
metadata-eval62.6%
unpow1/262.6%
*-commutative62.6%
associate-*l*62.6%
times-frac62.6%
metadata-eval62.6%
Simplified62.6%
Taylor expanded in d around inf 37.3%
*-commutative37.3%
*-commutative37.3%
associate-/r*38.0%
Simplified38.0%
Final simplification50.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.4e-238) (* d (- (sqrt (/ (/ 1.0 l) h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.4e-238) {
tmp = d * -sqrt(((1.0 / l) / h));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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.4d-238) then
tmp = d * -sqrt(((1.0d0 / l) / h))
else
tmp = d * sqrt(((1.0d0 / h) / l))
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.4e-238) {
tmp = d * -Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.4e-238: tmp = d * -math.sqrt(((1.0 / l) / h)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.4e-238) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); 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.4e-238)
tmp = d * -sqrt(((1.0 / l) / h));
else
tmp = d * sqrt(((1.0 / h) / l));
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.4e-238], N[(d * (-N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.4 \cdot 10^{-238}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < 2.3999999999999998e-238Initial program 66.4%
metadata-eval66.4%
unpow1/266.4%
metadata-eval66.4%
unpow1/266.4%
*-commutative66.4%
associate-*l*66.4%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr25.0%
expm1-def30.4%
expm1-log1p54.7%
rem-log-exp50.2%
associate-*r/43.8%
associate-/l*49.8%
exp-diff49.8%
log-div49.8%
rem-log-exp49.8%
rem-log-exp54.3%
Simplified54.3%
sqrt-div65.1%
Applied egg-rr65.1%
pow165.1%
associate-/r/65.1%
Applied egg-rr65.1%
Simplified66.7%
Taylor expanded in d around -inf 42.7%
associate-*r*42.7%
neg-mul-142.7%
associate-/r*43.2%
Simplified43.2%
if 2.3999999999999998e-238 < l Initial program 63.0%
metadata-eval63.0%
unpow1/263.0%
metadata-eval63.0%
unpow1/263.0%
*-commutative63.0%
associate-*l*63.0%
times-frac62.9%
metadata-eval62.9%
Simplified62.9%
Taylor expanded in d around inf 39.6%
*-commutative39.6%
*-commutative39.6%
associate-/r*40.4%
Simplified40.4%
Final simplification42.0%
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 9e-238) (/ (- d) (sqrt (* h l))) (* d (sqrt (/ (/ 1.0 h) l)))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 9e-238) {
tmp = -d / sqrt((h * l));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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 <= 9d-238) then
tmp = -d / sqrt((h * l))
else
tmp = d * sqrt(((1.0d0 / h) / l))
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 <= 9e-238) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 9e-238: tmp = -d / math.sqrt((h * l)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 9e-238) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); 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 <= 9e-238)
tmp = -d / sqrt((h * l));
else
tmp = d * sqrt(((1.0 / h) / l));
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, 9e-238], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 9 \cdot 10^{-238}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < 8.99999999999999992e-238Initial program 66.4%
metadata-eval66.4%
unpow1/266.4%
metadata-eval66.4%
unpow1/266.4%
*-commutative66.4%
associate-*l*66.4%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr25.0%
expm1-def30.4%
expm1-log1p54.7%
rem-log-exp50.2%
associate-*r/43.8%
associate-/l*49.8%
exp-diff49.8%
log-div49.8%
rem-log-exp49.8%
rem-log-exp54.3%
Simplified54.3%
Taylor expanded in d around -inf 63.7%
pow163.7%
*-commutative63.7%
associate-/r/63.7%
mul-1-neg63.7%
sqrt-div63.8%
metadata-eval63.8%
Applied egg-rr63.8%
unpow163.8%
distribute-rgt-neg-out63.8%
associate-*r/63.8%
*-rgt-identity63.8%
associate-*r/65.9%
distribute-neg-frac65.9%
Simplified65.9%
Taylor expanded in M around 0 42.8%
neg-mul-142.8%
Simplified42.8%
if 8.99999999999999992e-238 < l Initial program 63.0%
metadata-eval63.0%
unpow1/263.0%
metadata-eval63.0%
unpow1/263.0%
*-commutative63.0%
associate-*l*63.0%
times-frac62.9%
metadata-eval62.9%
Simplified62.9%
Taylor expanded in d around inf 39.6%
*-commutative39.6%
*-commutative39.6%
associate-/r*40.4%
Simplified40.4%
Final simplification41.8%
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.3e-238) (/ (- d) (sqrt (* h l))) (* d (pow (* h l) -0.5))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.3e-238) {
tmp = -d / sqrt((h * l));
} else {
tmp = d * pow((h * l), -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 (l <= 2.3d-238) then
tmp = -d / sqrt((h * l))
else
tmp = d * ((h * l) ** (-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 (l <= 2.3e-238) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.3e-238: tmp = -d / math.sqrt((h * l)) else: tmp = d * math.pow((h * l), -0.5) return tmp
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.3e-238) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * (Float64(h * l) ^ -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 (l <= 2.3e-238)
tmp = -d / sqrt((h * l));
else
tmp = d * ((h * l) ^ -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[l, 2.3e-238], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.3 \cdot 10^{-238}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 2.30000000000000005e-238Initial program 66.4%
metadata-eval66.4%
unpow1/266.4%
metadata-eval66.4%
unpow1/266.4%
*-commutative66.4%
associate-*l*66.4%
times-frac65.0%
metadata-eval65.0%
Simplified65.0%
Applied egg-rr25.0%
expm1-def30.4%
expm1-log1p54.7%
rem-log-exp50.2%
associate-*r/43.8%
associate-/l*49.8%
exp-diff49.8%
log-div49.8%
rem-log-exp49.8%
rem-log-exp54.3%
Simplified54.3%
Taylor expanded in d around -inf 63.7%
pow163.7%
*-commutative63.7%
associate-/r/63.7%
mul-1-neg63.7%
sqrt-div63.8%
metadata-eval63.8%
Applied egg-rr63.8%
unpow163.8%
distribute-rgt-neg-out63.8%
associate-*r/63.8%
*-rgt-identity63.8%
associate-*r/65.9%
distribute-neg-frac65.9%
Simplified65.9%
Taylor expanded in M around 0 42.8%
neg-mul-142.8%
Simplified42.8%
if 2.30000000000000005e-238 < l Initial program 63.0%
metadata-eval63.0%
unpow1/263.0%
metadata-eval63.0%
unpow1/263.0%
*-commutative63.0%
associate-*l*63.0%
times-frac62.9%
metadata-eval62.9%
Simplified62.9%
Applied egg-rr12.4%
expm1-def28.9%
expm1-log1p53.4%
rem-log-exp47.2%
associate-*r/42.2%
associate-/l*46.4%
exp-diff46.4%
log-div46.4%
rem-log-exp46.4%
rem-log-exp52.6%
Simplified52.6%
sqrt-div62.2%
Applied egg-rr62.2%
Taylor expanded in d around inf 39.6%
*-commutative39.6%
unpow-139.6%
sqr-pow39.6%
rem-sqrt-square39.6%
sqr-pow39.5%
fabs-sqr39.5%
sqr-pow39.6%
*-commutative39.6%
metadata-eval39.6%
Simplified39.6%
Final simplification41.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 (* d (pow (* h l) -0.5)))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d * pow((h * l), -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 * ((h * l) ** (-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((h * l), -0.5);
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d * math.pow((h * l), -0.5)
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d * (Float64(h * l) ^ -0.5)) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d * ((h * l) ^ -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[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 65.0%
metadata-eval65.0%
unpow1/265.0%
metadata-eval65.0%
unpow1/265.0%
*-commutative65.0%
associate-*l*65.0%
times-frac64.1%
metadata-eval64.1%
Simplified64.1%
Applied egg-rr19.6%
expm1-def29.8%
expm1-log1p54.2%
rem-log-exp48.9%
associate-*r/43.1%
associate-/l*48.3%
exp-diff48.3%
log-div48.3%
rem-log-exp48.3%
rem-log-exp53.6%
Simplified53.6%
sqrt-div63.9%
Applied egg-rr63.9%
Taylor expanded in d around inf 21.0%
*-commutative21.0%
unpow-121.0%
sqr-pow21.0%
rem-sqrt-square21.0%
sqr-pow20.9%
fabs-sqr20.9%
sqr-pow21.0%
*-commutative21.0%
metadata-eval21.0%
Simplified21.0%
Final simplification21.0%
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 (sqrt (* h l))))
M = abs(M);
assert(M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((h * l));
}
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 / sqrt((h * l))
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.sqrt((h * l));
}
M = abs(M) [M, D] = sort([M, D]) def code(d, h, l, M, D): return d / math.sqrt((h * l))
M = abs(M) M, D = sort([M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(h * l))) end
M = abs(M)
M, D = num2cell(sort([M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((h * l));
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[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M = |M|\\
[M, D] = \mathsf{sort}([M, D])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 65.0%
metadata-eval65.0%
unpow1/265.0%
metadata-eval65.0%
unpow1/265.0%
*-commutative65.0%
associate-*l*65.0%
times-frac64.1%
metadata-eval64.1%
Simplified64.1%
associate-*r*64.1%
frac-times65.0%
*-commutative65.0%
metadata-eval65.0%
associate-*r/67.4%
metadata-eval67.4%
*-commutative67.4%
frac-times67.0%
*-commutative67.0%
div-inv67.0%
metadata-eval67.0%
Applied egg-rr67.0%
Taylor expanded in d around inf 21.0%
*-commutative21.0%
associate-/r*21.3%
Simplified21.3%
associate-/r*21.0%
add-cbrt-cube15.4%
pow115.4%
add-cbrt-cube21.0%
sqrt-div21.0%
metadata-eval21.0%
Applied egg-rr21.0%
unpow121.0%
associate-*r/21.0%
*-rgt-identity21.0%
*-commutative21.0%
Simplified21.0%
Final simplification21.0%
herbie shell --seed 2023242
(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)))))