
(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 30 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}
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* h (* 0.125 (/ (pow (* M (/ D_m d)) 2.0) l)))))
(t_1 (sqrt (- d))))
(if (<= h -1.2e+65)
(* (/ t_1 (sqrt (- h))) (* (sqrt (/ d l)) t_0))
(if (<= h -5e-310)
(*
(/ 1.0 (/ (sqrt (- l)) t_1))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)) l))))
(* (/ (sqrt d) (sqrt h)) (* t_0 (/ (sqrt d) (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (h * (0.125 * (pow((M * (D_m / d)), 2.0) / l)));
double t_1 = sqrt(-d);
double tmp;
if (h <= -1.2e+65) {
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
} else if (h <= -5e-310) {
tmp = (1.0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / sqrt(l)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - (h * (0.125d0 * (((m * (d_m / d)) ** 2.0d0) / l)))
t_1 = sqrt(-d)
if (h <= (-1.2d+65)) then
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0)
else if (h <= (-5d-310)) then
tmp = (1.0d0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0)) / l)))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / sqrt(l)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (h * (0.125 * (Math.pow((M * (D_m / d)), 2.0) / l)));
double t_1 = Math.sqrt(-d);
double tmp;
if (h <= -1.2e+65) {
tmp = (t_1 / Math.sqrt(-h)) * (Math.sqrt((d / l)) * t_0);
} else if (h <= -5e-310) {
tmp = (1.0 / (Math.sqrt(-l) / t_1)) * (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0)) / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (Math.sqrt(d) / Math.sqrt(l)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 - (h * (0.125 * (math.pow((M * (D_m / d)), 2.0) / l))) t_1 = math.sqrt(-d) tmp = 0 if h <= -1.2e+65: tmp = (t_1 / math.sqrt(-h)) * (math.sqrt((d / l)) * t_0) elif h <= -5e-310: tmp = (1.0 / (math.sqrt(-l) / t_1)) * (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (math.sqrt(d) / math.sqrt(l))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(h * Float64(0.125 * Float64((Float64(M * Float64(D_m / d)) ^ 2.0) / l)))) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -1.2e+65) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * t_0)); elseif (h <= -5e-310) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(-l)) / t_1)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(sqrt(d) / sqrt(l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 - (h * (0.125 * (((M * (D_m / d)) ^ 2.0) / l)));
t_1 = sqrt(-d);
tmp = 0.0;
if (h <= -1.2e+65)
tmp = (t_1 / sqrt(-h)) * (sqrt((d / l)) * t_0);
elseif (h <= -5e-310)
tmp = (1.0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0)) / l)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (sqrt(d) / sqrt(l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(h * N[(0.125 * N[(N[Power[N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -1.2e+65], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(1.0 / N[(N[Sqrt[(-l)], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - h \cdot \left(0.125 \cdot \frac{{\left(M \cdot \frac{D\_m}{d}\right)}^{2}}{\ell}\right)\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -1.2 \cdot 10^{+65}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-\ell}}{t\_1}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if h < -1.2000000000000001e65Initial program 55.0%
Simplified55.1%
Taylor expanded in h around -inf 31.7%
associate-*r*31.7%
neg-mul-131.7%
sub-neg31.7%
distribute-lft-in31.7%
Simplified60.6%
frac-2neg60.6%
sqrt-div81.6%
Applied egg-rr81.6%
if -1.2000000000000001e65 < h < -4.999999999999985e-310Initial program 73.0%
Simplified71.6%
associate-*l/71.7%
*-commutative71.7%
associate-/l/71.7%
Applied egg-rr71.7%
associate-*r*71.7%
*-commutative71.7%
Simplified71.7%
clear-num71.7%
sqrt-div72.9%
metadata-eval72.9%
Applied egg-rr72.9%
frac-2neg72.9%
sqrt-div84.4%
Applied egg-rr84.4%
if -4.999999999999985e-310 < h Initial program 72.6%
Simplified71.0%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified73.5%
sqrt-div82.0%
Applied egg-rr82.0%
sqrt-div87.8%
Applied egg-rr87.8%
Final simplification85.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D_m) (* d 2.0)) 2.0)))))
(t_1 (pow (/ d h) 0.5)))
(if (<= (* (* t_1 (pow (/ d l) 0.5)) t_0) 5e+266)
(* t_0 (* t_1 (pow (* d (/ 1.0 l)) 0.5)))
(fabs (/ d (sqrt (* h l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - ((h / l) * (0.5 * pow(((M * D_m) / (d * 2.0)), 2.0)));
double t_1 = pow((d / h), 0.5);
double tmp;
if (((t_1 * pow((d / l), 0.5)) * t_0) <= 5e+266) {
tmp = t_0 * (t_1 * pow((d * (1.0 / l)), 0.5));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - ((h / l) * (0.5d0 * (((m * d_m) / (d * 2.0d0)) ** 2.0d0)))
t_1 = (d / h) ** 0.5d0
if (((t_1 * ((d / l) ** 0.5d0)) * t_0) <= 5d+266) then
tmp = t_0 * (t_1 * ((d * (1.0d0 / l)) ** 0.5d0))
else
tmp = abs((d / sqrt((h * l))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - ((h / l) * (0.5 * Math.pow(((M * D_m) / (d * 2.0)), 2.0)));
double t_1 = Math.pow((d / h), 0.5);
double tmp;
if (((t_1 * Math.pow((d / l), 0.5)) * t_0) <= 5e+266) {
tmp = t_0 * (t_1 * Math.pow((d * (1.0 / l)), 0.5));
} else {
tmp = Math.abs((d / Math.sqrt((h * l))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 - ((h / l) * (0.5 * math.pow(((M * D_m) / (d * 2.0)), 2.0))) t_1 = math.pow((d / h), 0.5) tmp = 0 if ((t_1 * math.pow((d / l), 0.5)) * t_0) <= 5e+266: tmp = t_0 * (t_1 * math.pow((d * (1.0 / l)), 0.5)) else: tmp = math.fabs((d / math.sqrt((h * l)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0)))) t_1 = Float64(d / h) ^ 0.5 tmp = 0.0 if (Float64(Float64(t_1 * (Float64(d / l) ^ 0.5)) * t_0) <= 5e+266) tmp = Float64(t_0 * Float64(t_1 * (Float64(d * Float64(1.0 / l)) ^ 0.5))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 - ((h / l) * (0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0)));
t_1 = (d / h) ^ 0.5;
tmp = 0.0;
if (((t_1 * ((d / l) ^ 0.5)) * t_0) <= 5e+266)
tmp = t_0 * (t_1 * ((d * (1.0 / l)) ^ 0.5));
else
tmp = abs((d / sqrt((h * l))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], 5e+266], N[(t$95$0 * N[(t$95$1 * N[Power[N[(d * N[(1.0 / l), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}\right)\\
t_1 := {\left(\frac{d}{h}\right)}^{0.5}\\
\mathbf{if}\;\left(t\_1 \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot t\_0 \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot {\left(d \cdot \frac{1}{\ell}\right)}^{0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999999e266Initial program 87.0%
div-inv87.0%
Applied egg-rr87.0%
if 4.9999999999999999e266 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 22.4%
Simplified22.4%
Taylor expanded in d around inf 32.9%
*-un-lft-identity32.9%
pow1/232.9%
inv-pow32.9%
pow-pow32.9%
metadata-eval32.9%
Applied egg-rr32.9%
*-lft-identity32.9%
Simplified32.9%
metadata-eval32.9%
metadata-eval32.9%
pow-pow32.9%
inv-pow32.9%
pow-pow28.0%
add-sqr-sqrt27.6%
sqrt-unprod33.7%
swap-sqr32.5%
unpow232.5%
pow-pow32.6%
pow-pow34.3%
pow-sqr34.3%
metadata-eval34.3%
metadata-eval34.3%
pow134.3%
div-inv34.3%
associate-/r*29.0%
add-sqr-sqrt29.0%
Applied egg-rr54.9%
Final simplification78.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) 0.5) (pow (/ d l) 0.5))
(- 1.0 (* (/ h l) (* 0.5 (pow (/ (* M D_m) (* d 2.0)) 2.0)))))))
(if (<= t_0 5e+266) t_0 (fabs (/ d (sqrt (* h l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (pow((d / h), 0.5) * pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * pow(((M * D_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 5e+266) {
tmp = t_0;
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = (((d / h) ** 0.5d0) * ((d / l) ** 0.5d0)) * (1.0d0 - ((h / l) * (0.5d0 * (((m * d_m) / (d * 2.0d0)) ** 2.0d0))))
if (t_0 <= 5d+266) then
tmp = t_0
else
tmp = abs((d / sqrt((h * l))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = (Math.pow((d / h), 0.5) * Math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * Math.pow(((M * D_m) / (d * 2.0)), 2.0))));
double tmp;
if (t_0 <= 5e+266) {
tmp = t_0;
} else {
tmp = Math.abs((d / Math.sqrt((h * l))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = (math.pow((d / h), 0.5) * math.pow((d / l), 0.5)) * (1.0 - ((h / l) * (0.5 * math.pow(((M * D_m) / (d * 2.0)), 2.0)))) tmp = 0 if t_0 <= 5e+266: tmp = t_0 else: tmp = math.fabs((d / math.sqrt((h * l)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64((Float64(d / h) ^ 0.5) * (Float64(d / l) ^ 0.5)) * Float64(1.0 - Float64(Float64(h / l) * Float64(0.5 * (Float64(Float64(M * D_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (t_0 <= 5e+266) tmp = t_0; else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (((d / h) ^ 0.5) * ((d / l) ^ 0.5)) * (1.0 - ((h / l) * (0.5 * (((M * D_m) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (t_0 <= 5e+266)
tmp = t_0;
else
tmp = abs((d / sqrt((h * l))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], 0.5], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(0.5 * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+266], t$95$0, N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{0.5} \cdot {\left(\frac{d}{\ell}\right)}^{0.5}\right) \cdot \left(1 - \frac{h}{\ell} \cdot \left(0.5 \cdot {\left(\frac{M \cdot D\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+266}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999999e266Initial program 87.0%
if 4.9999999999999999e266 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 22.4%
Simplified22.4%
Taylor expanded in d around inf 32.9%
*-un-lft-identity32.9%
pow1/232.9%
inv-pow32.9%
pow-pow32.9%
metadata-eval32.9%
Applied egg-rr32.9%
*-lft-identity32.9%
Simplified32.9%
metadata-eval32.9%
metadata-eval32.9%
pow-pow32.9%
inv-pow32.9%
pow-pow28.0%
add-sqr-sqrt27.6%
sqrt-unprod33.7%
swap-sqr32.5%
unpow232.5%
pow-pow32.6%
pow-pow34.3%
pow-sqr34.3%
metadata-eval34.3%
metadata-eval34.3%
pow134.3%
div-inv34.3%
associate-/r*29.0%
add-sqr-sqrt29.0%
Applied egg-rr54.9%
Final simplification77.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (- d)))
(t_2 (/ t_1 (sqrt (- h))))
(t_3 (* M (/ D_m d))))
(if (<= h -4.6e+67)
(* t_2 (* t_0 (- 1.0 (* h (* 0.125 (/ (pow t_3 2.0) l))))))
(if (<= h -1.06e-162)
(*
(sqrt (/ d h))
(*
(/ t_1 (sqrt (- l)))
(+ 1.0 (* h (* -0.125 (/ (pow (/ (* M D_m) d) 2.0) l))))))
(if (<= h -5e-310)
(*
t_0
(*
t_2
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M 2.0) d)) 2.0))))))
(*
(/ (sqrt d) (sqrt h))
(* t_0 (- 1.0 (* h (* 0.125 (* t_3 (/ t_3 l))))))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d);
double t_2 = t_1 / sqrt(-h);
double t_3 = M * (D_m / d);
double tmp;
if (h <= -4.6e+67) {
tmp = t_2 * (t_0 * (1.0 - (h * (0.125 * (pow(t_3, 2.0) / l)))));
} else if (h <= -1.06e-162) {
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + (h * (-0.125 * (pow(((M * D_m) / d), 2.0) / l)))));
} else if (h <= -5e-310) {
tmp = t_0 * (t_2 * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M / 2.0) / d)), 2.0)))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d)
t_2 = t_1 / sqrt(-h)
t_3 = m * (d_m / d)
if (h <= (-4.6d+67)) then
tmp = t_2 * (t_0 * (1.0d0 - (h * (0.125d0 * ((t_3 ** 2.0d0) / l)))))
else if (h <= (-1.06d-162)) then
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * ((((m * d_m) / d) ** 2.0d0) / l)))))
else if (h <= (-5d-310)) then
tmp = t_0 * (t_2 * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m / 2.0d0) / d)) ** 2.0d0)))))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (h * (0.125d0 * (t_3 * (t_3 / l))))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt(-d);
double t_2 = t_1 / Math.sqrt(-h);
double t_3 = M * (D_m / d);
double tmp;
if (h <= -4.6e+67) {
tmp = t_2 * (t_0 * (1.0 - (h * (0.125 * (Math.pow(t_3, 2.0) / l)))));
} else if (h <= -1.06e-162) {
tmp = Math.sqrt((d / h)) * ((t_1 / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (Math.pow(((M * D_m) / d), 2.0) / l)))));
} else if (h <= -5e-310) {
tmp = t_0 * (t_2 * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M / 2.0) / d)), 2.0)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt(-d) t_2 = t_1 / math.sqrt(-h) t_3 = M * (D_m / d) tmp = 0 if h <= -4.6e+67: tmp = t_2 * (t_0 * (1.0 - (h * (0.125 * (math.pow(t_3, 2.0) / l))))) elif h <= -1.06e-162: tmp = math.sqrt((d / h)) * ((t_1 / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (math.pow(((M * D_m) / d), 2.0) / l))))) elif h <= -5e-310: tmp = t_0 * (t_2 * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M / 2.0) / d)), 2.0))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l)))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(-d)) t_2 = Float64(t_1 / sqrt(Float64(-h))) t_3 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (h <= -4.6e+67) tmp = Float64(t_2 * Float64(t_0 * Float64(1.0 - Float64(h * Float64(0.125 * Float64((t_3 ^ 2.0) / l)))))); elseif (h <= -1.06e-162) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_1 / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64((Float64(Float64(M * D_m) / d) ^ 2.0) / l)))))); elseif (h <= -5e-310) tmp = Float64(t_0 * Float64(t_2 * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M / 2.0) / d)) ^ 2.0)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_3 * Float64(t_3 / l))))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt(-d);
t_2 = t_1 / sqrt(-h);
t_3 = M * (D_m / d);
tmp = 0.0;
if (h <= -4.6e+67)
tmp = t_2 * (t_0 * (1.0 - (h * (0.125 * ((t_3 ^ 2.0) / l)))));
elseif (h <= -1.06e-162)
tmp = sqrt((d / h)) * ((t_1 / sqrt(-l)) * (1.0 + (h * (-0.125 * ((((M * D_m) / d) ^ 2.0) / l)))));
elseif (h <= -5e-310)
tmp = t_0 * (t_2 * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M / 2.0) / d)) ^ 2.0)))));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -4.6e+67], N[(t$95$2 * N[(t$95$0 * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[t$95$3, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1.06e-162], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(t$95$0 * N[(t$95$2 * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(h * N[(0.125 * N[(t$95$3 * N[(t$95$3 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{-d}\\
t_2 := \frac{t\_1}{\sqrt{-h}}\\
t_3 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;h \leq -4.6 \cdot 10^{+67}:\\
\;\;\;\;t\_2 \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{t\_3}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;h \leq -1.06 \cdot 10^{-162}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \frac{{\left(\frac{M \cdot D\_m}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(t\_2 \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_3 \cdot \frac{t\_3}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < -4.5999999999999997e67Initial program 55.0%
Simplified55.1%
Taylor expanded in h around -inf 31.7%
associate-*r*31.7%
neg-mul-131.7%
sub-neg31.7%
distribute-lft-in31.7%
Simplified60.6%
frac-2neg60.6%
sqrt-div81.6%
Applied egg-rr81.6%
if -4.5999999999999997e67 < h < -1.06000000000000003e-162Initial program 80.0%
Simplified80.0%
Taylor expanded in h around -inf 50.2%
associate-*r*50.2%
neg-mul-150.2%
sub-neg50.2%
distribute-lft-in50.2%
Simplified80.0%
pow180.0%
associate-*r/80.0%
Applied egg-rr80.0%
unpow180.0%
distribute-lft-neg-in80.0%
distribute-rgt-neg-in80.0%
associate-/l*80.0%
distribute-lft-neg-in80.0%
metadata-eval80.0%
associate-*r/80.0%
*-commutative80.0%
Simplified80.0%
frac-2neg80.0%
sqrt-div95.5%
Applied egg-rr95.5%
if -1.06000000000000003e-162 < h < -4.999999999999985e-310Initial program 60.3%
Simplified56.3%
frac-2neg48.5%
sqrt-div71.6%
Applied egg-rr79.5%
if -4.999999999999985e-310 < h Initial program 72.6%
Simplified71.0%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified73.5%
sqrt-div82.0%
Applied egg-rr82.0%
unpow282.0%
associate-/l*83.5%
Applied egg-rr83.5%
Final simplification84.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l))) (t_1 (sqrt (- d))) (t_2 (* M (/ D_m d))))
(if (<= h -1.02e+67)
(*
(/ t_1 (sqrt (- h)))
(* t_0 (- 1.0 (* h (* 0.125 (/ (pow t_2 2.0) l))))))
(if (<= h -5e-310)
(*
(/ 1.0 (/ (sqrt (- l)) t_1))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)) l))))
(*
(/ (sqrt d) (sqrt h))
(* t_0 (- 1.0 (* h (* 0.125 (* t_2 (/ t_2 l)))))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt(-d);
double t_2 = M * (D_m / d);
double tmp;
if (h <= -1.02e+67) {
tmp = (t_1 / sqrt(-h)) * (t_0 * (1.0 - (h * (0.125 * (pow(t_2, 2.0) / l)))));
} else if (h <= -5e-310) {
tmp = (1.0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0)) / l)));
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt(-d)
t_2 = m * (d_m / d)
if (h <= (-1.02d+67)) then
tmp = (t_1 / sqrt(-h)) * (t_0 * (1.0d0 - (h * (0.125d0 * ((t_2 ** 2.0d0) / l)))))
else if (h <= (-5d-310)) then
tmp = (1.0d0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0)) / l)))
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0d0 - (h * (0.125d0 * (t_2 * (t_2 / l))))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt(-d);
double t_2 = M * (D_m / d);
double tmp;
if (h <= -1.02e+67) {
tmp = (t_1 / Math.sqrt(-h)) * (t_0 * (1.0 - (h * (0.125 * (Math.pow(t_2, 2.0) / l)))));
} else if (h <= -5e-310) {
tmp = (1.0 / (Math.sqrt(-l) / t_1)) * (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0)) / l)));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt(-d) t_2 = M * (D_m / d) tmp = 0 if h <= -1.02e+67: tmp = (t_1 / math.sqrt(-h)) * (t_0 * (1.0 - (h * (0.125 * (math.pow(t_2, 2.0) / l))))) elif h <= -5e-310: tmp = (1.0 / (math.sqrt(-l) / t_1)) * (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_2 * (t_2 / l)))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(-d)) t_2 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (h <= -1.02e+67) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(t_0 * Float64(1.0 - Float64(h * Float64(0.125 * Float64((t_2 ^ 2.0) / l)))))); elseif (h <= -5e-310) tmp = Float64(Float64(1.0 / Float64(sqrt(Float64(-l)) / t_1)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l)))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_0 * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_2 * Float64(t_2 / l))))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt(-d);
t_2 = M * (D_m / d);
tmp = 0.0;
if (h <= -1.02e+67)
tmp = (t_1 / sqrt(-h)) * (t_0 * (1.0 - (h * (0.125 * ((t_2 ^ 2.0) / l)))));
elseif (h <= -5e-310)
tmp = (1.0 / (sqrt(-l) / t_1)) * (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0)) / l)));
else
tmp = (sqrt(d) / sqrt(h)) * (t_0 * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.02e+67], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(h * N[(0.125 * N[(N[Power[t$95$2, 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(1.0 / N[(N[Sqrt[(-l)], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(1.0 - N[(h * N[(0.125 * N[(t$95$2 * N[(t$95$2 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{-d}\\
t_2 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;h \leq -1.02 \cdot 10^{+67}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \frac{{t\_2}^{2}}{\ell}\right)\right)\right)\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{-\ell}}{t\_1}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_0 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_2 \cdot \frac{t\_2}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if h < -1.02000000000000002e67Initial program 55.0%
Simplified55.1%
Taylor expanded in h around -inf 31.7%
associate-*r*31.7%
neg-mul-131.7%
sub-neg31.7%
distribute-lft-in31.7%
Simplified60.6%
frac-2neg60.6%
sqrt-div81.6%
Applied egg-rr81.6%
if -1.02000000000000002e67 < h < -4.999999999999985e-310Initial program 73.0%
Simplified71.6%
associate-*l/71.7%
*-commutative71.7%
associate-/l/71.7%
Applied egg-rr71.7%
associate-*r*71.7%
*-commutative71.7%
Simplified71.7%
clear-num71.7%
sqrt-div72.9%
metadata-eval72.9%
Applied egg-rr72.9%
frac-2neg72.9%
sqrt-div84.4%
Applied egg-rr84.4%
if -4.999999999999985e-310 < h Initial program 72.6%
Simplified71.0%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified73.5%
sqrt-div82.0%
Applied egg-rr82.0%
unpow282.0%
associate-/l*83.5%
Applied egg-rr83.5%
Final simplification83.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (sqrt (/ d l)))
(t_2 (+ 1.0 (* h (* -0.125 (/ (pow (/ (* M D_m) d) 2.0) l)))))
(t_3 (* M (/ D_m d))))
(if (<= l -2.2e+111)
(* (sqrt (/ d h)) (* (/ t_0 (sqrt (- l))) t_2))
(if (<= l -5e-310)
(* (/ t_0 (sqrt (- h))) (* t_1 t_2))
(*
(/ (sqrt d) (sqrt h))
(* t_1 (- 1.0 (* h (* 0.125 (* t_3 (/ t_3 l)))))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double t_1 = sqrt((d / l));
double t_2 = 1.0 + (h * (-0.125 * (pow(((M * D_m) / d), 2.0) / l)));
double t_3 = M * (D_m / d);
double tmp;
if (l <= -2.2e+111) {
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
} else if (l <= -5e-310) {
tmp = (t_0 / sqrt(-h)) * (t_1 * t_2);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt(-d)
t_1 = sqrt((d / l))
t_2 = 1.0d0 + (h * ((-0.125d0) * ((((m * d_m) / d) ** 2.0d0) / l)))
t_3 = m * (d_m / d)
if (l <= (-2.2d+111)) then
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2)
else if (l <= (-5d-310)) then
tmp = (t_0 / sqrt(-h)) * (t_1 * t_2)
else
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0d0 - (h * (0.125d0 * (t_3 * (t_3 / l))))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt(-d);
double t_1 = Math.sqrt((d / l));
double t_2 = 1.0 + (h * (-0.125 * (Math.pow(((M * D_m) / d), 2.0) / l)));
double t_3 = M * (D_m / d);
double tmp;
if (l <= -2.2e+111) {
tmp = Math.sqrt((d / h)) * ((t_0 / Math.sqrt(-l)) * t_2);
} else if (l <= -5e-310) {
tmp = (t_0 / Math.sqrt(-h)) * (t_1 * t_2);
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (t_1 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt(-d) t_1 = math.sqrt((d / l)) t_2 = 1.0 + (h * (-0.125 * (math.pow(((M * D_m) / d), 2.0) / l))) t_3 = M * (D_m / d) tmp = 0 if l <= -2.2e+111: tmp = math.sqrt((d / h)) * ((t_0 / math.sqrt(-l)) * t_2) elif l <= -5e-310: tmp = (t_0 / math.sqrt(-h)) * (t_1 * t_2) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (t_1 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l)))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(1.0 + Float64(h * Float64(-0.125 * Float64((Float64(Float64(M * D_m) / d) ^ 2.0) / l)))) t_3 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (l <= -2.2e+111) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_0 / sqrt(Float64(-l))) * t_2)); elseif (l <= -5e-310) tmp = Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(t_1 * t_2)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_1 * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_3 * Float64(t_3 / l))))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt(-d);
t_1 = sqrt((d / l));
t_2 = 1.0 + (h * (-0.125 * ((((M * D_m) / d) ^ 2.0) / l)));
t_3 = M * (D_m / d);
tmp = 0.0;
if (l <= -2.2e+111)
tmp = sqrt((d / h)) * ((t_0 / sqrt(-l)) * t_2);
elseif (l <= -5e-310)
tmp = (t_0 / sqrt(-h)) * (t_1 * t_2);
else
tmp = (sqrt(d) / sqrt(h)) * (t_1 * (1.0 - (h * (0.125 * (t_3 * (t_3 / l))))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(h * N[(-0.125 * N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.2e+111], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(1.0 - N[(h * N[(0.125 * N[(t$95$3 * N[(t$95$3 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := 1 + h \cdot \left(-0.125 \cdot \frac{{\left(\frac{M \cdot D\_m}{d}\right)}^{2}}{\ell}\right)\\
t_3 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;\ell \leq -2.2 \cdot 10^{+111}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_0}{\sqrt{-\ell}} \cdot t\_2\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-h}} \cdot \left(t\_1 \cdot t\_2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_1 \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_3 \cdot \frac{t\_3}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.19999999999999999e111Initial program 57.8%
Simplified57.9%
Taylor expanded in h around -inf 26.5%
associate-*r*26.5%
neg-mul-126.5%
sub-neg26.5%
distribute-lft-in26.5%
Simplified57.9%
pow157.9%
associate-*r/57.9%
Applied egg-rr57.9%
unpow157.9%
distribute-lft-neg-in57.9%
distribute-rgt-neg-in57.9%
associate-/l*57.9%
distribute-lft-neg-in57.9%
metadata-eval57.9%
associate-*r/57.9%
*-commutative57.9%
Simplified57.9%
frac-2neg57.9%
sqrt-div76.4%
Applied egg-rr76.4%
if -2.19999999999999999e111 < l < -4.999999999999985e-310Initial program 67.8%
Simplified66.7%
Taylor expanded in h around -inf 41.7%
associate-*r*41.7%
neg-mul-141.7%
sub-neg41.7%
distribute-lft-in41.7%
Simplified68.2%
pow168.2%
associate-*r/68.2%
Applied egg-rr68.2%
unpow168.2%
distribute-lft-neg-in68.2%
distribute-rgt-neg-in68.2%
associate-/l*68.2%
distribute-lft-neg-in68.2%
metadata-eval68.2%
associate-*r/69.2%
*-commutative69.2%
Simplified69.2%
frac-2neg68.2%
sqrt-div85.7%
Applied egg-rr86.0%
if -4.999999999999985e-310 < l Initial program 72.6%
Simplified71.0%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified73.5%
sqrt-div82.0%
Applied egg-rr82.0%
unpow282.0%
associate-/l*83.5%
Applied egg-rr83.5%
Final simplification83.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* M (/ D_m d))))
(if (<= l -2.4e-301)
(*
(sqrt (/ d h))
(*
(/ (sqrt (- d)) (sqrt (- l)))
(+ 1.0 (* h (* -0.125 (/ (pow (/ (* M D_m) d) 2.0) l))))))
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l))))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = M * (D_m / d);
double tmp;
if (l <= -2.4e-301) {
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * (pow(((M * D_m) / d), 2.0) / l)))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = m * (d_m / d)
if (l <= (-2.4d-301)) then
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0d0 + (h * ((-0.125d0) * ((((m * d_m) / d) ** 2.0d0) / l)))))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l))))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = M * (D_m / d);
double tmp;
if (l <= -2.4e-301) {
tmp = Math.sqrt((d / h)) * ((Math.sqrt(-d) / Math.sqrt(-l)) * (1.0 + (h * (-0.125 * (Math.pow(((M * D_m) / d), 2.0) / l)))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = M * (D_m / d) tmp = 0 if l <= -2.4e-301: tmp = math.sqrt((d / h)) * ((math.sqrt(-d) / math.sqrt(-l)) * (1.0 + (h * (-0.125 * (math.pow(((M * D_m) / d), 2.0) / l))))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (l <= -2.4e-301) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64((Float64(Float64(M * D_m) / d) ^ 2.0) / l)))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l))))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = M * (D_m / d);
tmp = 0.0;
if (l <= -2.4e-301)
tmp = sqrt((d / h)) * ((sqrt(-d) / sqrt(-l)) * (1.0 + (h * (-0.125 * ((((M * D_m) / d) ^ 2.0) / l)))));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.4e-301], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-301}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \frac{{\left(\frac{M \cdot D\_m}{d}\right)}^{2}}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if l < -2.39999999999999991e-301Initial program 65.4%
Simplified64.6%
Taylor expanded in h around -inf 37.5%
associate-*r*37.5%
neg-mul-137.5%
sub-neg37.5%
distribute-lft-in37.5%
Simplified65.6%
pow165.6%
associate-*r/65.6%
Applied egg-rr65.6%
unpow165.6%
distribute-lft-neg-in65.6%
distribute-rgt-neg-in65.6%
associate-/l*65.6%
distribute-lft-neg-in65.6%
metadata-eval65.6%
associate-*r/66.4%
*-commutative66.4%
Simplified66.4%
frac-2neg66.4%
sqrt-div75.0%
Applied egg-rr75.0%
if -2.39999999999999991e-301 < l Initial program 72.1%
Simplified70.5%
Taylor expanded in h around -inf 48.2%
associate-*r*48.2%
neg-mul-148.2%
sub-neg48.2%
distribute-lft-in48.2%
Simplified72.9%
sqrt-div81.4%
Applied egg-rr81.4%
unpow281.4%
associate-/l*82.9%
Applied egg-rr82.9%
Final simplification79.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(t_1 (sqrt (/ d h)))
(t_2 (* M (/ D_m d))))
(if (<= d -1.3e-128)
(*
(* t_1 (+ 1.0 (/ (* (* h -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)) l)))
(/ 1.0 (sqrt (/ l d))))
(if (<= d 2.5e-275)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= d 1.4e+33)
(*
t_1
(* (/ (sqrt d) (sqrt l)) (- 1.0 (* h (* 0.125 (* t_2 (/ t_2 l)))))))
(* (- 1.0 t_0) (* (pow h -0.5) (* d (pow l -0.5)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double t_1 = sqrt((d / h));
double t_2 = M * (D_m / d);
double tmp;
if (d <= -1.3e-128) {
tmp = (t_1 * (1.0 + (((h * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / sqrt((l / d)));
} else if (d <= 2.5e-275) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 1.4e+33) {
tmp = t_1 * ((sqrt(d) / sqrt(l)) * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
} else {
tmp = (1.0 - t_0) * (pow(h, -0.5) * (d * pow(l, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
t_1 = sqrt((d / h))
t_2 = m * (d_m / d)
if (d <= (-1.3d-128)) then
tmp = (t_1 * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0)) / l))) * (1.0d0 / sqrt((l / d)))
else if (d <= 2.5d-275) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (d <= 1.4d+33) then
tmp = t_1 * ((sqrt(d) / sqrt(l)) * (1.0d0 - (h * (0.125d0 * (t_2 * (t_2 / l))))))
else
tmp = (1.0d0 - t_0) * ((h ** (-0.5d0)) * (d * (l ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double t_1 = Math.sqrt((d / h));
double t_2 = M * (D_m / d);
double tmp;
if (d <= -1.3e-128) {
tmp = (t_1 * (1.0 + (((h * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / Math.sqrt((l / d)));
} else if (d <= 2.5e-275) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (d <= 1.4e+33) {
tmp = t_1 * ((Math.sqrt(d) / Math.sqrt(l)) * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
} else {
tmp = (1.0 - t_0) * (Math.pow(h, -0.5) * (d * Math.pow(l, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) t_1 = math.sqrt((d / h)) t_2 = M * (D_m / d) tmp = 0 if d <= -1.3e-128: tmp = (t_1 * (1.0 + (((h * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / math.sqrt((l / d))) elif d <= 2.5e-275: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif d <= 1.4e+33: tmp = t_1 * ((math.sqrt(d) / math.sqrt(l)) * (1.0 - (h * (0.125 * (t_2 * (t_2 / l)))))) else: tmp = (1.0 - t_0) * (math.pow(h, -0.5) * (d * math.pow(l, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) t_1 = sqrt(Float64(d / h)) t_2 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (d <= -1.3e-128) tmp = Float64(Float64(t_1 * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(1.0 / sqrt(Float64(l / d)))); elseif (d <= 2.5e-275) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (d <= 1.4e+33) tmp = Float64(t_1 * Float64(Float64(sqrt(d) / sqrt(l)) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_2 * Float64(t_2 / l))))))); else tmp = Float64(Float64(1.0 - t_0) * Float64((h ^ -0.5) * Float64(d * (l ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
t_1 = sqrt((d / h));
t_2 = M * (D_m / d);
tmp = 0.0;
if (d <= -1.3e-128)
tmp = (t_1 * (1.0 + (((h * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0)) / l))) * (1.0 / sqrt((l / d)));
elseif (d <= 2.5e-275)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (d <= 1.4e+33)
tmp = t_1 * ((sqrt(d) / sqrt(l)) * (1.0 - (h * (0.125 * (t_2 * (t_2 / l))))));
else
tmp = (1.0 - t_0) * ((h ^ -0.5) * (d * (l ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.3e-128], N[(N[(t$95$1 * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-275], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e+33], N[(t$95$1 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$2 * N[(t$95$2 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[Power[h, -0.5], $MachinePrecision] * N[(d * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -1.3 \cdot 10^{-128}:\\
\;\;\;\;\left(t\_1 \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-275}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{+33}:\\
\;\;\;\;t\_1 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_2 \cdot \frac{t\_2}{\ell}\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \left({h}^{-0.5} \cdot \left(d \cdot {\ell}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if d < -1.2999999999999999e-128Initial program 76.7%
Simplified76.8%
associate-*l/80.4%
*-commutative80.4%
associate-/l/80.4%
Applied egg-rr80.4%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
clear-num80.4%
sqrt-div81.4%
metadata-eval81.4%
Applied egg-rr81.4%
if -1.2999999999999999e-128 < d < 2.49999999999999992e-275Initial program 39.1%
Simplified39.1%
add-sqr-sqrt39.0%
pow239.0%
sqrt-unprod30.6%
pow1/230.6%
sqrt-pow130.6%
metadata-eval30.6%
Applied egg-rr30.6%
Taylor expanded in d around -inf 57.9%
if 2.49999999999999992e-275 < d < 1.4e33Initial program 74.5%
Simplified71.8%
Taylor expanded in h around -inf 59.2%
associate-*r*59.2%
neg-mul-159.2%
sub-neg59.2%
distribute-lft-in59.2%
Simplified74.7%
sqrt-div82.6%
Applied egg-rr80.0%
unpow277.3%
associate-/l*78.7%
Applied egg-rr82.7%
if 1.4e33 < d Initial program 75.0%
Simplified74.7%
add-sqr-sqrt74.6%
pow274.6%
sqrt-unprod71.1%
pow1/271.1%
sqrt-pow171.1%
metadata-eval71.1%
Applied egg-rr71.1%
*-un-lft-identity71.1%
pow-pow71.2%
metadata-eval71.2%
pow1/271.2%
frac-times58.1%
pow258.1%
Applied egg-rr58.1%
*-lft-identity58.1%
associate-/r*60.5%
Simplified60.5%
associate-/r*58.1%
div-inv58.1%
unpow258.1%
add-cbrt-cube45.4%
pow1/344.7%
pow344.7%
metadata-eval44.7%
pow-prod-up44.7%
pow-prod-down51.7%
swap-sqr52.0%
sqrt-unprod61.6%
add-sqr-sqrt61.6%
*-commutative61.6%
Applied egg-rr90.5%
Final simplification79.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d))) (t_1 (sqrt (/ d h))) (t_2 (sqrt (/ d l))))
(if (<= l -1.9e+122)
(* t_1 (* t_2 (+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))
(if (<= l -4.6e-81)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 7.5e+177)
(*
t_1
(* t_2 (- 1.0 (/ (* h (* 0.125 (pow (/ (* M D_m) d) 2.0))) l))))
(* (/ d (sqrt h)) (/ 1.0 (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double tmp;
if (l <= -1.9e+122) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -4.6e-81) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 7.5e+177) {
tmp = t_1 * (t_2 * (1.0 - ((h * (0.125 * pow(((M * D_m) / d), 2.0))) / l)));
} else {
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = sqrt((d / h))
t_2 = sqrt((d / l))
if (l <= (-1.9d+122)) then
tmp = t_1 * (t_2 * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
else if (l <= (-4.6d-81)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
else if (l <= 7.5d+177) then
tmp = t_1 * (t_2 * (1.0d0 - ((h * (0.125d0 * (((m * d_m) / d) ** 2.0d0))) / l)))
else
tmp = (d / sqrt(h)) * (1.0d0 / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -1.9e+122) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -4.6e-81) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 7.5e+177) {
tmp = t_1 * (t_2 * (1.0 - ((h * (0.125 * Math.pow(((M * D_m) / d), 2.0))) / l)));
} else {
tmp = (d / Math.sqrt(h)) * (1.0 / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = math.sqrt((d / h)) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -1.9e+122: tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) elif l <= -4.6e-81: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) elif l <= 7.5e+177: tmp = t_1 * (t_2 * (1.0 - ((h * (0.125 * math.pow(((M * D_m) / d), 2.0))) / l))) else: tmp = (d / math.sqrt(h)) * (1.0 / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -1.9e+122) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))); elseif (l <= -4.6e-81) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 7.5e+177) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 - Float64(Float64(h * Float64(0.125 * (Float64(Float64(M * D_m) / d) ^ 2.0))) / l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(1.0 / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = sqrt((d / h));
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -1.9e+122)
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
elseif (l <= -4.6e-81)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
elseif (l <= 7.5e+177)
tmp = t_1 * (t_2 * (1.0 - ((h * (0.125 * (((M * D_m) / d) ^ 2.0))) / l)));
else
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9e+122], N[(t$95$1 * N[(t$95$2 * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.6e-81], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e+177], N[(t$95$1 * N[(t$95$2 * N[(1.0 - N[(N[(h * N[(0.125 * N[Power[N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{+122}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -4.6 \cdot 10^{-81}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{+177}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 - \frac{h \cdot \left(0.125 \cdot {\left(\frac{M \cdot D\_m}{d}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.8999999999999999e122Initial program 59.4%
Simplified59.5%
Taylor expanded in h around -inf 27.2%
associate-*r*27.2%
neg-mul-127.2%
sub-neg27.2%
distribute-lft-in27.2%
Simplified59.5%
pow159.5%
associate-*r/59.5%
Applied egg-rr59.5%
unpow159.5%
distribute-lft-neg-in59.5%
distribute-rgt-neg-in59.5%
associate-/l*59.5%
distribute-lft-neg-in59.5%
metadata-eval59.5%
associate-*r/59.5%
*-commutative59.5%
Simplified59.5%
unpow259.5%
associate-/l*62.1%
associate-/l*62.1%
associate-/l*62.1%
Applied egg-rr62.1%
if -1.8999999999999999e122 < l < -4.59999999999999982e-81Initial program 58.8%
Simplified56.7%
add-sqr-sqrt56.5%
pow256.5%
sqrt-unprod38.4%
pow1/238.4%
sqrt-pow138.4%
metadata-eval38.4%
Applied egg-rr38.4%
Taylor expanded in d around -inf 79.0%
if -4.59999999999999982e-81 < l < 7.50000000000000039e177Initial program 77.5%
Simplified76.8%
Taylor expanded in h around -inf 51.6%
associate-*r*51.6%
neg-mul-151.6%
sub-neg51.6%
distribute-lft-in51.6%
Simplified79.9%
pow179.9%
associate-*r/79.9%
Applied egg-rr79.9%
unpow179.9%
associate-*r/81.9%
associate-*r/82.0%
*-commutative82.0%
Simplified82.0%
if 7.50000000000000039e177 < l Initial program 57.0%
Simplified54.1%
Taylor expanded in d around inf 59.9%
*-un-lft-identity59.9%
pow1/259.9%
inv-pow59.9%
pow-pow59.8%
metadata-eval59.8%
Applied egg-rr59.8%
*-lft-identity59.8%
Simplified59.8%
metadata-eval59.8%
metadata-eval59.8%
pow-pow59.9%
inv-pow59.9%
pow-pow52.0%
add-sqr-sqrt52.0%
sqrt-unprod41.8%
swap-sqr41.5%
unpow241.5%
pow-pow41.9%
pow-pow45.9%
pow-sqr45.9%
metadata-eval45.9%
metadata-eval45.9%
pow145.9%
div-inv45.9%
associate-/r*43.4%
Applied egg-rr70.8%
associate-/r/71.0%
Simplified71.0%
Final simplification77.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d))) (t_1 (sqrt (/ d h))) (t_2 (sqrt (/ d l))))
(if (<= l -2.5e+129)
(* t_1 (* t_2 (+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))
(if (<= l -1.3e-81)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 1.2e+178)
(* t_1 (* t_2 (+ 1.0 (/ (* (* h -0.125) (pow t_0 2.0)) l))))
(* (/ d (sqrt h)) (/ 1.0 (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double tmp;
if (l <= -2.5e+129) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -1.3e-81) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 1.2e+178) {
tmp = t_1 * (t_2 * (1.0 + (((h * -0.125) * pow(t_0, 2.0)) / l)));
} else {
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = sqrt((d / h))
t_2 = sqrt((d / l))
if (l <= (-2.5d+129)) then
tmp = t_1 * (t_2 * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
else if (l <= (-1.3d-81)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
else if (l <= 1.2d+178) then
tmp = t_1 * (t_2 * (1.0d0 + (((h * (-0.125d0)) * (t_0 ** 2.0d0)) / l)))
else
tmp = (d / sqrt(h)) * (1.0d0 / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -2.5e+129) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -1.3e-81) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 1.2e+178) {
tmp = t_1 * (t_2 * (1.0 + (((h * -0.125) * Math.pow(t_0, 2.0)) / l)));
} else {
tmp = (d / Math.sqrt(h)) * (1.0 / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = math.sqrt((d / h)) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -2.5e+129: tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) elif l <= -1.3e-81: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) elif l <= 1.2e+178: tmp = t_1 * (t_2 * (1.0 + (((h * -0.125) * math.pow(t_0, 2.0)) / l))) else: tmp = (d / math.sqrt(h)) * (1.0 / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.5e+129) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))); elseif (l <= -1.3e-81) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 1.2e+178) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 + Float64(Float64(Float64(h * -0.125) * (t_0 ^ 2.0)) / l)))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(1.0 / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = sqrt((d / h));
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -2.5e+129)
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
elseif (l <= -1.3e-81)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
elseif (l <= 1.2e+178)
tmp = t_1 * (t_2 * (1.0 + (((h * -0.125) * (t_0 ^ 2.0)) / l)));
else
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.5e+129], N[(t$95$1 * N[(t$95$2 * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.3e-81], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.2e+178], N[(t$95$1 * N[(t$95$2 * N[(1.0 + N[(N[(N[(h * -0.125), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+129}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1.3 \cdot 10^{-81}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.2 \cdot 10^{+178}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 + \frac{\left(h \cdot -0.125\right) \cdot {t\_0}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.5000000000000001e129Initial program 59.4%
Simplified59.5%
Taylor expanded in h around -inf 27.2%
associate-*r*27.2%
neg-mul-127.2%
sub-neg27.2%
distribute-lft-in27.2%
Simplified59.5%
pow159.5%
associate-*r/59.5%
Applied egg-rr59.5%
unpow159.5%
distribute-lft-neg-in59.5%
distribute-rgt-neg-in59.5%
associate-/l*59.5%
distribute-lft-neg-in59.5%
metadata-eval59.5%
associate-*r/59.5%
*-commutative59.5%
Simplified59.5%
unpow259.5%
associate-/l*62.1%
associate-/l*62.1%
associate-/l*62.1%
Applied egg-rr62.1%
if -2.5000000000000001e129 < l < -1.2999999999999999e-81Initial program 58.8%
Simplified56.7%
add-sqr-sqrt56.5%
pow256.5%
sqrt-unprod38.4%
pow1/238.4%
sqrt-pow138.4%
metadata-eval38.4%
Applied egg-rr38.4%
Taylor expanded in d around -inf 79.0%
if -1.2999999999999999e-81 < l < 1.2e178Initial program 77.5%
Simplified76.8%
Taylor expanded in h around -inf 51.6%
associate-*r*51.6%
neg-mul-151.6%
sub-neg51.6%
distribute-lft-in51.6%
Simplified79.9%
pow179.9%
associate-*r/79.9%
Applied egg-rr79.9%
unpow179.9%
distribute-lft-neg-in79.9%
distribute-rgt-neg-in79.9%
associate-/l*79.9%
distribute-lft-neg-in79.9%
metadata-eval79.9%
associate-*r/80.7%
*-commutative80.7%
Simplified80.7%
associate-*r*80.7%
associate-*r/82.0%
associate-/l*81.3%
Applied egg-rr81.3%
if 1.2e178 < l Initial program 57.0%
Simplified54.1%
Taylor expanded in d around inf 59.9%
*-un-lft-identity59.9%
pow1/259.9%
inv-pow59.9%
pow-pow59.8%
metadata-eval59.8%
Applied egg-rr59.8%
*-lft-identity59.8%
Simplified59.8%
metadata-eval59.8%
metadata-eval59.8%
pow-pow59.9%
inv-pow59.9%
pow-pow52.0%
add-sqr-sqrt52.0%
sqrt-unprod41.8%
swap-sqr41.5%
unpow241.5%
pow-pow41.9%
pow-pow45.9%
pow-sqr45.9%
metadata-eval45.9%
metadata-eval45.9%
pow145.9%
div-inv45.9%
associate-/r*43.4%
Applied egg-rr70.8%
associate-/r/71.0%
Simplified71.0%
Final simplification76.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* M (/ D_m d))))
(if (<= d -5.8e-126)
(*
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)) l)))
(/ 1.0 (sqrt (/ l d))))
(if (<= d -5e-311)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (- 1.0 (* h (* 0.125 (* t_0 (/ t_0 l)))))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = M * (D_m / d);
double tmp;
if (d <= -5.8e-126) {
tmp = (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / sqrt((l / d)));
} else if (d <= -5e-311) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = m * (d_m / d)
if (d <= (-5.8d-126)) then
tmp = (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0)) / l))) * (1.0d0 / sqrt((l / d)))
else if (d <= (-5d-311)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0d0 - (h * (0.125d0 * (t_0 * (t_0 / l))))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = M * (D_m / d);
double tmp;
if (d <= -5.8e-126) {
tmp = (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / Math.sqrt((l / d)));
} else if (d <= -5e-311) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
} else {
tmp = (Math.sqrt(d) / Math.sqrt(h)) * (Math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = M * (D_m / d) tmp = 0 if d <= -5.8e-126: tmp = (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / math.sqrt((l / d))) elif d <= -5e-311: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) else: tmp = (math.sqrt(d) / math.sqrt(h)) * (math.sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l)))))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(M * Float64(D_m / d)) tmp = 0.0 if (d <= -5.8e-126) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(1.0 / sqrt(Float64(l / d)))); elseif (d <= -5e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(0.125 * Float64(t_0 * Float64(t_0 / l))))))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = M * (D_m / d);
tmp = 0.0;
if (d <= -5.8e-126)
tmp = (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0)) / l))) * (1.0 / sqrt((l / d)));
elseif (d <= -5e-311)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
else
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * (1.0 - (h * (0.125 * (t_0 * (t_0 / l))))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(M * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.8e-126], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := M \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -5.8 \cdot 10^{-126}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\end{array}
\end{array}
if d < -5.79999999999999975e-126Initial program 76.7%
Simplified76.8%
associate-*l/80.4%
*-commutative80.4%
associate-/l/80.4%
Applied egg-rr80.4%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
clear-num80.4%
sqrt-div81.4%
metadata-eval81.4%
Applied egg-rr81.4%
if -5.79999999999999975e-126 < d < -5.00000000000023e-311Initial program 41.3%
Simplified41.4%
add-sqr-sqrt41.2%
pow241.2%
sqrt-unprod31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
Applied egg-rr31.8%
Taylor expanded in d around -inf 62.4%
if -5.00000000000023e-311 < d Initial program 72.6%
Simplified71.0%
Taylor expanded in h around -inf 48.6%
associate-*r*48.6%
neg-mul-148.6%
sub-neg48.6%
distribute-lft-in48.6%
Simplified73.5%
sqrt-div82.0%
Applied egg-rr82.0%
unpow282.0%
associate-/l*83.5%
Applied egg-rr83.5%
Final simplification79.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= d -6e-126)
(*
(*
(sqrt (/ d h))
(+ 1.0 (/ (* (* h -0.5) (pow (* D_m (/ M (* d 2.0))) 2.0)) l)))
(/ 1.0 (sqrt (/ l d))))
(if (<= d -5e-311)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(* (- 1.0 t_0) (* (pow h -0.5) (* d (pow l -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -6e-126) {
tmp = (sqrt((d / h)) * (1.0 + (((h * -0.5) * pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / sqrt((l / d)));
} else if (d <= -5e-311) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (pow(h, -0.5) * (d * pow(l, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
if (d <= (-6d-126)) then
tmp = (sqrt((d / h)) * (1.0d0 + (((h * (-0.5d0)) * ((d_m * (m / (d * 2.0d0))) ** 2.0d0)) / l))) * (1.0d0 / sqrt((l / d)))
else if (d <= (-5d-311)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else
tmp = (1.0d0 - t_0) * ((h ** (-0.5d0)) * (d * (l ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -6e-126) {
tmp = (Math.sqrt((d / h)) * (1.0 + (((h * -0.5) * Math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / Math.sqrt((l / d)));
} else if (d <= -5e-311) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (Math.pow(h, -0.5) * (d * Math.pow(l, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) tmp = 0 if d <= -6e-126: tmp = (math.sqrt((d / h)) * (1.0 + (((h * -0.5) * math.pow((D_m * (M / (d * 2.0))), 2.0)) / l))) * (1.0 / math.sqrt((l / d))) elif d <= -5e-311: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) else: tmp = (1.0 - t_0) * (math.pow(h, -0.5) * (d * math.pow(l, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) tmp = 0.0 if (d <= -6e-126) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(Float64(h * -0.5) * (Float64(D_m * Float64(M / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(1.0 / sqrt(Float64(l / d)))); elseif (d <= -5e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); else tmp = Float64(Float64(1.0 - t_0) * Float64((h ^ -0.5) * Float64(d * (l ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
tmp = 0.0;
if (d <= -6e-126)
tmp = (sqrt((d / h)) * (1.0 + (((h * -0.5) * ((D_m * (M / (d * 2.0))) ^ 2.0)) / l))) * (1.0 / sqrt((l / d)));
elseif (d <= -5e-311)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
else
tmp = (1.0 - t_0) * ((h ^ -0.5) * (d * (l ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6e-126], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(N[(h * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(M / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(N[Power[h, -0.5], $MachinePrecision] * N[(d * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;d \leq -6 \cdot 10^{-126}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{\left(h \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{M}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \left({h}^{-0.5} \cdot \left(d \cdot {\ell}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if d < -6.0000000000000003e-126Initial program 76.7%
Simplified76.8%
associate-*l/80.4%
*-commutative80.4%
associate-/l/80.4%
Applied egg-rr80.4%
associate-*r*80.4%
*-commutative80.4%
Simplified80.4%
clear-num80.4%
sqrt-div81.4%
metadata-eval81.4%
Applied egg-rr81.4%
if -6.0000000000000003e-126 < d < -5.00000000000023e-311Initial program 41.3%
Simplified41.4%
add-sqr-sqrt41.2%
pow241.2%
sqrt-unprod31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
Applied egg-rr31.8%
Taylor expanded in d around -inf 62.4%
if -5.00000000000023e-311 < d Initial program 72.6%
Simplified71.0%
add-sqr-sqrt70.9%
pow270.9%
sqrt-unprod64.3%
pow1/264.3%
sqrt-pow164.3%
metadata-eval64.3%
Applied egg-rr64.3%
*-un-lft-identity64.3%
pow-pow64.4%
metadata-eval64.4%
pow1/264.4%
frac-times53.1%
pow253.1%
Applied egg-rr53.1%
*-lft-identity53.1%
associate-/r*53.9%
Simplified53.9%
associate-/r*53.1%
div-inv53.0%
unpow253.0%
add-cbrt-cube41.2%
pow1/340.6%
pow340.6%
metadata-eval40.6%
pow-prod-up40.6%
pow-prod-down48.8%
swap-sqr54.3%
sqrt-unprod62.5%
add-sqr-sqrt62.5%
*-commutative62.5%
Applied egg-rr79.7%
Final simplification77.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d)))
(t_1 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= d -9e-127)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (- 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ -1.0 l))))))))
(if (<= d -5e-311)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_1))
(* (- 1.0 t_1) (* (pow h -0.5) (* d (pow l -0.5))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -9e-127) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else if (d <= -5e-311) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (pow(h, -0.5) * (d * pow(l, -0.5)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
if (d <= (-9d-127)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (h * ((-0.125d0) * (t_0 * (t_0 * ((-1.0d0) / l)))))))
else if (d <= (-5d-311)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_1)
else
tmp = (1.0d0 - t_1) * ((h ** (-0.5d0)) * (d * (l ** (-0.5d0))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -9e-127) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else if (d <= -5e-311) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (Math.pow(h, -0.5) * (d * Math.pow(l, -0.5)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) tmp = 0 if d <= -9e-127: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l))))))) elif d <= -5e-311: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_1) else: tmp = (1.0 - t_1) * (math.pow(h, -0.5) * (d * math.pow(l, -0.5))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) tmp = 0.0 if (d <= -9e-127) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(-1.0 / l)))))))); elseif (d <= -5e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_1)); else tmp = Float64(Float64(1.0 - t_1) * Float64((h ^ -0.5) * Float64(d * (l ^ -0.5)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
tmp = 0.0;
if (d <= -9e-127)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
elseif (d <= -5e-311)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
else
tmp = (1.0 - t_1) * ((h ^ -0.5) * (d * (l ^ -0.5)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -9e-127], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(N[Power[h, -0.5], $MachinePrecision] * N[(d * N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;d \leq -9 \cdot 10^{-127}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_1\right) \cdot \left({h}^{-0.5} \cdot \left(d \cdot {\ell}^{-0.5}\right)\right)\\
\end{array}
\end{array}
if d < -8.9999999999999998e-127Initial program 76.7%
Simplified75.6%
Taylor expanded in h around -inf 48.7%
associate-*r*48.7%
neg-mul-148.7%
sub-neg48.7%
distribute-lft-in48.7%
Simplified78.2%
pow178.2%
associate-*r/78.2%
Applied egg-rr78.2%
unpow178.2%
distribute-lft-neg-in78.2%
distribute-rgt-neg-in78.2%
associate-/l*78.2%
distribute-lft-neg-in78.2%
metadata-eval78.2%
associate-*r/79.3%
*-commutative79.3%
Simplified79.3%
div-inv79.3%
unpow279.3%
associate-*l*80.5%
associate-/l*80.6%
associate-/l*80.5%
Applied egg-rr80.5%
if -8.9999999999999998e-127 < d < -5.00000000000023e-311Initial program 41.3%
Simplified41.4%
add-sqr-sqrt41.2%
pow241.2%
sqrt-unprod31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
Applied egg-rr31.8%
Taylor expanded in d around -inf 62.4%
if -5.00000000000023e-311 < d Initial program 72.6%
Simplified71.0%
add-sqr-sqrt70.9%
pow270.9%
sqrt-unprod64.3%
pow1/264.3%
sqrt-pow164.3%
metadata-eval64.3%
Applied egg-rr64.3%
*-un-lft-identity64.3%
pow-pow64.4%
metadata-eval64.4%
pow1/264.4%
frac-times53.1%
pow253.1%
Applied egg-rr53.1%
*-lft-identity53.1%
associate-/r*53.9%
Simplified53.9%
associate-/r*53.1%
div-inv53.0%
unpow253.0%
add-cbrt-cube41.2%
pow1/340.6%
pow340.6%
metadata-eval40.6%
pow-prod-up40.6%
pow-prod-down48.8%
swap-sqr54.3%
sqrt-unprod62.5%
add-sqr-sqrt62.5%
*-commutative62.5%
Applied egg-rr79.7%
Final simplification77.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d)))
(t_1 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= d -1.12e-125)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (- 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ -1.0 l))))))))
(if (<= d -5e-311)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_1))
(* (- 1.0 t_1) (* (pow l -0.5) (/ d (sqrt h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -1.12e-125) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else if (d <= -5e-311) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (pow(l, -0.5) * (d / sqrt(h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
if (d <= (-1.12d-125)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 - (h * ((-0.125d0) * (t_0 * (t_0 * ((-1.0d0) / l)))))))
else if (d <= (-5d-311)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_1)
else
tmp = (1.0d0 - t_1) * ((l ** (-0.5d0)) * (d / sqrt(h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double tmp;
if (d <= -1.12e-125) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else if (d <= -5e-311) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (Math.pow(l, -0.5) * (d / Math.sqrt(h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) tmp = 0 if d <= -1.12e-125: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l))))))) elif d <= -5e-311: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_1) else: tmp = (1.0 - t_1) * (math.pow(l, -0.5) * (d / math.sqrt(h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) tmp = 0.0 if (d <= -1.12e-125) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 - Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(-1.0 / l)))))))); elseif (d <= -5e-311) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_1)); else tmp = Float64(Float64(1.0 - t_1) * Float64((l ^ -0.5) * Float64(d / sqrt(h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
tmp = 0.0;
if (d <= -1.12e-125)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
elseif (d <= -5e-311)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_1);
else
tmp = (1.0 - t_1) * ((l ^ -0.5) * (d / sqrt(h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.12e-125], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-311], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(N[Power[l, -0.5], $MachinePrecision] * N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;d \leq -1.12 \cdot 10^{-125}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 - h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_1\right) \cdot \left({\ell}^{-0.5} \cdot \frac{d}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -1.11999999999999997e-125Initial program 76.7%
Simplified75.6%
Taylor expanded in h around -inf 48.7%
associate-*r*48.7%
neg-mul-148.7%
sub-neg48.7%
distribute-lft-in48.7%
Simplified78.2%
pow178.2%
associate-*r/78.2%
Applied egg-rr78.2%
unpow178.2%
distribute-lft-neg-in78.2%
distribute-rgt-neg-in78.2%
associate-/l*78.2%
distribute-lft-neg-in78.2%
metadata-eval78.2%
associate-*r/79.3%
*-commutative79.3%
Simplified79.3%
div-inv79.3%
unpow279.3%
associate-*l*80.5%
associate-/l*80.6%
associate-/l*80.5%
Applied egg-rr80.5%
if -1.11999999999999997e-125 < d < -5.00000000000023e-311Initial program 41.3%
Simplified41.4%
add-sqr-sqrt41.2%
pow241.2%
sqrt-unprod31.8%
pow1/231.8%
sqrt-pow131.8%
metadata-eval31.8%
Applied egg-rr31.8%
Taylor expanded in d around -inf 62.4%
if -5.00000000000023e-311 < d Initial program 72.6%
Simplified71.0%
add-sqr-sqrt70.9%
pow270.9%
sqrt-unprod64.3%
pow1/264.3%
sqrt-pow164.3%
metadata-eval64.3%
Applied egg-rr64.3%
*-un-lft-identity64.3%
pow-pow64.4%
metadata-eval64.4%
pow1/264.4%
frac-times53.1%
pow253.1%
Applied egg-rr53.1%
*-lft-identity53.1%
associate-/r*53.9%
Simplified53.9%
div-inv53.9%
sqrt-prod56.8%
sqrt-div64.9%
unpow264.9%
sqrt-prod79.4%
add-sqr-sqrt79.7%
inv-pow79.7%
sqrt-pow179.7%
metadata-eval79.7%
Applied egg-rr79.7%
*-commutative79.7%
Simplified79.7%
Final simplification77.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d))) (t_1 (sqrt (/ d h))) (t_2 (sqrt (/ d l))))
(if (<= l -2.15e+117)
(* t_1 (* t_2 (+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))
(if (<= l -1.6e-105)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 2.9e+178)
(* t_1 (* t_2 (- 1.0 (* h (* -0.125 (* t_0 (* t_0 (/ -1.0 l))))))))
(* (/ d (sqrt h)) (/ 1.0 (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double tmp;
if (l <= -2.15e+117) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -1.6e-105) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 2.9e+178) {
tmp = t_1 * (t_2 * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else {
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = sqrt((d / h))
t_2 = sqrt((d / l))
if (l <= (-2.15d+117)) then
tmp = t_1 * (t_2 * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
else if (l <= (-1.6d-105)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
else if (l <= 2.9d+178) then
tmp = t_1 * (t_2 * (1.0d0 - (h * ((-0.125d0) * (t_0 * (t_0 * ((-1.0d0) / l)))))))
else
tmp = (d / sqrt(h)) * (1.0d0 / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = Math.sqrt((d / h));
double t_2 = Math.sqrt((d / l));
double tmp;
if (l <= -2.15e+117) {
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
} else if (l <= -1.6e-105) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 2.9e+178) {
tmp = t_1 * (t_2 * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
} else {
tmp = (d / Math.sqrt(h)) * (1.0 / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = math.sqrt((d / h)) t_2 = math.sqrt((d / l)) tmp = 0 if l <= -2.15e+117: tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) elif l <= -1.6e-105: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) elif l <= 2.9e+178: tmp = t_1 * (t_2 * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l))))))) else: tmp = (d / math.sqrt(h)) * (1.0 / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.15e+117) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))); elseif (l <= -1.6e-105) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 2.9e+178) tmp = Float64(t_1 * Float64(t_2 * Float64(1.0 - Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 * Float64(-1.0 / l)))))))); else tmp = Float64(Float64(d / sqrt(h)) * Float64(1.0 / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = sqrt((d / h));
t_2 = sqrt((d / l));
tmp = 0.0;
if (l <= -2.15e+117)
tmp = t_1 * (t_2 * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
elseif (l <= -1.6e-105)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
elseif (l <= 2.9e+178)
tmp = t_1 * (t_2 * (1.0 - (h * (-0.125 * (t_0 * (t_0 * (-1.0 / l)))))));
else
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.15e+117], N[(t$95$1 * N[(t$95$2 * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1.6e-105], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.9e+178], N[(t$95$1 * N[(t$95$2 * N[(1.0 - N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 * N[(-1.0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.15 \cdot 10^{+117}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{elif}\;\ell \leq -1.6 \cdot 10^{-105}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{+178}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(1 - h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \left(t\_0 \cdot \frac{-1}{\ell}\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.14999999999999999e117Initial program 59.4%
Simplified59.5%
Taylor expanded in h around -inf 27.2%
associate-*r*27.2%
neg-mul-127.2%
sub-neg27.2%
distribute-lft-in27.2%
Simplified59.5%
pow159.5%
associate-*r/59.5%
Applied egg-rr59.5%
unpow159.5%
distribute-lft-neg-in59.5%
distribute-rgt-neg-in59.5%
associate-/l*59.5%
distribute-lft-neg-in59.5%
metadata-eval59.5%
associate-*r/59.5%
*-commutative59.5%
Simplified59.5%
unpow259.5%
associate-/l*62.1%
associate-/l*62.1%
associate-/l*62.1%
Applied egg-rr62.1%
if -2.14999999999999999e117 < l < -1.59999999999999991e-105Initial program 61.0%
Simplified59.1%
add-sqr-sqrt58.9%
pow258.9%
sqrt-unprod42.5%
pow1/242.5%
sqrt-pow142.5%
metadata-eval42.5%
Applied egg-rr42.5%
Taylor expanded in d around -inf 79.2%
if -1.59999999999999991e-105 < l < 2.9e178Initial program 77.4%
Simplified76.6%
Taylor expanded in h around -inf 52.7%
associate-*r*52.7%
neg-mul-152.7%
sub-neg52.7%
distribute-lft-in52.7%
Simplified79.9%
pow179.9%
associate-*r/79.9%
Applied egg-rr79.9%
unpow179.9%
distribute-lft-neg-in79.9%
distribute-rgt-neg-in79.9%
associate-/l*79.9%
distribute-lft-neg-in79.9%
metadata-eval79.9%
associate-*r/80.6%
*-commutative80.6%
Simplified80.6%
div-inv80.6%
unpow280.6%
associate-*l*81.4%
associate-/l*81.4%
associate-/l*81.4%
Applied egg-rr81.4%
if 2.9e178 < l Initial program 57.0%
Simplified54.1%
Taylor expanded in d around inf 59.9%
*-un-lft-identity59.9%
pow1/259.9%
inv-pow59.9%
pow-pow59.8%
metadata-eval59.8%
Applied egg-rr59.8%
*-lft-identity59.8%
Simplified59.8%
metadata-eval59.8%
metadata-eval59.8%
pow-pow59.9%
inv-pow59.9%
pow-pow52.0%
add-sqr-sqrt52.0%
sqrt-unprod41.8%
swap-sqr41.5%
unpow241.5%
pow-pow41.9%
pow-pow45.9%
pow-sqr45.9%
metadata-eval45.9%
metadata-eval45.9%
pow145.9%
div-inv45.9%
associate-/r*43.4%
Applied egg-rr70.8%
associate-/r/71.0%
Simplified71.0%
Final simplification76.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M d)))
(t_1
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (+ 1.0 (* h (* -0.125 (* t_0 (/ t_0 l)))))))))
(if (<= l -1.4e+115)
t_1
(if (<= l -6e-105)
(*
(* d (sqrt (/ 1.0 (* h l))))
(+ -1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0)))))
(if (<= l 5.2e+176) t_1 (* (/ d (sqrt h)) (/ 1.0 (sqrt l))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
double tmp;
if (l <= -1.4e+115) {
tmp = t_1;
} else if (l <= -6e-105) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 5.2e+176) {
tmp = t_1;
} else {
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d_m * (m / d)
t_1 = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (h * ((-0.125d0) * (t_0 * (t_0 / l))))))
if (l <= (-1.4d+115)) then
tmp = t_1
else if (l <= (-6d-105)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))))
else if (l <= 5.2d+176) then
tmp = t_1
else
tmp = (d / sqrt(h)) * (1.0d0 / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = D_m * (M / d);
double t_1 = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
double tmp;
if (l <= -1.4e+115) {
tmp = t_1;
} else if (l <= -6e-105) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0))));
} else if (l <= 5.2e+176) {
tmp = t_1;
} else {
tmp = (d / Math.sqrt(h)) * (1.0 / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = D_m * (M / d) t_1 = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l)))))) tmp = 0 if l <= -1.4e+115: tmp = t_1 elif l <= -6e-105: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) elif l <= 5.2e+176: tmp = t_1 else: tmp = (d / math.sqrt(h)) * (1.0 / math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(D_m * Float64(M / d)) t_1 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(h * Float64(-0.125 * Float64(t_0 * Float64(t_0 / l))))))) tmp = 0.0 if (l <= -1.4e+115) tmp = t_1; elseif (l <= -6e-105) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))))); elseif (l <= 5.2e+176) tmp = t_1; else tmp = Float64(Float64(d / sqrt(h)) * Float64(1.0 / sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = D_m * (M / d);
t_1 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (h * (-0.125 * (t_0 * (t_0 / l))))));
tmp = 0.0;
if (l <= -1.4e+115)
tmp = t_1;
elseif (l <= -6e-105)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0))));
elseif (l <= 5.2e+176)
tmp = t_1;
else
tmp = (d / sqrt(h)) * (1.0 / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(-0.125 * N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e+115], t$95$1, If[LessEqual[l, -6e-105], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+176], t$95$1, N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M}{d}\\
t_1 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + h \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{t\_0}{\ell}\right)\right)\right)\right)\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{+115}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -6 \cdot 10^{-105}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+176}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h}} \cdot \frac{1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.4e115 or -6.0000000000000002e-105 < l < 5.19999999999999981e176Initial program 73.6%
Simplified73.0%
Taylor expanded in h around -inf 47.3%
associate-*r*47.3%
neg-mul-147.3%
sub-neg47.3%
distribute-lft-in47.3%
Simplified75.5%
pow175.5%
associate-*r/75.5%
Applied egg-rr75.5%
unpow175.5%
distribute-lft-neg-in75.5%
distribute-rgt-neg-in75.5%
associate-/l*75.5%
distribute-lft-neg-in75.5%
metadata-eval75.5%
associate-*r/76.2%
*-commutative76.2%
Simplified76.2%
unpow276.2%
associate-/l*77.3%
associate-/l*77.3%
associate-/l*77.3%
Applied egg-rr77.3%
if -1.4e115 < l < -6.0000000000000002e-105Initial program 61.0%
Simplified59.1%
add-sqr-sqrt58.9%
pow258.9%
sqrt-unprod42.5%
pow1/242.5%
sqrt-pow142.5%
metadata-eval42.5%
Applied egg-rr42.5%
Taylor expanded in d around -inf 79.2%
if 5.19999999999999981e176 < l Initial program 57.0%
Simplified54.1%
Taylor expanded in d around inf 59.9%
*-un-lft-identity59.9%
pow1/259.9%
inv-pow59.9%
pow-pow59.8%
metadata-eval59.8%
Applied egg-rr59.8%
*-lft-identity59.8%
Simplified59.8%
metadata-eval59.8%
metadata-eval59.8%
pow-pow59.9%
inv-pow59.9%
pow-pow52.0%
add-sqr-sqrt52.0%
sqrt-unprod41.8%
swap-sqr41.5%
unpow241.5%
pow-pow41.9%
pow-pow45.9%
pow-sqr45.9%
metadata-eval45.9%
metadata-eval45.9%
pow145.9%
div-inv45.9%
associate-/r*43.4%
Applied egg-rr70.8%
associate-/r/71.0%
Simplified71.0%
Final simplification76.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))))
(if (<= l -2.9e+41)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= l -2.4e-301)
(* t_0 (sqrt (* d (/ d (* h l)))))
(if (<= l 8e+130)
(* t_0 (* d (pow (* h l) -0.5)))
(/ (/ d (sqrt h)) (sqrt l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)));
double tmp;
if (l <= -2.9e+41) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (l <= -2.4e-301) {
tmp = t_0 * sqrt((d * (d / (h * l))));
} else if (l <= 8e+130) {
tmp = t_0 * (d * pow((h * l), -0.5));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))
if (l <= (-2.9d+41)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (l <= (-2.4d-301)) then
tmp = t_0 * sqrt((d * (d / (h * l))))
else if (l <= 8d+130) then
tmp = t_0 * (d * ((h * l) ** (-0.5d0)))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)));
double tmp;
if (l <= -2.9e+41) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (l <= -2.4e-301) {
tmp = t_0 * Math.sqrt((d * (d / (h * l))));
} else if (l <= 8e+130) {
tmp = t_0 * (d * Math.pow((h * l), -0.5));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0))) tmp = 0 if l <= -2.9e+41: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif l <= -2.4e-301: tmp = t_0 * math.sqrt((d * (d / (h * l)))) elif l <= 8e+130: tmp = t_0 * (d * math.pow((h * l), -0.5)) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) tmp = 0.0 if (l <= -2.9e+41) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (l <= -2.4e-301) tmp = Float64(t_0 * sqrt(Float64(d * Float64(d / Float64(h * l))))); elseif (l <= 8e+130) tmp = Float64(t_0 * Float64(d * (Float64(h * l) ^ -0.5))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)));
tmp = 0.0;
if (l <= -2.9e+41)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (l <= -2.4e-301)
tmp = t_0 * sqrt((d * (d / (h * l))));
elseif (l <= 8e+130)
tmp = t_0 * (d * ((h * l) ^ -0.5));
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.9e+41], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -2.4e-301], N[(t$95$0 * N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8e+130], N[(t$95$0 * N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+41}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;\ell \leq -2.4 \cdot 10^{-301}:\\
\;\;\;\;t\_0 \cdot \sqrt{d \cdot \frac{d}{h \cdot \ell}}\\
\mathbf{elif}\;\ell \leq 8 \cdot 10^{+130}:\\
\;\;\;\;t\_0 \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.89999999999999988e41Initial program 55.2%
Simplified55.2%
Taylor expanded in d around inf 49.0%
if -2.89999999999999988e41 < l < -2.39999999999999991e-301Initial program 72.2%
Simplified71.0%
add-sqr-sqrt70.7%
pow270.7%
sqrt-unprod61.7%
pow1/261.7%
sqrt-pow161.7%
metadata-eval61.7%
Applied egg-rr61.7%
*-un-lft-identity61.7%
pow-pow61.9%
metadata-eval61.9%
pow1/261.9%
frac-times48.8%
pow248.8%
Applied egg-rr48.8%
*-lft-identity48.8%
associate-/r*47.3%
Simplified47.3%
associate-/r*48.8%
unpow248.8%
associate-/l*59.5%
*-commutative59.5%
Applied egg-rr59.5%
if -2.39999999999999991e-301 < l < 8.0000000000000005e130Initial program 76.7%
Simplified75.5%
add-sqr-sqrt75.4%
pow275.4%
sqrt-unprod68.0%
pow1/268.0%
sqrt-pow168.1%
metadata-eval68.1%
Applied egg-rr68.1%
Taylor expanded in d around 0 74.4%
unpow-174.4%
metadata-eval74.4%
pow-sqr74.4%
rem-sqrt-square74.4%
rem-square-sqrt74.3%
fabs-sqr74.3%
rem-square-sqrt74.4%
Simplified74.4%
if 8.0000000000000005e130 < l Initial program 61.9%
Simplified59.4%
Taylor expanded in d around inf 59.5%
*-un-lft-identity59.5%
pow1/259.5%
inv-pow59.5%
pow-pow59.5%
metadata-eval59.5%
Applied egg-rr59.5%
*-lft-identity59.5%
Simplified59.5%
metadata-eval59.5%
metadata-eval59.5%
pow-pow59.5%
inv-pow59.5%
pow-pow52.4%
add-sqr-sqrt52.4%
sqrt-unprod44.0%
swap-sqr43.7%
unpow243.7%
pow-pow44.1%
pow-pow48.0%
pow-sqr47.9%
metadata-eval47.9%
metadata-eval47.9%
pow147.9%
div-inv48.0%
associate-/r*45.9%
Applied egg-rr71.0%
Final simplification64.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -4.9e-214)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -5e-310)
(/ d (sqrt (+ -1.0 (fma l h 1.0))))
(if (<= l 1.25e+132)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(* d (pow (* h l) -0.5)))
(/ (/ d (sqrt h)) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -4.9e-214) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -5e-310) {
tmp = d / sqrt((-1.0 + fma(l, h, 1.0)));
} else if (l <= 1.25e+132) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * (d * pow((h * l), -0.5));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -4.9e-214) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -5e-310) tmp = Float64(d / sqrt(Float64(-1.0 + fma(l, h, 1.0)))); elseif (l <= 1.25e+132) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * Float64(d * (Float64(h * l) ^ -0.5))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -4.9e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-310], N[(d / N[Sqrt[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e+132], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{+132}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \left(d \cdot {\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.89999999999999968e-214Initial program 61.8%
Simplified60.9%
Taylor expanded in d around inf 7.5%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
neg-mul-145.0%
*-commutative45.0%
associate-/r*45.2%
Simplified45.2%
if -4.89999999999999968e-214 < l < -4.999999999999985e-310Initial program 78.1%
Simplified78.2%
Taylor expanded in d around inf 27.9%
*-un-lft-identity27.9%
pow1/227.9%
inv-pow27.9%
pow-pow27.9%
metadata-eval27.9%
Applied egg-rr27.9%
*-lft-identity27.9%
Simplified27.9%
metadata-eval27.9%
metadata-eval27.9%
pow-pow27.9%
inv-pow27.9%
pow-pow48.9%
add-sqr-sqrt0.0%
sqrt-unprod9.4%
swap-sqr9.4%
unpow29.4%
pow-pow9.4%
pow-pow9.6%
pow-sqr9.6%
metadata-eval9.6%
metadata-eval9.6%
pow19.6%
div-inv9.6%
sqrt-div13.7%
Applied egg-rr27.9%
expm1-log1p-u27.9%
expm1-undefine70.0%
Applied egg-rr70.0%
sub-neg70.0%
metadata-eval70.0%
+-commutative70.0%
log1p-undefine70.0%
rem-exp-log70.0%
+-commutative70.0%
fma-define70.0%
Simplified70.0%
if -4.999999999999985e-310 < l < 1.25e132Initial program 77.5%
Simplified76.3%
add-sqr-sqrt76.2%
pow276.2%
sqrt-unprod68.8%
pow1/268.8%
sqrt-pow168.8%
metadata-eval68.8%
Applied egg-rr68.8%
Taylor expanded in d around 0 75.2%
unpow-175.2%
metadata-eval75.2%
pow-sqr75.3%
rem-sqrt-square75.3%
rem-square-sqrt75.1%
fabs-sqr75.1%
rem-square-sqrt75.3%
Simplified75.3%
if 1.25e132 < l Initial program 61.9%
Simplified59.4%
Taylor expanded in d around inf 59.5%
*-un-lft-identity59.5%
pow1/259.5%
inv-pow59.5%
pow-pow59.5%
metadata-eval59.5%
Applied egg-rr59.5%
*-lft-identity59.5%
Simplified59.5%
metadata-eval59.5%
metadata-eval59.5%
pow-pow59.5%
inv-pow59.5%
pow-pow52.4%
add-sqr-sqrt52.4%
sqrt-unprod44.0%
swap-sqr43.7%
unpow243.7%
pow-pow44.1%
pow-pow48.0%
pow-sqr47.9%
metadata-eval47.9%
metadata-eval47.9%
pow147.9%
div-inv48.0%
associate-/r*45.9%
Applied egg-rr71.0%
Final simplification62.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(t_1 (- 1.0 t_0)))
(if (<= h -5e-310)
(* (* d (sqrt (/ 1.0 (* h l)))) (+ -1.0 t_0))
(if (<= h 1.6e+155)
(* t_1 (* d (sqrt (/ (/ 1.0 l) h))))
(* t_1 (sqrt (* (/ d l) (/ d h))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0));
double t_1 = 1.0 - t_0;
double tmp;
if (h <= -5e-310) {
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (h <= 1.6e+155) {
tmp = t_1 * (d * sqrt(((1.0 / l) / h)));
} else {
tmp = t_1 * sqrt(((d / l) * (d / h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0))
t_1 = 1.0d0 - t_0
if (h <= (-5d-310)) then
tmp = (d * sqrt((1.0d0 / (h * l)))) * ((-1.0d0) + t_0)
else if (h <= 1.6d+155) then
tmp = t_1 * (d * sqrt(((1.0d0 / l) / h)))
else
tmp = t_1 * sqrt(((d / l) * (d / h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = 0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0));
double t_1 = 1.0 - t_0;
double tmp;
if (h <= -5e-310) {
tmp = (d * Math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
} else if (h <= 1.6e+155) {
tmp = t_1 * (d * Math.sqrt(((1.0 / l) / h)));
} else {
tmp = t_1 * Math.sqrt(((d / l) * (d / h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = 0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)) t_1 = 1.0 - t_0 tmp = 0 if h <= -5e-310: tmp = (d * math.sqrt((1.0 / (h * l)))) * (-1.0 + t_0) elif h <= 1.6e+155: tmp = t_1 * (d * math.sqrt(((1.0 / l) / h))) else: tmp = t_1 * math.sqrt(((d / l) * (d / h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0))) t_1 = Float64(1.0 - t_0) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) * Float64(-1.0 + t_0)); elseif (h <= 1.6e+155) tmp = Float64(t_1 * Float64(d * sqrt(Float64(Float64(1.0 / l) / h)))); else tmp = Float64(t_1 * sqrt(Float64(Float64(d / l) * Float64(d / h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = 0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0));
t_1 = 1.0 - t_0;
tmp = 0.0;
if (h <= -5e-310)
tmp = (d * sqrt((1.0 / (h * l)))) * (-1.0 + t_0);
elseif (h <= 1.6e+155)
tmp = t_1 * (d * sqrt(((1.0 / l) / h)));
else
tmp = t_1 * sqrt(((d / l) * (d / h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.6e+155], N[(t$95$1 * N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\\
t_1 := 1 - t\_0\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \sqrt{\frac{1}{h \cdot \ell}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;h \leq 1.6 \cdot 10^{+155}:\\
\;\;\;\;t\_1 \cdot \left(d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 64.8%
Simplified64.1%
add-sqr-sqrt63.9%
pow263.9%
sqrt-unprod53.3%
pow1/253.3%
sqrt-pow153.3%
metadata-eval53.3%
Applied egg-rr53.3%
Taylor expanded in d around -inf 67.9%
if -4.999999999999985e-310 < h < 1.60000000000000006e155Initial program 73.5%
Simplified72.6%
add-sqr-sqrt72.5%
pow272.5%
sqrt-unprod65.3%
pow1/265.3%
sqrt-pow165.4%
metadata-eval65.4%
Applied egg-rr65.4%
Taylor expanded in d around 0 77.9%
unpow-177.9%
metadata-eval77.9%
pow-sqr78.0%
rem-sqrt-square78.0%
rem-square-sqrt77.8%
fabs-sqr77.8%
fabs-sqr77.8%
rem-square-sqrt78.0%
rem-sqrt-square78.0%
pow-sqr77.9%
metadata-eval77.9%
unpow-177.9%
*-commutative77.9%
associate-/r*78.9%
Simplified78.9%
if 1.60000000000000006e155 < h Initial program 68.8%
Simplified64.4%
pow164.4%
sqrt-unprod59.9%
Applied egg-rr59.9%
unpow159.9%
Simplified59.9%
Final simplification71.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= M 1.75e-151)
(fabs (/ d (sqrt (* h l))))
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M 2.0)) 2.0))))
(sqrt (* (/ d l) (/ d h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 1.75e-151) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M / 2.0)), 2.0)))) * sqrt(((d / l) * (d / h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (m <= 1.75d-151) then
tmp = abs((d / sqrt((h * l))))
else
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m / 2.0d0)) ** 2.0d0)))) * sqrt(((d / l) * (d / h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 1.75e-151) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * Math.sqrt(((d / l) * (d / h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if M <= 1.75e-151: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M / 2.0)), 2.0)))) * math.sqrt(((d / l) * (d / h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (M <= 1.75e-151) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M / 2.0)) ^ 2.0)))) * sqrt(Float64(Float64(d / l) * Float64(d / h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (M <= 1.75e-151)
tmp = abs((d / sqrt((h * l))));
else
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M / 2.0)) ^ 2.0)))) * sqrt(((d / l) * (d / h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 1.75e-151], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 1.75 \cdot 10^{-151}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M}{2}\right)}^{2}\right)\right) \cdot \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\end{array}
\end{array}
if M < 1.74999999999999998e-151Initial program 68.6%
Simplified66.8%
Taylor expanded in d around inf 33.2%
*-un-lft-identity33.2%
pow1/233.2%
inv-pow33.2%
pow-pow33.2%
metadata-eval33.2%
Applied egg-rr33.2%
*-lft-identity33.2%
Simplified33.2%
metadata-eval33.2%
metadata-eval33.2%
pow-pow33.2%
inv-pow33.2%
pow-pow32.2%
add-sqr-sqrt26.0%
sqrt-unprod29.4%
swap-sqr27.2%
unpow227.2%
pow-pow27.4%
pow-pow30.6%
pow-sqr30.6%
metadata-eval30.6%
metadata-eval30.6%
pow130.6%
div-inv30.6%
associate-/r*31.8%
add-sqr-sqrt31.8%
Applied egg-rr47.9%
if 1.74999999999999998e-151 < M Initial program 69.1%
Simplified69.2%
pow169.2%
sqrt-unprod62.6%
Applied egg-rr62.6%
unpow162.6%
Simplified62.6%
Final simplification53.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -5.9e-214)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -6.6e-301)
(/ d (sqrt (+ -1.0 (fma l h 1.0))))
(if (<= l 7.5e-168)
(/ d (- (sqrt (* h l))))
(/ (/ d (sqrt h)) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -5.9e-214) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -6.6e-301) {
tmp = d / sqrt((-1.0 + fma(l, h, 1.0)));
} else if (l <= 7.5e-168) {
tmp = d / -sqrt((h * l));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -5.9e-214) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -6.6e-301) tmp = Float64(d / sqrt(Float64(-1.0 + fma(l, h, 1.0)))); elseif (l <= 7.5e-168) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -5.9e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6.6e-301], N[(d / N[Sqrt[N[(-1.0 + N[(l * h + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.5e-168], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.9 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -6.6 \cdot 10^{-301}:\\
\;\;\;\;\frac{d}{\sqrt{-1 + \mathsf{fma}\left(\ell, h, 1\right)}}\\
\mathbf{elif}\;\ell \leq 7.5 \cdot 10^{-168}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.8999999999999998e-214Initial program 61.8%
Simplified60.9%
Taylor expanded in d around inf 7.5%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
neg-mul-145.0%
*-commutative45.0%
associate-/r*45.2%
Simplified45.2%
if -5.8999999999999998e-214 < l < -6.6000000000000001e-301Initial program 80.8%
Simplified80.9%
Taylor expanded in d around inf 30.4%
*-un-lft-identity30.4%
pow1/230.4%
inv-pow30.4%
pow-pow30.4%
metadata-eval30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
Simplified30.4%
metadata-eval30.4%
metadata-eval30.4%
pow-pow30.4%
inv-pow30.4%
pow-pow53.5%
add-sqr-sqrt0.0%
sqrt-unprod5.5%
swap-sqr5.5%
unpow25.5%
pow-pow5.5%
pow-pow5.7%
pow-sqr5.7%
metadata-eval5.7%
metadata-eval5.7%
pow15.7%
div-inv5.7%
sqrt-div10.2%
Applied egg-rr30.4%
expm1-log1p-u30.4%
expm1-undefine71.9%
Applied egg-rr71.9%
sub-neg71.9%
metadata-eval71.9%
+-commutative71.9%
log1p-undefine71.9%
rem-exp-log71.9%
+-commutative71.9%
fma-define71.9%
Simplified71.9%
if -6.6000000000000001e-301 < l < 7.4999999999999995e-168Initial program 79.7%
Simplified79.2%
Taylor expanded in d around inf 14.1%
*-un-lft-identity14.1%
pow1/214.1%
inv-pow14.1%
pow-pow14.1%
metadata-eval14.1%
Applied egg-rr14.1%
*-lft-identity14.1%
Simplified14.1%
metadata-eval14.1%
metadata-eval14.1%
pow-pow14.1%
inv-pow14.1%
pow-pow7.3%
add-sqr-sqrt7.2%
sqrt-unprod7.6%
swap-sqr7.6%
unpow27.6%
pow-pow7.6%
pow-pow14.3%
pow-sqr14.3%
metadata-eval14.3%
metadata-eval14.3%
pow114.3%
div-inv14.4%
sqrt-div14.4%
Applied egg-rr14.2%
sqrt-prod14.2%
add-sqr-sqrt14.1%
times-frac14.1%
sqrt-div10.9%
sqrt-div14.5%
add-sqr-sqrt14.5%
sqr-neg14.5%
sqrt-unprod0.0%
add-sqr-sqrt13.3%
distribute-lft-neg-out13.3%
sqrt-div9.6%
sqrt-div9.7%
times-frac9.7%
add-sqr-sqrt9.7%
sqrt-prod33.0%
neg-sub033.0%
Applied egg-rr33.0%
neg-sub033.0%
distribute-frac-neg233.0%
Simplified33.0%
if 7.4999999999999995e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
pow1/252.7%
inv-pow52.7%
pow-pow52.7%
metadata-eval52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
Simplified52.7%
metadata-eval52.7%
metadata-eval52.7%
pow-pow52.7%
inv-pow52.7%
pow-pow46.7%
add-sqr-sqrt46.7%
sqrt-unprod40.2%
swap-sqr39.2%
unpow239.2%
pow-pow39.6%
pow-pow41.9%
pow-sqr41.9%
metadata-eval41.9%
metadata-eval41.9%
pow141.9%
div-inv42.0%
associate-/r*42.1%
Applied egg-rr60.9%
Final simplification52.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= l -1.4e-214)
(* (- d) (sqrt (/ (/ 1.0 l) h)))
(if (<= l -8.5e-301)
(* d (cbrt (pow (* h l) -1.5)))
(if (<= l 7.1e-168)
(/ d (- (sqrt (* h l))))
(/ (/ d (sqrt h)) (sqrt l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.4e-214) {
tmp = -d * sqrt(((1.0 / l) / h));
} else if (l <= -8.5e-301) {
tmp = d * cbrt(pow((h * l), -1.5));
} else if (l <= 7.1e-168) {
tmp = d / -sqrt((h * l));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= -1.4e-214) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else if (l <= -8.5e-301) {
tmp = d * Math.cbrt(Math.pow((h * l), -1.5));
} else if (l <= 7.1e-168) {
tmp = d / -Math.sqrt((h * l));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= -1.4e-214) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); elseif (l <= -8.5e-301) tmp = Float64(d * cbrt((Float64(h * l) ^ -1.5))); elseif (l <= 7.1e-168) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, -1.4e-214], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -8.5e-301], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.1e-168], N[(d / (-N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-214}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{elif}\;\ell \leq -8.5 \cdot 10^{-301}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\
\mathbf{elif}\;\ell \leq 7.1 \cdot 10^{-168}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.4000000000000001e-214Initial program 61.8%
Simplified60.9%
Taylor expanded in d around inf 7.5%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt45.0%
neg-mul-145.0%
*-commutative45.0%
associate-/r*45.2%
Simplified45.2%
if -1.4000000000000001e-214 < l < -8.50000000000000046e-301Initial program 80.8%
Simplified80.9%
Taylor expanded in d around inf 30.4%
*-un-lft-identity30.4%
pow1/230.4%
inv-pow30.4%
pow-pow30.4%
metadata-eval30.4%
Applied egg-rr30.4%
*-lft-identity30.4%
Simplified30.4%
metadata-eval30.4%
metadata-eval30.4%
pow-pow30.4%
inv-pow30.4%
pow-pow53.5%
unpow1/353.5%
inv-pow53.5%
pow-pow53.5%
*-commutative53.5%
metadata-eval53.5%
Applied egg-rr53.5%
if -8.50000000000000046e-301 < l < 7.10000000000000019e-168Initial program 79.7%
Simplified79.2%
Taylor expanded in d around inf 14.1%
*-un-lft-identity14.1%
pow1/214.1%
inv-pow14.1%
pow-pow14.1%
metadata-eval14.1%
Applied egg-rr14.1%
*-lft-identity14.1%
Simplified14.1%
metadata-eval14.1%
metadata-eval14.1%
pow-pow14.1%
inv-pow14.1%
pow-pow7.3%
add-sqr-sqrt7.2%
sqrt-unprod7.6%
swap-sqr7.6%
unpow27.6%
pow-pow7.6%
pow-pow14.3%
pow-sqr14.3%
metadata-eval14.3%
metadata-eval14.3%
pow114.3%
div-inv14.4%
sqrt-div14.4%
Applied egg-rr14.2%
sqrt-prod14.2%
add-sqr-sqrt14.1%
times-frac14.1%
sqrt-div10.9%
sqrt-div14.5%
add-sqr-sqrt14.5%
sqr-neg14.5%
sqrt-unprod0.0%
add-sqr-sqrt13.3%
distribute-lft-neg-out13.3%
sqrt-div9.6%
sqrt-div9.7%
times-frac9.7%
add-sqr-sqrt9.7%
sqrt-prod33.0%
neg-sub033.0%
Applied egg-rr33.0%
neg-sub033.0%
distribute-frac-neg233.0%
Simplified33.0%
if 7.10000000000000019e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
pow1/252.7%
inv-pow52.7%
pow-pow52.7%
metadata-eval52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
Simplified52.7%
metadata-eval52.7%
metadata-eval52.7%
pow-pow52.7%
inv-pow52.7%
pow-pow46.7%
add-sqr-sqrt46.7%
sqrt-unprod40.2%
swap-sqr39.2%
unpow239.2%
pow-pow39.6%
pow-pow41.9%
pow-sqr41.9%
metadata-eval41.9%
metadata-eval41.9%
pow141.9%
div-inv42.0%
associate-/r*42.1%
Applied egg-rr60.9%
Final simplification50.9%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l 5.6e-167) (* (- d) (sqrt (/ (/ 1.0 l) h))) (/ (/ d (sqrt h)) (sqrt l))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 5.6e-167) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = (d / sqrt(h)) / sqrt(l);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 5.6d-167) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = (d / sqrt(h)) / sqrt(l)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 5.6e-167) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = (d / Math.sqrt(h)) / Math.sqrt(l);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 5.6e-167: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = (d / math.sqrt(h)) / math.sqrt(l) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 5.6e-167) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(Float64(d / sqrt(h)) / sqrt(l)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 5.6e-167)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = (d / sqrt(h)) / sqrt(l);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 5.6e-167], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 5.6 \cdot 10^{-167}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 5.59999999999999971e-167Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt37.9%
neg-mul-137.9%
*-commutative37.9%
associate-/r*38.0%
Simplified38.0%
if 5.59999999999999971e-167 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
pow1/252.7%
inv-pow52.7%
pow-pow52.7%
metadata-eval52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
Simplified52.7%
metadata-eval52.7%
metadata-eval52.7%
pow-pow52.7%
inv-pow52.7%
pow-pow46.7%
add-sqr-sqrt46.7%
sqrt-unprod40.2%
swap-sqr39.2%
unpow239.2%
pow-pow39.6%
pow-pow41.9%
pow-sqr41.9%
metadata-eval41.9%
metadata-eval41.9%
pow141.9%
div-inv42.0%
associate-/r*42.1%
Applied egg-rr60.9%
Final simplification47.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= M 2.5e+18) (fabs (/ d (sqrt (* h l)))) (* (- d) (sqrt (/ (/ 1.0 l) h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.5e+18) {
tmp = fabs((d / sqrt((h * l))));
} else {
tmp = -d * sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (m <= 2.5d+18) then
tmp = abs((d / sqrt((h * l))))
else
tmp = -d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (M <= 2.5e+18) {
tmp = Math.abs((d / Math.sqrt((h * l))));
} else {
tmp = -d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if M <= 2.5e+18: tmp = math.fabs((d / math.sqrt((h * l)))) else: tmp = -d * math.sqrt(((1.0 / l) / h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (M <= 2.5e+18) tmp = abs(Float64(d / sqrt(Float64(h * l)))); else tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (M <= 2.5e+18)
tmp = abs((d / sqrt((h * l))));
else
tmp = -d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[M, 2.5e+18], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 2.5 \cdot 10^{+18}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if M < 2.5e18Initial program 68.5%
Simplified66.9%
Taylor expanded in d around inf 33.4%
*-un-lft-identity33.4%
pow1/233.4%
inv-pow33.4%
pow-pow33.5%
metadata-eval33.5%
Applied egg-rr33.5%
*-lft-identity33.5%
Simplified33.5%
metadata-eval33.5%
metadata-eval33.5%
pow-pow33.4%
inv-pow33.4%
pow-pow31.9%
add-sqr-sqrt26.1%
sqrt-unprod29.5%
swap-sqr27.6%
unpow227.6%
pow-pow27.8%
pow-pow31.7%
pow-sqr31.8%
metadata-eval31.8%
metadata-eval31.8%
pow131.8%
div-inv31.8%
associate-/r*33.8%
add-sqr-sqrt33.8%
Applied egg-rr47.9%
if 2.5e18 < M Initial program 69.9%
Simplified70.0%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt25.0%
neg-mul-125.0%
*-commutative25.0%
associate-/r*25.0%
Simplified25.0%
Final simplification42.6%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l 7.8e-168) (* (- d) (sqrt (/ (/ 1.0 l) h))) (* d (sqrt (* (/ 1.0 l) (/ 1.0 h))))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 7.8e-168) {
tmp = -d * sqrt(((1.0 / l) / h));
} else {
tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 7.8d-168) then
tmp = -d * sqrt(((1.0d0 / l) / h))
else
tmp = d * sqrt(((1.0d0 / l) * (1.0d0 / h)))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 7.8e-168) {
tmp = -d * Math.sqrt(((1.0 / l) / h));
} else {
tmp = d * Math.sqrt(((1.0 / l) * (1.0 / h)));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 7.8e-168: tmp = -d * math.sqrt(((1.0 / l) / h)) else: tmp = d * math.sqrt(((1.0 / l) * (1.0 / h))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 7.8e-168) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / l) / h))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) * Float64(1.0 / h)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 7.8e-168)
tmp = -d * sqrt(((1.0 / l) / h));
else
tmp = d * sqrt(((1.0 / l) * (1.0 / h)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 7.8e-168], N[((-d) * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] * N[(1.0 / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{\ell} \cdot \frac{1}{h}}\\
\end{array}
\end{array}
if l < 7.80000000000000025e-168Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt37.9%
neg-mul-137.9%
*-commutative37.9%
associate-/r*38.0%
Simplified38.0%
if 7.80000000000000025e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
inv-pow52.7%
*-commutative52.7%
unpow-prod-down53.9%
inv-pow53.9%
inv-pow53.9%
Applied egg-rr53.9%
Final simplification44.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (let* ((t_0 (sqrt (/ (/ 1.0 l) h)))) (if (<= l 7.1e-168) (* (- d) t_0) (* d t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(((1.0 / l) / h));
double tmp;
if (l <= 7.1e-168) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / l) / h))
if (l <= 7.1d-168) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt(((1.0 / l) / h));
double tmp;
if (l <= 7.1e-168) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt(((1.0 / l) / h)) tmp = 0 if l <= 7.1e-168: tmp = -d * t_0 else: tmp = d * t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(Float64(1.0 / l) / h)) tmp = 0.0 if (l <= 7.1e-168) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt(((1.0 / l) / h));
tmp = 0.0;
if (l <= 7.1e-168)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, 7.1e-168], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\mathbf{if}\;\ell \leq 7.1 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < 7.10000000000000019e-168Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt37.9%
neg-mul-137.9%
*-commutative37.9%
associate-/r*38.0%
Simplified38.0%
if 7.10000000000000019e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
*-commutative52.7%
associate-/r*53.8%
Simplified53.8%
Final simplification44.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l 7.2e-168) (* (- d) (pow (* h l) -0.5)) (* d (sqrt (/ (/ 1.0 l) h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 7.2e-168) {
tmp = -d * pow((h * l), -0.5);
} else {
tmp = d * sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 7.2d-168) then
tmp = -d * ((h * l) ** (-0.5d0))
else
tmp = d * sqrt(((1.0d0 / l) / h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 7.2e-168) {
tmp = -d * Math.pow((h * l), -0.5);
} else {
tmp = d * Math.sqrt(((1.0 / l) / h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 7.2e-168: tmp = -d * math.pow((h * l), -0.5) else: tmp = d * math.sqrt(((1.0 / l) / h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 7.2e-168) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / l) / h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 7.2e-168)
tmp = -d * ((h * l) ^ -0.5);
else
tmp = d * sqrt(((1.0 / l) / h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 7.2e-168], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / l), $MachinePrecision] / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 7.2 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{\ell}}{h}}\\
\end{array}
\end{array}
if l < 7.1999999999999998e-168Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt37.9%
neg-mul-137.9%
unpow-137.9%
metadata-eval37.9%
pow-sqr37.9%
rem-sqrt-square37.9%
rem-square-sqrt37.7%
fabs-sqr37.7%
rem-square-sqrt37.9%
Simplified37.9%
if 7.1999999999999998e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
*-commutative52.7%
associate-/r*53.8%
Simplified53.8%
Final simplification44.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (let* ((t_0 (pow (* h l) -0.5))) (if (<= l 7.8e-168) (* (- d) t_0) (* d t_0))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = pow((h * l), -0.5);
double tmp;
if (l <= 7.8e-168) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = (h * l) ** (-0.5d0)
if (l <= 7.8d-168) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.pow((h * l), -0.5);
double tmp;
if (l <= 7.8e-168) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.pow((h * l), -0.5) tmp = 0 if l <= 7.8e-168: tmp = -d * t_0 else: tmp = d * t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(h * l) ^ -0.5 tmp = 0.0 if (l <= 7.8e-168) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (l <= 7.8e-168)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[l, 7.8e-168], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-168}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < 7.80000000000000025e-168Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt37.9%
neg-mul-137.9%
unpow-137.9%
metadata-eval37.9%
pow-sqr37.9%
rem-sqrt-square37.9%
rem-square-sqrt37.7%
fabs-sqr37.7%
rem-square-sqrt37.9%
Simplified37.9%
if 7.80000000000000025e-168 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
pow1/252.7%
inv-pow52.7%
pow-pow52.7%
metadata-eval52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
Simplified52.7%
Final simplification43.9%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= l 1.15e-167) (/ d (- (sqrt (* h l)))) (* d (pow (* h l) -0.5))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.15e-167) {
tmp = d / -sqrt((h * l));
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (l <= 1.15d-167) then
tmp = d / -sqrt((h * l))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (l <= 1.15e-167) {
tmp = d / -Math.sqrt((h * l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if l <= 1.15e-167: tmp = d / -math.sqrt((h * l)) else: tmp = d * math.pow((h * l), -0.5) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (l <= 1.15e-167) tmp = Float64(d / Float64(-sqrt(Float64(h * l)))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (l <= 1.15e-167)
tmp = d / -sqrt((h * l));
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[l, 1.15e-167], 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}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.15 \cdot 10^{-167}:\\
\;\;\;\;\frac{d}{-\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < 1.1500000000000001e-167Initial program 67.9%
Simplified67.1%
Taylor expanded in d around inf 12.0%
*-un-lft-identity12.0%
pow1/212.0%
inv-pow12.0%
pow-pow12.0%
metadata-eval12.0%
Applied egg-rr12.0%
*-lft-identity12.0%
Simplified12.0%
metadata-eval12.0%
metadata-eval12.0%
pow-pow12.0%
inv-pow12.0%
pow-pow13.8%
add-sqr-sqrt4.5%
sqrt-unprod17.5%
swap-sqr15.7%
unpow215.7%
pow-pow15.8%
pow-pow19.5%
pow-sqr19.5%
metadata-eval19.5%
metadata-eval19.5%
pow119.5%
div-inv19.5%
sqrt-div22.6%
Applied egg-rr12.0%
sqrt-prod2.7%
add-sqr-sqrt2.7%
times-frac2.7%
sqrt-div2.1%
sqrt-div32.0%
add-sqr-sqrt32.0%
sqr-neg32.0%
sqrt-unprod2.2%
add-sqr-sqrt11.1%
distribute-lft-neg-out11.1%
sqrt-div1.8%
sqrt-div1.8%
times-frac1.8%
add-sqr-sqrt1.8%
sqrt-prod37.8%
neg-sub037.8%
Applied egg-rr37.8%
neg-sub037.8%
distribute-frac-neg237.8%
Simplified37.8%
if 1.1500000000000001e-167 < l Initial program 70.2%
Simplified68.4%
Taylor expanded in d around inf 52.7%
*-un-lft-identity52.7%
pow1/252.7%
inv-pow52.7%
pow-pow52.7%
metadata-eval52.7%
Applied egg-rr52.7%
*-lft-identity52.7%
Simplified52.7%
Final simplification43.9%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* h l))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d / sqrt((h * l));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d / sqrt((h * l))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d / Math.sqrt((h * l));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d / math.sqrt((h * l))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d / sqrt(Float64(h * l))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d / sqrt((h * l));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 68.8%
Simplified67.6%
Taylor expanded in d around inf 28.5%
*-un-lft-identity28.5%
pow1/228.5%
inv-pow28.5%
pow-pow28.5%
metadata-eval28.5%
Applied egg-rr28.5%
*-lft-identity28.5%
Simplified28.5%
metadata-eval28.5%
metadata-eval28.5%
pow-pow28.5%
inv-pow28.5%
pow-pow27.2%
add-sqr-sqrt21.7%
sqrt-unprod26.7%
swap-sqr25.2%
unpow225.2%
pow-pow25.4%
pow-pow28.6%
pow-sqr28.6%
metadata-eval28.6%
metadata-eval28.6%
pow128.6%
div-inv28.6%
sqrt-div31.2%
Applied egg-rr28.5%
Final simplification28.5%
herbie shell --seed 2024143
(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)))))