
(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 23 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}
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(t_1 (/ d (* (sqrt l) (sqrt h)))))
(if (<= l -5e-310)
(* (* d (/ (sqrt (/ -1.0 l)) (sqrt (- h)))) (+ -1.0 t_0))
(if (<= l 2.35e+42)
(* (- 1.0 t_0) t_1)
(*
t_1
(-
1.0
(* 0.5 (pow (* D_m (* (* M_m (/ 0.5 d)) (sqrt (/ h l)))) 2.0))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double t_1 = d / (sqrt(l) * sqrt(h));
double tmp;
if (l <= -5e-310) {
tmp = (d * (sqrt((-1.0 / l)) / sqrt(-h))) * (-1.0 + t_0);
} else if (l <= 2.35e+42) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = t_1 * (1.0 - (0.5 * pow((D_m * ((M_m * (0.5 / d)) * sqrt((h / l)))), 2.0)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)
t_1 = d / (sqrt(l) * sqrt(h))
if (l <= (-5d-310)) then
tmp = (d * (sqrt(((-1.0d0) / l)) / sqrt(-h))) * ((-1.0d0) + t_0)
else if (l <= 2.35d+42) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = t_1 * (1.0d0 - (0.5d0 * ((d_m * ((m_m * (0.5d0 / d)) * sqrt((h / l)))) ** 2.0d0)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double t_1 = d / (Math.sqrt(l) * Math.sqrt(h));
double tmp;
if (l <= -5e-310) {
tmp = (d * (Math.sqrt((-1.0 / l)) / Math.sqrt(-h))) * (-1.0 + t_0);
} else if (l <= 2.35e+42) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = t_1 * (1.0 - (0.5 * Math.pow((D_m * ((M_m * (0.5 / d)) * Math.sqrt((h / l)))), 2.0)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l) t_1 = d / (math.sqrt(l) * math.sqrt(h)) tmp = 0 if l <= -5e-310: tmp = (d * (math.sqrt((-1.0 / l)) / math.sqrt(-h))) * (-1.0 + t_0) elif l <= 2.35e+42: tmp = (1.0 - t_0) * t_1 else: tmp = t_1 * (1.0 - (0.5 * math.pow((D_m * ((M_m * (0.5 / d)) * math.sqrt((h / l)))), 2.0))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) t_1 = Float64(d / Float64(sqrt(l) * sqrt(h))) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * Float64(sqrt(Float64(-1.0 / l)) / sqrt(Float64(-h)))) * Float64(-1.0 + t_0)); elseif (l <= 2.35e+42) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(t_1 * Float64(1.0 - Float64(0.5 * (Float64(D_m * Float64(Float64(M_m * Float64(0.5 / d)) * sqrt(Float64(h / l)))) ^ 2.0)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l);
t_1 = d / (sqrt(l) * sqrt(h));
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * (sqrt((-1.0 / l)) / sqrt(-h))) * (-1.0 + t_0);
elseif (l <= 2.35e+42)
tmp = (1.0 - t_0) * t_1;
else
tmp = t_1 * (1.0 - (0.5 * ((D_m * ((M_m * (0.5 / d)) * sqrt((h / l)))) ^ 2.0)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(d * N[(N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.35e+42], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
t_1 := \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \frac{\sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 2.35 \cdot 10^{+42}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - 0.5 \cdot {\left(D\_m \cdot \left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot \sqrt{\frac{h}{\ell}}\right)\right)}^{2}\right)\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
*-commutative0.0%
sqrt-prod68.7%
div-inv68.7%
frac-2neg68.7%
sqrt-div84.0%
distribute-neg-frac84.0%
metadata-eval84.0%
Applied egg-rr84.0%
if -4.999999999999985e-310 < l < 2.34999999999999993e42Initial program 70.5%
Simplified70.4%
associate-*r/79.6%
frac-times79.7%
associate-/l*79.6%
*-un-lft-identity79.6%
times-frac79.6%
metadata-eval79.6%
Applied egg-rr79.6%
*-commutative79.6%
sqrt-div85.4%
sqrt-div91.9%
frac-times91.8%
add-sqr-sqrt92.0%
Applied egg-rr92.0%
if 2.34999999999999993e42 < l Initial program 62.9%
Simplified61.1%
*-commutative61.0%
sqrt-div68.7%
sqrt-div81.5%
frac-times81.6%
add-sqr-sqrt81.9%
Applied egg-rr81.8%
add-sqr-sqrt81.8%
pow281.8%
sqrt-prod81.8%
sqrt-pow186.0%
metadata-eval86.0%
pow186.0%
frac-times85.7%
associate-/l*86.0%
*-un-lft-identity86.0%
times-frac86.0%
metadata-eval86.0%
Applied egg-rr86.0%
associate-*r*86.0%
*-commutative86.0%
associate-*l/85.7%
associate-/l*88.0%
*-commutative88.0%
associate-*r/88.0%
associate-*l*88.0%
associate-*r/88.0%
*-commutative88.0%
associate-/l*88.0%
Simplified88.0%
Final simplification87.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(t_1 (* (sqrt l) (sqrt h))))
(if (<= l -5e-310)
(* (* d (/ (sqrt (/ -1.0 l)) (sqrt (- h)))) (+ -1.0 t_0))
(if (<= l 7.2e-84)
(* (- 1.0 t_0) (/ d t_1))
(*
d
(/
(fma (pow (* D_m (/ M_m (* d 2.0))) 2.0) (/ (* h -0.5) l) 1.0)
t_1))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double t_1 = sqrt(l) * sqrt(h);
double tmp;
if (l <= -5e-310) {
tmp = (d * (sqrt((-1.0 / l)) / sqrt(-h))) * (-1.0 + t_0);
} else if (l <= 7.2e-84) {
tmp = (1.0 - t_0) * (d / t_1);
} else {
tmp = d * (fma(pow((D_m * (M_m / (d * 2.0))), 2.0), ((h * -0.5) / l), 1.0) / t_1);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * Float64(sqrt(Float64(-1.0 / l)) / sqrt(Float64(-h)))) * Float64(-1.0 + t_0)); elseif (l <= 7.2e-84) tmp = Float64(Float64(1.0 - t_0) * Float64(d / t_1)); else tmp = Float64(d * Float64(fma((Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h * -0.5) / l), 1.0) / t_1)); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(d * N[(N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 7.2e-84], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d / t$95$1), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \frac{\sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 7.2 \cdot 10^{-84}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{d}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left({\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, \frac{h \cdot -0.5}{\ell}, 1\right)}{t\_1}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
*-commutative0.0%
sqrt-prod68.7%
div-inv68.7%
frac-2neg68.7%
sqrt-div84.0%
distribute-neg-frac84.0%
metadata-eval84.0%
Applied egg-rr84.0%
if -4.999999999999985e-310 < l < 7.20000000000000007e-84Initial program 71.1%
Simplified71.0%
associate-*r/83.9%
frac-times84.0%
associate-/l*83.9%
*-un-lft-identity83.9%
times-frac83.9%
metadata-eval83.9%
Applied egg-rr83.9%
*-commutative83.9%
sqrt-div90.5%
sqrt-div95.9%
frac-times95.8%
add-sqr-sqrt96.1%
Applied egg-rr96.1%
if 7.20000000000000007e-84 < l Initial program 64.8%
Simplified63.5%
pow163.5%
Applied egg-rr81.9%
unpow181.9%
associate-*l/86.0%
associate-/l*86.1%
*-commutative86.1%
metadata-eval86.1%
times-frac86.1%
*-rgt-identity86.1%
associate-/l*86.1%
*-commutative86.1%
associate-/l*86.1%
*-commutative86.1%
*-commutative86.1%
Simplified86.1%
Final simplification87.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* M_m (* 0.5 (/ D_m d))) 2.0))
(t_1 (* 0.5 (/ (* h t_0) l))))
(if (<= d -3.8e+201)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (+ 1.0 (* t_0 (/ (* h -0.5) l)))))
(if (<= d -5e-310)
(* (* d (pow (* l h) -0.5)) (+ -1.0 t_1))
(* (- 1.0 t_1) (/ d (* (sqrt l) (sqrt h))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((M_m * (0.5 * (D_m / d))), 2.0);
double t_1 = 0.5 * ((h * t_0) / l);
double tmp;
if (d <= -3.8e+201) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
} else if (d <= -5e-310) {
tmp = (d * pow((l * h), -0.5)) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (m_m * (0.5d0 * (d_m / d))) ** 2.0d0
t_1 = 0.5d0 * ((h * t_0) / l)
if (d <= (-3.8d+201)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (t_0 * ((h * (-0.5d0)) / l))))
else if (d <= (-5d-310)) then
tmp = (d * ((l * h) ** (-0.5d0))) * ((-1.0d0) + t_1)
else
tmp = (1.0d0 - t_1) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((M_m * (0.5 * (D_m / d))), 2.0);
double t_1 = 0.5 * ((h * t_0) / l);
double tmp;
if (d <= -3.8e+201) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
} else if (d <= -5e-310) {
tmp = (d * Math.pow((l * h), -0.5)) * (-1.0 + t_1);
} else {
tmp = (1.0 - t_1) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((M_m * (0.5 * (D_m / d))), 2.0) t_1 = 0.5 * ((h * t_0) / l) tmp = 0 if d <= -3.8e+201: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (t_0 * ((h * -0.5) / l)))) elif d <= -5e-310: tmp = (d * math.pow((l * h), -0.5)) * (-1.0 + t_1) else: tmp = (1.0 - t_1) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0 t_1 = Float64(0.5 * Float64(Float64(h * t_0) / l)) tmp = 0.0 if (d <= -3.8e+201) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(t_0 * Float64(Float64(h * -0.5) / l))))); elseif (d <= -5e-310) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(-1.0 + t_1)); else tmp = Float64(Float64(1.0 - t_1) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (M_m * (0.5 * (D_m / d))) ^ 2.0;
t_1 = 0.5 * ((h * t_0) / l);
tmp = 0.0;
if (d <= -3.8e+201)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (t_0 * ((h * -0.5) / l))));
elseif (d <= -5e-310)
tmp = (d * ((l * h) ^ -0.5)) * (-1.0 + t_1);
else
tmp = (1.0 - t_1) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.8e+201], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(t$95$0 * N[(N[(h * -0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$1), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}\\
t_1 := 0.5 \cdot \frac{h \cdot t\_0}{\ell}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{+201}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + t\_0 \cdot \frac{h \cdot -0.5}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(-1 + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_1\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999995e201Initial program 89.6%
Simplified93.3%
fma-undefine93.3%
metadata-eval93.3%
associate-*r/89.6%
times-frac89.6%
*-un-lft-identity89.6%
associate-/l*93.3%
*-un-lft-identity93.3%
times-frac93.3%
metadata-eval93.3%
associate-*r/93.3%
Applied egg-rr93.3%
if -3.79999999999999995e201 < d < -4.999999999999985e-310Initial program 60.7%
Simplified60.6%
associate-*r/64.6%
frac-times65.6%
associate-/l*64.6%
*-un-lft-identity64.6%
times-frac64.6%
metadata-eval64.6%
Applied egg-rr64.6%
clear-num64.6%
sqrt-div64.5%
metadata-eval64.5%
Applied egg-rr64.5%
Taylor expanded in d around -inf 64.2%
mul-1-neg64.2%
unpow-164.2%
metadata-eval64.2%
pow-sqr64.2%
rem-sqrt-square64.8%
metadata-eval64.8%
pow-sqr64.6%
fabs-sqr64.6%
pow-sqr64.8%
metadata-eval64.8%
distribute-rgt-neg-in64.8%
Simplified64.8%
if -4.999999999999985e-310 < d Initial program 67.5%
Simplified66.7%
associate-*r/72.2%
frac-times73.0%
associate-/l*72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
Applied egg-rr72.2%
*-commutative72.2%
sqrt-div78.8%
sqrt-div87.8%
frac-times87.7%
add-sqr-sqrt88.0%
Applied egg-rr88.0%
Final simplification79.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(if (<= l -9.8e-238)
(* (* d (pow (* l h) -0.5)) (+ -1.0 t_0))
(if (<= l 1.25e-159)
(* (- 1.0 t_0) (sqrt (* (/ d h) (/ d l))))
(*
(/ d (* (sqrt l) (sqrt h)))
(- 1.0 (* 0.125 (* (/ h l) (pow (* D_m (/ M_m d)) 2.0)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (l <= -9.8e-238) {
tmp = (d * pow((l * h), -0.5)) * (-1.0 + t_0);
} else if (l <= 1.25e-159) {
tmp = (1.0 - t_0) * sqrt(((d / h) * (d / l)));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.125 * ((h / l) * pow((D_m * (M_m / d)), 2.0))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)
if (l <= (-9.8d-238)) then
tmp = (d * ((l * h) ** (-0.5d0))) * ((-1.0d0) + t_0)
else if (l <= 1.25d-159) then
tmp = (1.0d0 - t_0) * sqrt(((d / h) * (d / l)))
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 - (0.125d0 * ((h / l) * ((d_m * (m_m / d)) ** 2.0d0))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (l <= -9.8e-238) {
tmp = (d * Math.pow((l * h), -0.5)) * (-1.0 + t_0);
} else if (l <= 1.25e-159) {
tmp = (1.0 - t_0) * Math.sqrt(((d / h) * (d / l)));
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 - (0.125 * ((h / l) * Math.pow((D_m * (M_m / d)), 2.0))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l) tmp = 0 if l <= -9.8e-238: tmp = (d * math.pow((l * h), -0.5)) * (-1.0 + t_0) elif l <= 1.25e-159: tmp = (1.0 - t_0) * math.sqrt(((d / h) * (d / l))) else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 - (0.125 * ((h / l) * math.pow((D_m * (M_m / d)), 2.0)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) tmp = 0.0 if (l <= -9.8e-238) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(-1.0 + t_0)); elseif (l <= 1.25e-159) tmp = Float64(Float64(1.0 - t_0) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 - Float64(0.125 * Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / d)) ^ 2.0))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l);
tmp = 0.0;
if (l <= -9.8e-238)
tmp = (d * ((l * h) ^ -0.5)) * (-1.0 + t_0);
elseif (l <= 1.25e-159)
tmp = (1.0 - t_0) * sqrt(((d / h) * (d / l)));
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 - (0.125 * ((h / l) * ((D_m * (M_m / d)) ^ 2.0))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9.8e-238], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.25e-159], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.125 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq -9.8 \cdot 10^{-238}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 1.25 \cdot 10^{-159}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 - 0.125 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right)\right)\\
\end{array}
\end{array}
if l < -9.7999999999999996e-238Initial program 62.7%
Simplified63.5%
associate-*r/67.3%
frac-times67.3%
associate-/l*67.3%
*-un-lft-identity67.3%
times-frac67.3%
metadata-eval67.3%
Applied egg-rr67.3%
clear-num67.2%
sqrt-div67.2%
metadata-eval67.2%
Applied egg-rr67.2%
Taylor expanded in d around -inf 65.7%
mul-1-neg65.7%
unpow-165.7%
metadata-eval65.7%
pow-sqr65.7%
rem-sqrt-square66.2%
metadata-eval66.2%
pow-sqr66.1%
fabs-sqr66.1%
pow-sqr66.2%
metadata-eval66.2%
distribute-rgt-neg-in66.2%
Simplified66.2%
if -9.7999999999999996e-238 < l < 1.25000000000000008e-159Initial program 81.5%
Simplified81.4%
associate-*r/90.8%
frac-times90.9%
associate-/l*90.8%
*-un-lft-identity90.8%
times-frac90.8%
metadata-eval90.8%
Applied egg-rr90.8%
*-commutative90.8%
sqrt-unprod89.3%
Applied egg-rr89.3%
if 1.25000000000000008e-159 < l Initial program 64.1%
Simplified63.0%
*-commutative65.1%
sqrt-div72.1%
sqrt-div84.5%
frac-times84.4%
add-sqr-sqrt84.7%
Applied egg-rr82.6%
Taylor expanded in M around 0 46.7%
associate-*r*48.9%
times-frac47.9%
associate-/l*48.9%
unpow248.9%
unpow248.9%
unpow248.9%
times-frac69.6%
swap-sqr82.6%
associate-/l*81.5%
associate-/l*82.6%
unpow282.6%
associate-/l*82.6%
Simplified82.6%
Final simplification76.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5e-310)
(*
(* d (pow (* l h) -0.5))
(+ -1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(if (<= l 3.6e+192)
(*
d
(/
(fma -0.5 (* h (/ (* 0.25 (pow (* D_m (/ M_m d)) 2.0)) l)) 1.0)
(sqrt (* l h))))
(/ (/ d (sqrt l)) (sqrt h)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5e-310) {
tmp = (d * pow((l * h), -0.5)) * (-1.0 + (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)));
} else if (l <= 3.6e+192) {
tmp = d * (fma(-0.5, (h * ((0.25 * pow((D_m * (M_m / d)), 2.0)) / l)), 1.0) / sqrt((l * h)));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(-1.0 + Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)))); elseif (l <= 3.6e+192) tmp = Float64(d * Float64(fma(-0.5, Float64(h * Float64(Float64(0.25 * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) / l)), 1.0) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5e-310], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.6e+192], N[(d * N[(N[(-0.5 * N[(h * N[(N[(0.25 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(-1 + 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;\ell \leq 3.6 \cdot 10^{+192}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(-0.5, h \cdot \frac{0.25 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}, 1\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
if -4.999999999999985e-310 < l < 3.6000000000000002e192Initial program 68.4%
Simplified68.4%
*-commutative75.0%
sqrt-div82.0%
sqrt-div87.5%
frac-times87.4%
add-sqr-sqrt87.6%
Applied egg-rr79.2%
associate-*l/82.0%
cancel-sign-sub-inv82.0%
metadata-eval82.0%
*-commutative82.0%
div-inv82.0%
metadata-eval82.0%
sqrt-unprod72.7%
*-commutative72.7%
Applied egg-rr72.7%
associate-/l*72.7%
Simplified81.1%
if 3.6000000000000002e192 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification75.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(if (<= l -5e-310)
(* (* d (/ (sqrt (/ -1.0 l)) (sqrt (- h)))) (+ -1.0 t_0))
(* (- 1.0 t_0) (/ d (* (sqrt l) (sqrt h)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (l <= -5e-310) {
tmp = (d * (sqrt((-1.0 / l)) / sqrt(-h))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)
if (l <= (-5d-310)) then
tmp = (d * (sqrt(((-1.0d0) / l)) / sqrt(-h))) * ((-1.0d0) + t_0)
else
tmp = (1.0d0 - t_0) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (l <= -5e-310) {
tmp = (d * (Math.sqrt((-1.0 / l)) / Math.sqrt(-h))) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l) tmp = 0 if l <= -5e-310: tmp = (d * (math.sqrt((-1.0 / l)) / math.sqrt(-h))) * (-1.0 + t_0) else: tmp = (1.0 - t_0) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(d * Float64(sqrt(Float64(-1.0 / l)) / sqrt(Float64(-h)))) * Float64(-1.0 + t_0)); else tmp = Float64(Float64(1.0 - t_0) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l);
tmp = 0.0;
if (l <= -5e-310)
tmp = (d * (sqrt((-1.0 / l)) / sqrt(-h))) * (-1.0 + t_0);
else
tmp = (1.0 - t_0) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(d * N[(N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(d \cdot \frac{\sqrt{\frac{-1}{\ell}}}{\sqrt{-h}}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
*-commutative0.0%
sqrt-prod68.7%
div-inv68.7%
frac-2neg68.7%
sqrt-div84.0%
distribute-neg-frac84.0%
metadata-eval84.0%
Applied egg-rr84.0%
if -4.999999999999985e-310 < l Initial program 67.5%
Simplified66.7%
associate-*r/72.2%
frac-times73.0%
associate-/l*72.2%
*-un-lft-identity72.2%
times-frac72.2%
metadata-eval72.2%
Applied egg-rr72.2%
*-commutative72.2%
sqrt-div78.8%
sqrt-div87.8%
frac-times87.7%
add-sqr-sqrt88.0%
Applied egg-rr88.0%
Final simplification86.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))))
(if (<= l 7.8e-292)
(* t_0 (* (sqrt (/ d h)) (sqrt (/ d l))))
(* t_0 (/ d (* (sqrt l) (sqrt h)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l));
double tmp;
if (l <= 7.8e-292) {
tmp = t_0 * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = t_0 * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))
if (l <= 7.8d-292) then
tmp = t_0 * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = t_0 * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l));
double tmp;
if (l <= 7.8e-292) {
tmp = t_0 * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = t_0 * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)) tmp = 0 if l <= 7.8e-292: tmp = t_0 * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = t_0 * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) tmp = 0.0 if (l <= 7.8e-292) tmp = Float64(t_0 * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(t_0 * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l));
tmp = 0.0;
if (l <= 7.8e-292)
tmp = t_0 * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = t_0 * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 7.8e-292], N[(t$95$0 * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq 7.8 \cdot 10^{-292}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 7.8e-292Initial program 66.7%
Simplified67.4%
associate-*r/71.9%
frac-times71.8%
associate-/l*71.9%
*-un-lft-identity71.9%
times-frac71.9%
metadata-eval71.9%
Applied egg-rr71.9%
if 7.8e-292 < l Initial program 67.5%
Simplified66.7%
associate-*r/70.8%
frac-times71.7%
associate-/l*70.8%
*-un-lft-identity70.8%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.8%
*-commutative70.8%
sqrt-div77.7%
sqrt-div87.2%
frac-times87.1%
add-sqr-sqrt87.4%
Applied egg-rr87.4%
Final simplification79.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h 3.7e-300)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (/ (* 0.25 (pow (* D_m (/ M_m d)) 2.0)) l)))))
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 3.7e-300) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * ((0.25 * pow((D_m * (M_m / d)), 2.0)) / l))));
} else {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (h <= 3.7d-300) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * (h * ((0.25d0 * ((d_m * (m_m / d)) ** 2.0d0)) / l))))
else
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= 3.7e-300) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (h * ((0.25 * Math.pow((D_m * (M_m / d)), 2.0)) / l))));
} else {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if h <= 3.7e-300: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (h * ((0.25 * math.pow((D_m * (M_m / d)), 2.0)) / l)))) else: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= 3.7e-300) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64(Float64(0.25 * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) / l))))); else tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (h <= 3.7e-300)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * ((0.25 * ((D_m * (M_m / d)) ^ 2.0)) / l))));
else
tmp = (1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l))) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, 3.7e-300], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[(0.25 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq 3.7 \cdot 10^{-300}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{0.25 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < 3.7000000000000001e-300Initial program 67.0%
Simplified67.6%
associate-*r/70.8%
frac-times70.8%
associate-/l*70.8%
*-un-lft-identity70.8%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.8%
*-un-lft-identity70.8%
associate-/l*67.6%
associate-*r*67.6%
metadata-eval67.6%
div-inv67.6%
*-commutative67.6%
div-inv67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
*-commutative67.6%
associate-*l/70.8%
associate-/l*69.4%
unpow269.4%
associate-*l/68.7%
associate-*r*68.7%
associate-*l/68.7%
*-commutative68.7%
associate-*l/69.4%
associate-*r*69.4%
associate-*l/69.4%
*-commutative69.4%
swap-sqr69.4%
metadata-eval69.4%
unpow269.4%
associate-/l*69.4%
Simplified69.4%
if 3.7000000000000001e-300 < h Initial program 67.2%
Simplified66.5%
associate-*r/72.0%
frac-times72.8%
associate-/l*72.0%
*-un-lft-identity72.0%
times-frac72.0%
metadata-eval72.0%
Applied egg-rr72.0%
*-commutative72.0%
sqrt-div78.6%
sqrt-div87.7%
frac-times87.6%
add-sqr-sqrt87.9%
Applied egg-rr87.9%
Final simplification78.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))))
(if (<= h 3.7e-300)
(* (* d (pow (* l h) -0.5)) (+ -1.0 t_0))
(* (- 1.0 t_0) (/ d (* (sqrt l) (sqrt h)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (h <= 3.7e-300) {
tmp = (d * pow((l * h), -0.5)) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)
if (h <= 3.7d-300) then
tmp = (d * ((l * h) ** (-0.5d0))) * ((-1.0d0) + t_0)
else
tmp = (1.0d0 - t_0) * (d / (sqrt(l) * sqrt(h)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double tmp;
if (h <= 3.7e-300) {
tmp = (d * Math.pow((l * h), -0.5)) * (-1.0 + t_0);
} else {
tmp = (1.0 - t_0) * (d / (Math.sqrt(l) * Math.sqrt(h)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l) tmp = 0 if h <= 3.7e-300: tmp = (d * math.pow((l * h), -0.5)) * (-1.0 + t_0) else: tmp = (1.0 - t_0) * (d / (math.sqrt(l) * math.sqrt(h))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) tmp = 0.0 if (h <= 3.7e-300) tmp = Float64(Float64(d * (Float64(l * h) ^ -0.5)) * Float64(-1.0 + t_0)); else tmp = Float64(Float64(1.0 - t_0) * Float64(d / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l);
tmp = 0.0;
if (h <= 3.7e-300)
tmp = (d * ((l * h) ^ -0.5)) * (-1.0 + t_0);
else
tmp = (1.0 - t_0) * (d / (sqrt(l) * sqrt(h)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, 3.7e-300], N[(N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - t$95$0), $MachinePrecision] * N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;h \leq 3.7 \cdot 10^{-300}:\\
\;\;\;\;\left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right) \cdot \left(-1 + t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot \frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < 3.7000000000000001e-300Initial program 67.0%
Simplified67.6%
associate-*r/70.8%
frac-times70.8%
associate-/l*70.8%
*-un-lft-identity70.8%
times-frac70.8%
metadata-eval70.8%
Applied egg-rr70.8%
clear-num70.8%
sqrt-div70.7%
metadata-eval70.7%
Applied egg-rr70.7%
Taylor expanded in d around -inf 66.6%
mul-1-neg66.6%
unpow-166.6%
metadata-eval66.6%
pow-sqr66.6%
rem-sqrt-square67.1%
metadata-eval67.1%
pow-sqr66.9%
fabs-sqr66.9%
pow-sqr67.1%
metadata-eval67.1%
distribute-rgt-neg-in67.1%
Simplified67.1%
if 3.7000000000000001e-300 < h Initial program 67.2%
Simplified66.5%
associate-*r/72.0%
frac-times72.8%
associate-/l*72.0%
*-un-lft-identity72.0%
times-frac72.0%
metadata-eval72.0%
Applied egg-rr72.0%
*-commutative72.0%
sqrt-div78.6%
sqrt-div87.7%
frac-times87.6%
add-sqr-sqrt87.9%
Applied egg-rr87.9%
Final simplification77.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))))
(if (<= l -2.4e+103)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l 7.8e-292)
(* t_0 (sqrt (* (/ d h) (/ d l))))
(if (<= l 2.4e+192)
(* t_0 (* d (pow (* l h) -0.5)))
(/ (/ d (sqrt l)) (sqrt h)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l));
double tmp;
if (l <= -2.4e+103) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 7.8e-292) {
tmp = t_0 * sqrt(((d / h) * (d / l)));
} else if (l <= 2.4e+192) {
tmp = t_0 * (d * pow((l * h), -0.5));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))
if (l <= (-2.4d+103)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 7.8d-292) then
tmp = t_0 * sqrt(((d / h) * (d / l)))
else if (l <= 2.4d+192) then
tmp = t_0 * (d * ((l * h) ** (-0.5d0)))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l));
double tmp;
if (l <= -2.4e+103) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 7.8e-292) {
tmp = t_0 * Math.sqrt(((d / h) * (d / l)));
} else if (l <= 2.4e+192) {
tmp = t_0 * (d * Math.pow((l * h), -0.5));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l)) tmp = 0 if l <= -2.4e+103: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 7.8e-292: tmp = t_0 * math.sqrt(((d / h) * (d / l))) elif l <= 2.4e+192: tmp = t_0 * (d * math.pow((l * h), -0.5)) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) tmp = 0.0 if (l <= -2.4e+103) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 7.8e-292) tmp = Float64(t_0 * sqrt(Float64(Float64(d / h) * Float64(d / l)))); elseif (l <= 2.4e+192) tmp = Float64(t_0 * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l));
tmp = 0.0;
if (l <= -2.4e+103)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= 7.8e-292)
tmp = t_0 * sqrt(((d / h) * (d / l)));
elseif (l <= 2.4e+192)
tmp = t_0 * (d * ((l * h) ^ -0.5));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -2.4e+103], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 7.8e-292], N[(t$95$0 * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+192], N[(t$95$0 * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+103}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 7.8 \cdot 10^{-292}:\\
\;\;\;\;t\_0 \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+192}:\\
\;\;\;\;t\_0 \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.3999999999999998e103Initial program 42.1%
Simplified44.2%
Taylor expanded in d around inf 2.9%
+-commutative2.9%
fma-define2.9%
*-commutative2.9%
*-commutative2.9%
associate-/l*2.9%
unpow22.9%
unpow22.9%
unpow22.9%
times-frac3.3%
swap-sqr3.3%
unpow23.3%
associate-*r/3.3%
*-commutative3.3%
associate-/l*3.3%
Simplified3.3%
Taylor expanded in h around 0 4.8%
associate-/r*4.7%
unpow1/24.7%
associate-/r*4.8%
rem-exp-log4.8%
exp-neg4.8%
exp-prod4.8%
distribute-lft-neg-out4.8%
distribute-rgt-neg-in4.8%
metadata-eval4.8%
exp-to-pow4.8%
Simplified4.8%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod4.7%
div-inv4.7%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.6%
mul-1-neg51.6%
associate-/r*53.4%
Simplified53.4%
if -2.3999999999999998e103 < l < 7.8e-292Initial program 80.6%
Simplified80.5%
associate-*r/85.0%
frac-times86.2%
associate-/l*85.0%
*-un-lft-identity85.0%
times-frac85.0%
metadata-eval85.0%
Applied egg-rr85.0%
*-commutative85.0%
sqrt-unprod74.2%
Applied egg-rr74.2%
if 7.8e-292 < l < 2.3999999999999998e192Initial program 68.5%
Simplified68.4%
associate-*r/73.5%
frac-times73.5%
associate-/l*73.5%
*-un-lft-identity73.5%
times-frac73.5%
metadata-eval73.5%
Applied egg-rr73.5%
clear-num73.6%
sqrt-div74.3%
metadata-eval74.3%
Applied egg-rr74.3%
Taylor expanded in d around 0 78.4%
unpow-178.4%
metadata-eval78.4%
pow-sqr78.4%
rem-sqrt-square79.0%
metadata-eval79.0%
pow-sqr78.9%
fabs-sqr78.9%
pow-sqr79.0%
metadata-eval79.0%
Simplified79.0%
if 2.3999999999999998e192 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification73.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -7.2e+95)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -5e-310)
(*
(sqrt (* (/ d h) (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M_m 2.0)) 2.0)))))
(if (<= l 2.4e+192)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(* d (pow (* l h) -0.5)))
(/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -7.2e+95) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -5e-310) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M_m / 2.0)), 2.0))));
} else if (l <= 2.4e+192) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * pow((l * h), -0.5));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-7.2d+95)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= (-5d-310)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m_m / 2.0d0)) ** 2.0d0))))
else if (l <= 2.4d+192) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))) * (d * ((l * h) ** (-0.5d0)))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -7.2e+95) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-310) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M_m / 2.0)), 2.0))));
} else if (l <= 2.4e+192) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * Math.pow((l * h), -0.5));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -7.2e+95: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= -5e-310: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M_m / 2.0)), 2.0)))) elif l <= 2.4e+192: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * math.pow((l * h), -0.5)) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -7.2e+95) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -5e-310) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M_m / 2.0)) ^ 2.0))))); elseif (l <= 2.4e+192) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -7.2e+95)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= -5e-310)
tmp = sqrt(((d / h) * (d / l))) * (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M_m / 2.0)) ^ 2.0))));
elseif (l <= 2.4e+192)
tmp = (1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l))) * (d * ((l * h) ^ -0.5));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -7.2e+95], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -5e-310], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $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$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+192], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.2 \cdot 10^{+95}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M\_m}{2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+192}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -7.19999999999999955e95Initial program 42.1%
Simplified44.2%
Taylor expanded in d around inf 2.9%
+-commutative2.9%
fma-define2.9%
*-commutative2.9%
*-commutative2.9%
associate-/l*2.9%
unpow22.9%
unpow22.9%
unpow22.9%
times-frac3.3%
swap-sqr3.3%
unpow23.3%
associate-*r/3.3%
*-commutative3.3%
associate-/l*3.3%
Simplified3.3%
Taylor expanded in h around 0 4.8%
associate-/r*4.7%
unpow1/24.7%
associate-/r*4.8%
rem-exp-log4.8%
exp-neg4.8%
exp-prod4.8%
distribute-lft-neg-out4.8%
distribute-rgt-neg-in4.8%
metadata-eval4.8%
exp-to-pow4.8%
Simplified4.8%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod4.7%
div-inv4.7%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt51.6%
mul-1-neg51.6%
associate-/r*53.4%
Simplified53.4%
if -7.19999999999999955e95 < l < -4.999999999999985e-310Initial program 81.6%
Simplified81.4%
*-commutative84.0%
sqrt-unprod72.3%
Applied egg-rr69.8%
if -4.999999999999985e-310 < l < 2.3999999999999998e192Initial program 68.4%
Simplified68.4%
associate-*r/75.0%
frac-times75.0%
associate-/l*75.0%
*-un-lft-identity75.0%
times-frac75.0%
metadata-eval75.0%
Applied egg-rr75.0%
clear-num75.0%
sqrt-div75.8%
metadata-eval75.8%
Applied egg-rr75.8%
Taylor expanded in d around 0 79.6%
unpow-179.6%
metadata-eval79.6%
pow-sqr79.6%
rem-sqrt-square80.2%
metadata-eval80.2%
pow-sqr80.1%
fabs-sqr80.1%
pow-sqr80.2%
metadata-eval80.2%
Simplified80.2%
if 2.3999999999999998e192 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification72.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1.55e-92)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l -4.8e-307)
(* d (sqrt (/ 1.0 0.0)))
(if (<= l 1.06e+195)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(* d (pow (* l h) -0.5)))
(/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.55e-92) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= -4.8e-307) {
tmp = d * sqrt((1.0 / 0.0));
} else if (l <= 1.06e+195) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * pow((l * h), -0.5));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1.55d-92)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= (-4.8d-307)) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else if (l <= 1.06d+195) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))) * (d * ((l * h) ** (-0.5d0)))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.55e-92) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= -4.8e-307) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else if (l <= 1.06e+195) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * Math.pow((l * h), -0.5));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -1.55e-92: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= -4.8e-307: tmp = d * math.sqrt((1.0 / 0.0)) elif l <= 1.06e+195: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * (d * math.pow((l * h), -0.5)) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.55e-92) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= -4.8e-307) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); elseif (l <= 1.06e+195) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) * Float64(d * (Float64(l * h) ^ -0.5))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -1.55e-92)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= -4.8e-307)
tmp = d * sqrt((1.0 / 0.0));
elseif (l <= 1.06e+195)
tmp = (1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l))) * (d * ((l * h) ^ -0.5));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.55e-92], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, -4.8e-307], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.06e+195], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.55 \cdot 10^{-92}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq -4.8 \cdot 10^{-307}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{elif}\;\ell \leq 1.06 \cdot 10^{+195}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot \left(d \cdot {\left(\ell \cdot h\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.55e-92Initial program 60.2%
Simplified61.3%
Taylor expanded in d around inf 1.9%
+-commutative1.9%
fma-define1.9%
*-commutative1.9%
*-commutative1.9%
associate-/l*1.9%
unpow21.9%
unpow21.9%
unpow21.9%
times-frac2.1%
swap-sqr2.3%
unpow22.3%
associate-*r/2.2%
*-commutative2.2%
associate-/l*2.3%
Simplified2.3%
Taylor expanded in h around 0 4.8%
associate-/r*4.9%
unpow1/24.9%
associate-/r*4.8%
rem-exp-log4.8%
exp-neg4.8%
exp-prod4.8%
distribute-lft-neg-out4.8%
distribute-rgt-neg-in4.8%
metadata-eval4.8%
exp-to-pow4.8%
Simplified4.8%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod4.9%
div-inv4.9%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.4%
mul-1-neg49.4%
associate-/r*50.5%
Simplified50.5%
if -1.55e-92 < l < -4.80000000000000036e-307Initial program 78.1%
Simplified78.0%
Taylor expanded in d around inf 18.3%
add-log-exp41.4%
*-commutative41.4%
exp-prod57.1%
Applied egg-rr57.1%
Taylor expanded in l around 0 57.1%
if -4.80000000000000036e-307 < l < 1.06000000000000001e195Initial program 68.7%
Simplified68.7%
associate-*r/75.2%
frac-times75.3%
associate-/l*75.2%
*-un-lft-identity75.2%
times-frac75.2%
metadata-eval75.2%
Applied egg-rr75.2%
clear-num75.3%
sqrt-div76.0%
metadata-eval76.0%
Applied egg-rr76.0%
Taylor expanded in d around 0 78.8%
unpow-178.8%
metadata-eval78.8%
pow-sqr78.9%
rem-sqrt-square79.5%
metadata-eval79.5%
pow-sqr79.4%
fabs-sqr79.4%
pow-sqr79.5%
metadata-eval79.5%
Simplified79.5%
if 1.06000000000000001e195 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification66.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5.2e-93)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l 2.7e-304)
(* d (sqrt (/ 1.0 0.0)))
(if (<= l 3.4e+192)
(/
(* d (+ 1.0 (* -0.5 (* (/ h l) (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)))))
(sqrt (* l h)))
(/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.2e-93) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 2.7e-304) {
tmp = d * sqrt((1.0 / 0.0));
} else if (l <= 3.4e+192) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / sqrt((l * h));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5.2d-93)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 2.7d-304) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else if (l <= 3.4d+192) then
tmp = (d * (1.0d0 + ((-0.5d0) * ((h / l) * (((d_m / d) * (0.5d0 * m_m)) ** 2.0d0))))) / sqrt((l * h))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.2e-93) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 2.7e-304) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else if (l <= 3.4e+192) {
tmp = (d * (1.0 + (-0.5 * ((h / l) * Math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / Math.sqrt((l * h));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5.2e-93: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 2.7e-304: tmp = d * math.sqrt((1.0 / 0.0)) elif l <= 3.4e+192: tmp = (d * (1.0 + (-0.5 * ((h / l) * math.pow(((D_m / d) * (0.5 * M_m)), 2.0))))) / math.sqrt((l * h)) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5.2e-93) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 2.7e-304) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); elseif (l <= 3.4e+192) tmp = Float64(Float64(d * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0))))) / sqrt(Float64(l * h))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5.2e-93)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= 2.7e-304)
tmp = d * sqrt((1.0 / 0.0));
elseif (l <= 3.4e+192)
tmp = (d * (1.0 + (-0.5 * ((h / l) * (((D_m / d) * (0.5 * M_m)) ^ 2.0))))) / sqrt((l * h));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5.2e-93], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.7e-304], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.4e+192], N[(N[(d * N[(1.0 + N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{-93}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{elif}\;\ell \leq 3.4 \cdot 10^{+192}:\\
\;\;\;\;\frac{d \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -5.1999999999999997e-93Initial program 60.2%
Simplified61.3%
Taylor expanded in d around inf 1.9%
+-commutative1.9%
fma-define1.9%
*-commutative1.9%
*-commutative1.9%
associate-/l*1.9%
unpow21.9%
unpow21.9%
unpow21.9%
times-frac2.1%
swap-sqr2.3%
unpow22.3%
associate-*r/2.2%
*-commutative2.2%
associate-/l*2.3%
Simplified2.3%
Taylor expanded in h around 0 4.8%
associate-/r*4.9%
unpow1/24.9%
associate-/r*4.8%
rem-exp-log4.8%
exp-neg4.8%
exp-prod4.8%
distribute-lft-neg-out4.8%
distribute-rgt-neg-in4.8%
metadata-eval4.8%
exp-to-pow4.8%
Simplified4.8%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod4.9%
div-inv4.9%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.4%
mul-1-neg49.4%
associate-/r*50.5%
Simplified50.5%
if -5.1999999999999997e-93 < l < 2.7000000000000001e-304Initial program 77.4%
Simplified77.3%
Taylor expanded in d around inf 21.4%
add-log-exp42.9%
*-commutative42.9%
exp-prod57.7%
Applied egg-rr57.7%
Taylor expanded in l around 0 57.7%
if 2.7000000000000001e-304 < l < 3.39999999999999996e192Initial program 68.8%
Simplified68.7%
*-commutative74.5%
sqrt-div81.6%
sqrt-div87.2%
frac-times87.1%
add-sqr-sqrt87.4%
Applied egg-rr79.8%
associate-*l/82.6%
cancel-sign-sub-inv82.6%
metadata-eval82.6%
*-commutative82.6%
div-inv82.6%
metadata-eval82.6%
sqrt-unprod73.2%
*-commutative73.2%
Applied egg-rr73.2%
if 3.39999999999999996e192 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification64.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1.35e-92)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= l 2.7e-304)
(* d (sqrt (/ 1.0 0.0)))
(if (<= l 2.4e+192)
(*
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ D_m d) (/ M_m 2.0)) 2.0))))
(/ d (sqrt (* l h))))
(/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.35e-92) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (l <= 2.7e-304) {
tmp = d * sqrt((1.0 / 0.0));
} else if (l <= 2.4e+192) {
tmp = (1.0 - (0.5 * ((h / l) * pow(((D_m / d) * (M_m / 2.0)), 2.0)))) * (d / sqrt((l * h)));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-1.35d-92)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (l <= 2.7d-304) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else if (l <= 2.4d+192) then
tmp = (1.0d0 - (0.5d0 * ((h / l) * (((d_m / d) * (m_m / 2.0d0)) ** 2.0d0)))) * (d / sqrt((l * h)))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1.35e-92) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (l <= 2.7e-304) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else if (l <= 2.4e+192) {
tmp = (1.0 - (0.5 * ((h / l) * Math.pow(((D_m / d) * (M_m / 2.0)), 2.0)))) * (d / Math.sqrt((l * h)));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -1.35e-92: tmp = d * -math.sqrt(((1.0 / h) / l)) elif l <= 2.7e-304: tmp = d * math.sqrt((1.0 / 0.0)) elif l <= 2.4e+192: tmp = (1.0 - (0.5 * ((h / l) * math.pow(((D_m / d) * (M_m / 2.0)), 2.0)))) * (d / math.sqrt((l * h))) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1.35e-92) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (l <= 2.7e-304) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); elseif (l <= 2.4e+192) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(D_m / d) * Float64(M_m / 2.0)) ^ 2.0)))) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -1.35e-92)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (l <= 2.7e-304)
tmp = d * sqrt((1.0 / 0.0));
elseif (l <= 2.4e+192)
tmp = (1.0 - (0.5 * ((h / l) * (((D_m / d) * (M_m / 2.0)) ^ 2.0)))) * (d / sqrt((l * h)));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1.35e-92], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[l, 2.7e-304], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e+192], N[(N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.35 \cdot 10^{-92}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{-304}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{+192}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{D\_m}{d} \cdot \frac{M\_m}{2}\right)}^{2}\right)\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.34999999999999998e-92Initial program 60.2%
Simplified61.3%
Taylor expanded in d around inf 1.9%
+-commutative1.9%
fma-define1.9%
*-commutative1.9%
*-commutative1.9%
associate-/l*1.9%
unpow21.9%
unpow21.9%
unpow21.9%
times-frac2.1%
swap-sqr2.3%
unpow22.3%
associate-*r/2.2%
*-commutative2.2%
associate-/l*2.3%
Simplified2.3%
Taylor expanded in h around 0 4.8%
associate-/r*4.9%
unpow1/24.9%
associate-/r*4.8%
rem-exp-log4.8%
exp-neg4.8%
exp-prod4.8%
distribute-lft-neg-out4.8%
distribute-rgt-neg-in4.8%
metadata-eval4.8%
exp-to-pow4.8%
Simplified4.8%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod4.9%
div-inv4.9%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt49.4%
mul-1-neg49.4%
associate-/r*50.5%
Simplified50.5%
if -1.34999999999999998e-92 < l < 2.7000000000000001e-304Initial program 77.4%
Simplified77.3%
Taylor expanded in d around inf 21.4%
add-log-exp42.9%
*-commutative42.9%
exp-prod57.7%
Applied egg-rr57.7%
Taylor expanded in l around 0 57.7%
if 2.7000000000000001e-304 < l < 2.3999999999999998e192Initial program 68.8%
Simplified68.7%
*-commutative74.5%
sqrt-div81.6%
sqrt-div87.2%
frac-times87.1%
add-sqr-sqrt87.4%
Applied egg-rr79.8%
Taylor expanded in d around 0 71.6%
*-commutative71.6%
associate-/r*71.6%
unpow1/271.6%
associate-/r*71.6%
rem-exp-log69.8%
exp-neg69.8%
exp-prod70.4%
distribute-lft-neg-out70.4%
exp-neg70.4%
exp-to-pow72.2%
unpow1/272.2%
unpow-172.2%
unpow-172.2%
associate-*l/72.2%
*-lft-identity72.2%
Simplified72.2%
if 2.3999999999999998e192 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification63.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l)))
(t_1 (* d (pow (* l h) -0.5))))
(if (<= l -5e-310)
(* t_1 (+ -1.0 t_0))
(if (<= l 1.3e+194) (* (- 1.0 t_0) t_1) (/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double t_1 = d * pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (-1.0 + t_0);
} else if (l <= 1.3e+194) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l)
t_1 = d * ((l * h) ** (-0.5d0))
if (l <= (-5d-310)) then
tmp = t_1 * ((-1.0d0) + t_0)
else if (l <= 1.3d+194) then
tmp = (1.0d0 - t_0) * t_1
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = 0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l);
double t_1 = d * Math.pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_1 * (-1.0 + t_0);
} else if (l <= 1.3e+194) {
tmp = (1.0 - t_0) * t_1;
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = 0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l) t_1 = d * math.pow((l * h), -0.5) tmp = 0 if l <= -5e-310: tmp = t_1 * (-1.0 + t_0) elif l <= 1.3e+194: tmp = (1.0 - t_0) * t_1 else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l)) t_1 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_1 * Float64(-1.0 + t_0)); elseif (l <= 1.3e+194) tmp = Float64(Float64(1.0 - t_0) * t_1); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = 0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l);
t_1 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -5e-310)
tmp = t_1 * (-1.0 + t_0);
elseif (l <= 1.3e+194)
tmp = (1.0 - t_0) * t_1;
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$1 * N[(-1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e+194], N[(N[(1.0 - t$95$0), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\\
t_1 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \left(-1 + t\_0\right)\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{+194}:\\
\;\;\;\;\left(1 - t\_0\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
if -4.999999999999985e-310 < l < 1.2999999999999999e194Initial program 68.4%
Simplified68.4%
associate-*r/75.0%
frac-times75.0%
associate-/l*75.0%
*-un-lft-identity75.0%
times-frac75.0%
metadata-eval75.0%
Applied egg-rr75.0%
clear-num75.0%
sqrt-div75.8%
metadata-eval75.8%
Applied egg-rr75.8%
Taylor expanded in d around 0 79.6%
unpow-179.6%
metadata-eval79.6%
pow-sqr79.6%
rem-sqrt-square80.2%
metadata-eval80.2%
pow-sqr80.1%
fabs-sqr80.1%
pow-sqr80.2%
metadata-eval80.2%
Simplified80.2%
if 1.2999999999999999e194 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification74.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* d (pow (* l h) -0.5))))
(if (<= l -5e-310)
(* t_0 (+ -1.0 (* 0.5 (* h (/ (* 0.25 (pow (* D_m (/ M_m d)) 2.0)) l)))))
(if (<= l 1.55e+194)
(* (- 1.0 (* 0.5 (/ (* h (pow (* M_m (* 0.5 (/ D_m d))) 2.0)) l))) t_0)
(/ (/ d (sqrt l)) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_0 * (-1.0 + (0.5 * (h * ((0.25 * pow((D_m * (M_m / d)), 2.0)) / l))));
} else if (l <= 1.55e+194) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * t_0;
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d * ((l * h) ** (-0.5d0))
if (l <= (-5d-310)) then
tmp = t_0 * ((-1.0d0) + (0.5d0 * (h * ((0.25d0 * ((d_m * (m_m / d)) ** 2.0d0)) / l))))
else if (l <= 1.55d+194) then
tmp = (1.0d0 - (0.5d0 * ((h * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0)) / l))) * t_0
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d * Math.pow((l * h), -0.5);
double tmp;
if (l <= -5e-310) {
tmp = t_0 * (-1.0 + (0.5 * (h * ((0.25 * Math.pow((D_m * (M_m / d)), 2.0)) / l))));
} else if (l <= 1.55e+194) {
tmp = (1.0 - (0.5 * ((h * Math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * t_0;
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = d * math.pow((l * h), -0.5) tmp = 0 if l <= -5e-310: tmp = t_0 * (-1.0 + (0.5 * (h * ((0.25 * math.pow((D_m * (M_m / d)), 2.0)) / l)))) elif l <= 1.55e+194: tmp = (1.0 - (0.5 * ((h * math.pow((M_m * (0.5 * (D_m / d))), 2.0)) / l))) * t_0 else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * (Float64(l * h) ^ -0.5)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_0 * Float64(-1.0 + Float64(0.5 * Float64(h * Float64(Float64(0.25 * (Float64(D_m * Float64(M_m / d)) ^ 2.0)) / l))))); elseif (l <= 1.55e+194) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0)) / l))) * t_0); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = d * ((l * h) ^ -0.5);
tmp = 0.0;
if (l <= -5e-310)
tmp = t_0 * (-1.0 + (0.5 * (h * ((0.25 * ((D_m * (M_m / d)) ^ 2.0)) / l))));
elseif (l <= 1.55e+194)
tmp = (1.0 - (0.5 * ((h * ((M_m * (0.5 * (D_m / d))) ^ 2.0)) / l))) * t_0;
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d * N[Power[N[(l * h), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$0 * N[(-1.0 + N[(0.5 * N[(h * N[(N[(0.25 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.55e+194], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot {\left(\ell \cdot h\right)}^{-0.5}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(-1 + 0.5 \cdot \left(h \cdot \frac{0.25 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 1.55 \cdot 10^{+194}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \left(0.5 \cdot \frac{D\_m}{d}\right)\right)}^{2}}{\ell}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 66.7%
Simplified67.4%
associate-*r/70.6%
frac-times70.6%
associate-/l*70.6%
*-un-lft-identity70.6%
times-frac70.6%
metadata-eval70.6%
Applied egg-rr70.6%
clear-num70.5%
sqrt-div70.5%
metadata-eval70.5%
Applied egg-rr70.5%
Taylor expanded in d around -inf 67.1%
mul-1-neg67.1%
unpow-167.1%
metadata-eval67.1%
pow-sqr67.1%
rem-sqrt-square67.6%
metadata-eval67.6%
pow-sqr67.4%
fabs-sqr67.4%
pow-sqr67.6%
metadata-eval67.6%
distribute-rgt-neg-in67.6%
Simplified67.6%
*-un-lft-identity70.6%
associate-/l*67.4%
associate-*r*67.4%
metadata-eval67.4%
div-inv67.4%
*-commutative67.4%
div-inv67.4%
metadata-eval67.4%
Applied egg-rr62.8%
*-lft-identity67.4%
*-commutative67.4%
associate-*l/70.6%
associate-/l*69.2%
unpow269.2%
associate-*l/68.5%
associate-*r*68.5%
associate-*l/68.5%
*-commutative68.5%
associate-*l/69.2%
associate-*r*69.2%
associate-*l/69.2%
*-commutative69.2%
swap-sqr69.2%
metadata-eval69.2%
unpow269.2%
associate-/l*70.0%
Simplified68.3%
if -4.999999999999985e-310 < l < 1.55e194Initial program 68.4%
Simplified68.4%
associate-*r/75.0%
frac-times75.0%
associate-/l*75.0%
*-un-lft-identity75.0%
times-frac75.0%
metadata-eval75.0%
Applied egg-rr75.0%
clear-num75.0%
sqrt-div75.8%
metadata-eval75.8%
Applied egg-rr75.8%
Taylor expanded in d around 0 79.6%
unpow-179.6%
metadata-eval79.6%
pow-sqr79.6%
rem-sqrt-square80.2%
metadata-eval80.2%
pow-sqr80.1%
fabs-sqr80.1%
pow-sqr80.2%
metadata-eval80.2%
Simplified80.2%
if 1.55e194 < l Initial program 62.9%
Simplified58.4%
Taylor expanded in d around inf 58.4%
sqrt-div58.3%
metadata-eval58.3%
*-commutative58.3%
sqrt-unprod89.9%
div-inv89.9%
associate-/r*90.2%
Applied egg-rr90.2%
Final simplification75.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -2.1e-48)
(* d (- (sqrt (/ (/ 1.0 h) l))))
(if (<= d -5e-310)
(* d (sqrt (/ 1.0 0.0)))
(* d (/ (pow h -0.5) (sqrt l))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.1e-48) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -5e-310) {
tmp = d * sqrt((1.0 / 0.0));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-2.1d-48)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= (-5d-310)) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.1e-48) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -2.1e-48: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= -5e-310: tmp = d * math.sqrt((1.0 / 0.0)) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -2.1e-48) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -2.1e-48)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= -5e-310)
tmp = d * sqrt((1.0 / 0.0));
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2.1e-48], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.1 \cdot 10^{-48}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -2.09999999999999989e-48Initial program 79.8%
Simplified81.0%
Taylor expanded in d around inf 0.7%
+-commutative0.7%
fma-define0.7%
*-commutative0.7%
*-commutative0.7%
associate-/l*0.8%
unpow20.8%
unpow20.8%
unpow20.8%
times-frac0.9%
swap-sqr1.0%
unpow21.0%
associate-*r/1.0%
*-commutative1.0%
associate-/l*1.0%
Simplified1.0%
Taylor expanded in h around 0 3.6%
associate-/r*3.6%
unpow1/23.6%
associate-/r*3.6%
rem-exp-log3.6%
exp-neg3.6%
exp-prod3.6%
distribute-lft-neg-out3.6%
distribute-rgt-neg-in3.6%
metadata-eval3.6%
exp-to-pow3.6%
Simplified3.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod3.6%
div-inv3.6%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt56.4%
mul-1-neg56.4%
associate-/r*57.5%
Simplified57.5%
if -2.09999999999999989e-48 < d < -4.999999999999985e-310Initial program 47.6%
Simplified47.7%
Taylor expanded in d around inf 18.0%
add-log-exp24.9%
*-commutative24.9%
exp-prod31.0%
Applied egg-rr31.0%
Taylor expanded in l around 0 49.1%
if -4.999999999999985e-310 < d Initial program 67.5%
Simplified66.7%
Taylor expanded in d around inf 26.2%
+-commutative26.2%
fma-define26.2%
*-commutative26.2%
*-commutative26.2%
associate-/l*25.7%
unpow225.7%
unpow225.7%
unpow225.7%
times-frac39.2%
swap-sqr49.6%
unpow249.6%
associate-*r/49.6%
*-commutative49.6%
associate-/l*49.6%
Simplified49.6%
Taylor expanded in h around 0 43.5%
associate-/r*44.9%
unpow1/244.9%
associate-/r*43.5%
rem-exp-log41.4%
exp-neg41.4%
exp-prod41.9%
distribute-lft-neg-out41.9%
distribute-rgt-neg-in41.9%
metadata-eval41.9%
exp-to-pow44.0%
Simplified44.0%
unpow-prod-down52.6%
metadata-eval52.6%
sqrt-pow152.5%
inv-pow52.5%
metadata-eval52.5%
sqrt-pow152.6%
inv-pow52.6%
sqrt-prod44.9%
div-inv44.9%
sqrt-div52.5%
inv-pow52.5%
sqrt-pow152.5%
metadata-eval52.5%
Applied egg-rr52.5%
Final simplification53.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -1.65e-53) (* d (- (sqrt (/ (/ 1.0 h) l)))) (if (<= d -5e-310) (* d (sqrt (/ 1.0 0.0))) (/ d (* (sqrt l) (sqrt h))))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.65e-53) {
tmp = d * -sqrt(((1.0 / h) / l));
} else if (d <= -5e-310) {
tmp = d * sqrt((1.0 / 0.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.65d-53)) then
tmp = d * -sqrt(((1.0d0 / h) / l))
else if (d <= (-5d-310)) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.65e-53) {
tmp = d * -Math.sqrt(((1.0 / h) / l));
} else if (d <= -5e-310) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.65e-53: tmp = d * -math.sqrt(((1.0 / h) / l)) elif d <= -5e-310: tmp = d * math.sqrt((1.0 / 0.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.65e-53) tmp = Float64(d * Float64(-sqrt(Float64(Float64(1.0 / h) / l)))); elseif (d <= -5e-310) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.65e-53)
tmp = d * -sqrt(((1.0 / h) / l));
elseif (d <= -5e-310)
tmp = d * sqrt((1.0 / 0.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.65e-53], N[(d * (-N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.65 \cdot 10^{-53}:\\
\;\;\;\;d \cdot \left(-\sqrt{\frac{\frac{1}{h}}{\ell}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.65000000000000002e-53Initial program 79.8%
Simplified81.0%
Taylor expanded in d around inf 0.7%
+-commutative0.7%
fma-define0.7%
*-commutative0.7%
*-commutative0.7%
associate-/l*0.8%
unpow20.8%
unpow20.8%
unpow20.8%
times-frac0.9%
swap-sqr1.0%
unpow21.0%
associate-*r/1.0%
*-commutative1.0%
associate-/l*1.0%
Simplified1.0%
Taylor expanded in h around 0 3.6%
associate-/r*3.6%
unpow1/23.6%
associate-/r*3.6%
rem-exp-log3.6%
exp-neg3.6%
exp-prod3.6%
distribute-lft-neg-out3.6%
distribute-rgt-neg-in3.6%
metadata-eval3.6%
exp-to-pow3.6%
Simplified3.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod3.6%
div-inv3.6%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt56.4%
mul-1-neg56.4%
associate-/r*57.5%
Simplified57.5%
if -1.65000000000000002e-53 < d < -4.999999999999985e-310Initial program 47.6%
Simplified47.7%
Taylor expanded in d around inf 18.0%
add-log-exp24.9%
*-commutative24.9%
exp-prod31.0%
Applied egg-rr31.0%
Taylor expanded in l around 0 49.1%
if -4.999999999999985e-310 < d Initial program 67.5%
Simplified66.7%
Taylor expanded in d around inf 43.5%
sqrt-div44.0%
metadata-eval44.0%
*-commutative44.0%
sqrt-unprod52.5%
div-inv52.5%
associate-/r*50.5%
Applied egg-rr50.5%
associate-/l/52.5%
*-commutative52.5%
Simplified52.5%
Final simplification53.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ (/ 1.0 h) l))))
(if (<= d -2.2e-51)
(* d (- t_0))
(if (<= d -5e-310) (* d (sqrt (/ 1.0 0.0))) (* d t_0)))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) / l));
double tmp;
if (d <= -2.2e-51) {
tmp = d * -t_0;
} else if (d <= -5e-310) {
tmp = d * sqrt((1.0 / 0.0));
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / h) / l))
if (d <= (-2.2d-51)) then
tmp = d * -t_0
else if (d <= (-5d-310)) then
tmp = d * sqrt((1.0d0 / 0.0d0))
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(((1.0 / h) / l));
double tmp;
if (d <= -2.2e-51) {
tmp = d * -t_0;
} else if (d <= -5e-310) {
tmp = d * Math.sqrt((1.0 / 0.0));
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(((1.0 / h) / l)) tmp = 0 if d <= -2.2e-51: tmp = d * -t_0 elif d <= -5e-310: tmp = d * math.sqrt((1.0 / 0.0)) else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) / l)) tmp = 0.0 if (d <= -2.2e-51) tmp = Float64(d * Float64(-t_0)); elseif (d <= -5e-310) tmp = Float64(d * sqrt(Float64(1.0 / 0.0))); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((1.0 / h) / l));
tmp = 0.0;
if (d <= -2.2e-51)
tmp = d * -t_0;
elseif (d <= -5e-310)
tmp = d * sqrt((1.0 / 0.0));
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.2e-51], N[(d * (-t$95$0)), $MachinePrecision], If[LessEqual[d, -5e-310], N[(d * N[Sqrt[N[(1.0 / 0.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{if}\;d \leq -2.2 \cdot 10^{-51}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{0}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if d < -2.2e-51Initial program 79.8%
Simplified81.0%
Taylor expanded in d around inf 0.7%
+-commutative0.7%
fma-define0.7%
*-commutative0.7%
*-commutative0.7%
associate-/l*0.8%
unpow20.8%
unpow20.8%
unpow20.8%
times-frac0.9%
swap-sqr1.0%
unpow21.0%
associate-*r/1.0%
*-commutative1.0%
associate-/l*1.0%
Simplified1.0%
Taylor expanded in h around 0 3.6%
associate-/r*3.6%
unpow1/23.6%
associate-/r*3.6%
rem-exp-log3.6%
exp-neg3.6%
exp-prod3.6%
distribute-lft-neg-out3.6%
distribute-rgt-neg-in3.6%
metadata-eval3.6%
exp-to-pow3.6%
Simplified3.6%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod3.6%
div-inv3.6%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt56.4%
mul-1-neg56.4%
associate-/r*57.5%
Simplified57.5%
if -2.2e-51 < d < -4.999999999999985e-310Initial program 47.6%
Simplified47.7%
Taylor expanded in d around inf 18.0%
add-log-exp24.9%
*-commutative24.9%
exp-prod31.0%
Applied egg-rr31.0%
Taylor expanded in l around 0 49.1%
if -4.999999999999985e-310 < d Initial program 67.5%
Simplified66.7%
Taylor expanded in d around inf 26.2%
+-commutative26.2%
fma-define26.2%
*-commutative26.2%
*-commutative26.2%
associate-/l*25.7%
unpow225.7%
unpow225.7%
unpow225.7%
times-frac39.2%
swap-sqr49.6%
unpow249.6%
associate-*r/49.6%
*-commutative49.6%
associate-/l*49.6%
Simplified49.6%
Taylor expanded in h around 0 43.5%
associate-/r*44.9%
Simplified44.9%
Final simplification49.6%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (/ (/ 1.0 h) l)))) (if (<= l -5.6e-241) (* d (- t_0)) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) / l));
double tmp;
if (l <= -5.6e-241) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / h) / l))
if (l <= (-5.6d-241)) then
tmp = d * -t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(((1.0 / h) / l));
double tmp;
if (l <= -5.6e-241) {
tmp = d * -t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(((1.0 / h) / l)) tmp = 0 if l <= -5.6e-241: tmp = d * -t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) / l)) tmp = 0.0 if (l <= -5.6e-241) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((1.0 / h) / l));
tmp = 0.0;
if (l <= -5.6e-241)
tmp = d * -t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.6e-241], N[(d * (-t$95$0)), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{if}\;\ell \leq -5.6 \cdot 10^{-241}:\\
\;\;\;\;d \cdot \left(-t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -5.5999999999999998e-241Initial program 63.1%
Simplified63.9%
Taylor expanded in d around inf 1.4%
+-commutative1.4%
fma-define1.4%
*-commutative1.4%
*-commutative1.4%
associate-/l*1.5%
unpow21.5%
unpow21.5%
unpow21.5%
times-frac1.7%
swap-sqr1.8%
unpow21.8%
associate-*r/1.7%
*-commutative1.7%
associate-/l*1.8%
Simplified1.8%
Taylor expanded in h around 0 6.9%
associate-/r*6.9%
unpow1/26.9%
associate-/r*6.9%
rem-exp-log6.9%
exp-neg6.9%
exp-prod6.9%
distribute-lft-neg-out6.9%
distribute-rgt-neg-in6.9%
metadata-eval6.9%
exp-to-pow6.9%
Simplified6.9%
unpow-prod-down0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
metadata-eval0.0%
sqrt-pow10.0%
inv-pow0.0%
sqrt-prod6.9%
div-inv6.9%
sqrt-div0.0%
inv-pow0.0%
sqrt-pow10.0%
metadata-eval0.0%
Applied egg-rr0.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.3%
mul-1-neg44.3%
associate-/r*45.1%
Simplified45.1%
if -5.5999999999999998e-241 < l Initial program 70.2%
Simplified69.5%
Taylor expanded in d around inf 23.0%
+-commutative23.0%
fma-define23.0%
*-commutative23.0%
*-commutative23.0%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac34.3%
swap-sqr43.4%
unpow243.4%
associate-*r/43.4%
*-commutative43.4%
associate-/l*43.4%
Simplified43.4%
Taylor expanded in h around 0 41.3%
associate-/r*42.5%
Simplified42.5%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l -2.9e-239) (/ d (- (sqrt (* l h)))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.9e-239) {
tmp = d / -sqrt((l * h));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.9d-239)) then
tmp = d / -sqrt((l * h))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.9e-239) {
tmp = d / -Math.sqrt((l * h));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -2.9e-239: tmp = d / -math.sqrt((l * h)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.9e-239) tmp = Float64(d / Float64(-sqrt(Float64(l * h)))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -2.9e-239)
tmp = d / -sqrt((l * h));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.9e-239], N[(d / (-N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{-239}:\\
\;\;\;\;\frac{d}{-\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.9000000000000002e-239Initial program 63.1%
Simplified63.9%
Taylor expanded in d around inf 6.9%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt44.3%
mul-1-neg44.3%
distribute-rgt-neg-out44.3%
*-commutative44.3%
associate-/r*45.1%
unpow1/245.1%
associate-/r*44.3%
rem-exp-log42.1%
exp-neg42.1%
exp-prod42.1%
distribute-lft-neg-out42.1%
exp-neg42.1%
exp-to-pow44.2%
unpow1/244.2%
unpow-144.2%
unpow-144.2%
associate-*l/44.3%
*-lft-identity44.3%
Simplified44.3%
if -2.9000000000000002e-239 < l Initial program 70.2%
Simplified69.5%
Taylor expanded in d around inf 23.0%
+-commutative23.0%
fma-define23.0%
*-commutative23.0%
*-commutative23.0%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac34.3%
swap-sqr43.4%
unpow243.4%
associate-*r/43.4%
*-commutative43.4%
associate-/l*43.4%
Simplified43.4%
Taylor expanded in h around 0 41.3%
associate-/r*42.5%
Simplified42.5%
Final simplification43.3%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (* l h)))) (if (<= l -5.4e-244) (/ d (- t_0)) (/ d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((l * h));
double tmp;
if (l <= -5.4e-244) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((l * h))
if (l <= (-5.4d-244)) then
tmp = d / -t_0
else
tmp = d / t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((l * h));
double tmp;
if (l <= -5.4e-244) {
tmp = d / -t_0;
} else {
tmp = d / t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((l * h)) tmp = 0 if l <= -5.4e-244: tmp = d / -t_0 else: tmp = d / t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -5.4e-244) tmp = Float64(d / Float64(-t_0)); else tmp = Float64(d / t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((l * h));
tmp = 0.0;
if (l <= -5.4e-244)
tmp = d / -t_0;
else
tmp = d / t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5.4e-244], N[(d / (-t$95$0)), $MachinePrecision], N[(d / t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -5.4 \cdot 10^{-244}:\\
\;\;\;\;\frac{d}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if l < -5.3999999999999999e-244Initial program 63.1%
Simplified63.9%
Taylor expanded in d around inf 6.9%
Taylor expanded in h around -inf 0.0%
associate-*l*0.0%
unpow20.0%
rem-square-sqrt44.3%
mul-1-neg44.3%
distribute-rgt-neg-out44.3%
*-commutative44.3%
associate-/r*45.1%
unpow1/245.1%
associate-/r*44.3%
rem-exp-log42.1%
exp-neg42.1%
exp-prod42.1%
distribute-lft-neg-out42.1%
exp-neg42.1%
exp-to-pow44.2%
unpow1/244.2%
unpow-144.2%
unpow-144.2%
associate-*l/44.3%
*-lft-identity44.3%
Simplified44.3%
if -5.3999999999999999e-244 < l Initial program 70.2%
Simplified69.5%
Taylor expanded in d around inf 23.0%
+-commutative23.0%
fma-define23.0%
*-commutative23.0%
*-commutative23.0%
associate-/l*22.5%
unpow222.5%
unpow222.5%
unpow222.5%
times-frac34.3%
swap-sqr43.4%
unpow243.4%
associate-*r/43.4%
*-commutative43.4%
associate-/l*43.4%
Simplified43.4%
Taylor expanded in h around 0 41.3%
associate-/r*42.5%
unpow1/242.5%
associate-/r*41.3%
rem-exp-log39.4%
exp-neg39.4%
exp-prod39.8%
distribute-lft-neg-out39.8%
distribute-rgt-neg-in39.8%
metadata-eval39.8%
exp-to-pow41.7%
Simplified41.7%
metadata-eval41.7%
sqrt-pow141.3%
add-log-exp10.1%
log-pow17.3%
inv-pow17.3%
sqrt-div17.3%
metadata-eval17.3%
un-div-inv17.3%
log-pow11.5%
add-log-exp41.7%
Applied egg-rr41.7%
Final simplification42.9%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 67.1%
Simplified67.1%
Taylor expanded in d around inf 13.5%
+-commutative13.5%
fma-define13.5%
*-commutative13.5%
*-commutative13.5%
associate-/l*13.3%
unpow213.3%
unpow213.3%
unpow213.3%
times-frac20.0%
swap-sqr25.2%
unpow225.2%
associate-*r/25.2%
*-commutative25.2%
associate-/l*25.2%
Simplified25.2%
Taylor expanded in h around 0 26.2%
associate-/r*26.9%
unpow1/226.9%
associate-/r*26.2%
rem-exp-log25.2%
exp-neg25.2%
exp-prod25.4%
distribute-lft-neg-out25.4%
distribute-rgt-neg-in25.4%
metadata-eval25.4%
exp-to-pow26.5%
Simplified26.5%
metadata-eval26.5%
sqrt-pow126.2%
add-log-exp6.9%
log-pow17.4%
inv-pow17.4%
sqrt-div17.4%
metadata-eval17.4%
un-div-inv17.4%
log-pow9.8%
add-log-exp26.5%
Applied egg-rr26.5%
Final simplification26.5%
herbie shell --seed 2024182
(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)))))