
(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 28 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 (sqrt (- d))) (t_1 (* M_m (/ D_m (* d 2.0)))))
(if (<= h -1.4e+64)
(*
(* (/ t_0 (sqrt (- h))) (/ 1.0 (sqrt (/ l d))))
(- 1.0 (* 0.5 (/ (* h (pow t_1 2.0)) l))))
(if (<= h -1.05e-306)
(*
(* (sqrt (/ d h)) (/ t_0 (sqrt (- l))))
(- 1.0 (* 0.5 (pow (* t_1 (sqrt (/ h l))) 2.0))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 = sqrt(-d);
double t_1 = M_m * (D_m / (d * 2.0));
double tmp;
if (h <= -1.4e+64) {
tmp = ((t_0 / sqrt(-h)) * (1.0 / sqrt((l / d)))) * (1.0 - (0.5 * ((h * pow(t_1, 2.0)) / l)));
} else if (h <= -1.05e-306) {
tmp = (sqrt((d / h)) * (t_0 / sqrt(-l))) * (1.0 - (0.5 * pow((t_1 * sqrt((h / l))), 2.0)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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) t_0 = sqrt(Float64(-d)) t_1 = Float64(M_m * Float64(D_m / Float64(d * 2.0))) tmp = 0.0 if (h <= -1.4e+64) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 / sqrt(Float64(l / d)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (t_1 ^ 2.0)) / l)))); elseif (h <= -1.05e-306) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(t_0 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * (Float64(t_1 * sqrt(Float64(h / l))) ^ 2.0)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -1.4e+64], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1.05e-306], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$1 * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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 := \sqrt{-d}\\
t_1 := M\_m \cdot \frac{D\_m}{d \cdot 2}\\
\mathbf{if}\;h \leq -1.4 \cdot 10^{+64}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {t\_1}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq -1.05 \cdot 10^{-306}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \frac{t\_0}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(t\_1 \cdot \sqrt{\frac{h}{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -1.40000000000000012e64Initial program 63.6%
Simplified61.5%
associate-*r/63.9%
frac-times66.0%
associate-/l*63.9%
*-commutative63.9%
Applied egg-rr63.9%
frac-2neg63.9%
sqrt-div78.7%
Applied egg-rr78.7%
clear-num78.8%
sqrt-div78.9%
metadata-eval78.9%
Applied egg-rr78.9%
if -1.40000000000000012e64 < h < -1.0500000000000001e-306Initial program 78.4%
Simplified78.4%
add-sqr-sqrt78.4%
pow278.4%
sqrt-prod78.5%
sqrt-pow181.7%
metadata-eval81.7%
frac-times80.2%
associate-/l*81.7%
pow181.7%
*-commutative81.7%
Applied egg-rr81.7%
frac-2neg81.7%
sqrt-div90.3%
Applied egg-rr90.3%
if -1.0500000000000001e-306 < h Initial program 70.0%
Simplified68.6%
Applied egg-rr81.6%
unpow181.6%
associate-*l/85.0%
associate-/l*84.9%
+-commutative84.9%
associate-*r*84.9%
fma-define84.9%
*-commutative84.9%
associate-*r/86.3%
*-commutative86.3%
Simplified86.3%
Final simplification85.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
(let* ((t_0 (/ (cbrt h) l)))
(if (<= d -3.8e-155)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D_m (* d 2.0))) 2.0)) l)))
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))))
(if (<= d 1.4e-307)
(* -0.125 (/ (* (pow (* M_m D_m) 2.0) (* (sqrt t_0) (- (fabs t_0)))) d))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 = cbrt(h) / l;
double tmp;
if (d <= -3.8e-155) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D_m / (d * 2.0))), 2.0)) / l))) * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)));
} else if (d <= 1.4e-307) {
tmp = -0.125 * ((pow((M_m * D_m), 2.0) * (sqrt(t_0) * -fabs(t_0))) / d);
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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) t_0 = Float64(cbrt(h) / l) tmp = 0.0 if (d <= -3.8e-155) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); elseif (d <= 1.4e-307) tmp = Float64(-0.125 * Float64(Float64((Float64(M_m * D_m) ^ 2.0) * Float64(sqrt(t_0) * Float64(-abs(t_0)))) / d)); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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_] := Block[{t$95$0 = N[(N[Power[h, 1/3], $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[d, -3.8e-155], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-307], N[(-0.125 * N[(N[(N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] * (-N[Abs[t$95$0], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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 := \frac{\sqrt[3]{h}}{\ell}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-155}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;-0.125 \cdot \frac{{\left(M\_m \cdot D\_m\right)}^{2} \cdot \left(\sqrt{t\_0} \cdot \left(-\left|t\_0\right|\right)\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.7999999999999998e-155Initial program 81.3%
Simplified80.0%
associate-*r/80.3%
frac-times81.6%
associate-/l*80.3%
*-commutative80.3%
Applied egg-rr80.3%
frac-2neg80.3%
sqrt-div86.4%
Applied egg-rr86.4%
if -3.7999999999999998e-155 < d < 1.4e-307Initial program 45.8%
Simplified45.8%
associate-*r/45.9%
frac-times45.9%
associate-/l*45.9%
*-commutative45.9%
Applied egg-rr45.9%
*-commutative45.9%
associate-/l*43.2%
associate-*r/43.2%
*-commutative43.2%
Simplified43.2%
Taylor expanded in h around -inf 0.0%
associate-*l/0.0%
associate-*r*0.0%
unpow20.0%
rem-square-sqrt40.2%
associate-*l*40.2%
unpow240.2%
unpow240.2%
swap-sqr49.8%
unpow249.8%
mul-1-neg49.8%
Simplified49.8%
pow1/249.8%
add-cube-cbrt49.8%
unpow-prod-down49.8%
pow249.8%
cbrt-div49.8%
unpow349.8%
add-cbrt-cube49.8%
cbrt-div49.8%
unpow349.8%
add-cbrt-cube64.7%
Applied egg-rr64.7%
unpow1/264.7%
unpow264.7%
rem-sqrt-square71.6%
unpow1/271.6%
Simplified71.6%
if 1.4e-307 < d Initial program 71.0%
Simplified69.6%
Applied egg-rr82.7%
unpow182.7%
associate-*l/86.2%
associate-/l*86.1%
+-commutative86.1%
associate-*r*86.1%
fma-define86.1%
*-commutative86.1%
associate-*r/87.5%
*-commutative87.5%
Simplified87.5%
Final simplification85.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 (sqrt (- d))))
(if (<= h -7.5e+18)
(*
(* (/ t_0 (sqrt (- h))) (/ 1.0 (sqrt (/ l d))))
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D_m (* d 2.0))) 2.0)) l))))
(if (<= h -1.05e-306)
(*
(/ t_0 (sqrt (- l)))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 = sqrt(-d);
double tmp;
if (h <= -7.5e+18) {
tmp = ((t_0 / sqrt(-h)) * (1.0 / sqrt((l / d)))) * (1.0 - (0.5 * ((h * pow((M_m * (D_m / (d * 2.0))), 2.0)) / l)));
} else if (h <= -1.05e-306) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -7.5e+18) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-h))) * Float64(1.0 / sqrt(Float64(l / d)))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l)))); elseif (h <= -1.05e-306) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -7.5e+18], N[(N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1.05e-306], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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 := \sqrt{-d}\\
\mathbf{if}\;h \leq -7.5 \cdot 10^{+18}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-h}} \cdot \frac{1}{\sqrt{\frac{\ell}{d}}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;h \leq -1.05 \cdot 10^{-306}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -7.5e18Initial program 67.0%
Simplified65.2%
associate-*r/67.3%
frac-times69.1%
associate-/l*67.3%
*-commutative67.3%
Applied egg-rr67.3%
frac-2neg67.3%
sqrt-div79.9%
Applied egg-rr79.9%
clear-num80.0%
sqrt-div80.0%
metadata-eval80.0%
Applied egg-rr80.0%
if -7.5e18 < h < -1.0500000000000001e-306Initial program 77.1%
Simplified75.5%
frac-2neg75.5%
sqrt-div83.8%
Applied egg-rr83.8%
if -1.0500000000000001e-306 < h Initial program 70.0%
Simplified68.6%
Applied egg-rr81.6%
unpow181.6%
associate-*l/85.0%
associate-/l*84.9%
+-commutative84.9%
associate-*r*84.9%
fma-define84.9%
*-commutative84.9%
associate-*r/86.3%
*-commutative86.3%
Simplified86.3%
Final simplification84.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 (sqrt (- d))))
(if (<= h -8.2e+18)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D_m (* d 2.0))) 2.0)) l)))
(* (/ t_0 (sqrt (- h))) (sqrt (/ d l))))
(if (<= h -1.05e-306)
(*
(/ t_0 (sqrt (- l)))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 = sqrt(-d);
double tmp;
if (h <= -8.2e+18) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D_m / (d * 2.0))), 2.0)) / l))) * ((t_0 / sqrt(-h)) * sqrt((d / l)));
} else if (h <= -1.05e-306) {
tmp = (t_0 / sqrt(-l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -8.2e+18) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(Float64(t_0 / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); elseif (h <= -1.05e-306) tmp = Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -8.2e+18], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1.05e-306], N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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 := \sqrt{-d}\\
\mathbf{if}\;h \leq -8.2 \cdot 10^{+18}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(\frac{t\_0}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;h \leq -1.05 \cdot 10^{-306}:\\
\;\;\;\;\frac{t\_0}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -8.2e18Initial program 67.0%
Simplified65.2%
associate-*r/67.3%
frac-times69.1%
associate-/l*67.3%
*-commutative67.3%
Applied egg-rr67.3%
frac-2neg67.3%
sqrt-div79.9%
Applied egg-rr79.9%
if -8.2e18 < h < -1.0500000000000001e-306Initial program 77.1%
Simplified75.5%
frac-2neg75.5%
sqrt-div83.8%
Applied egg-rr83.8%
if -1.0500000000000001e-306 < h Initial program 70.0%
Simplified68.6%
Applied egg-rr81.6%
unpow181.6%
associate-*l/85.0%
associate-/l*84.9%
+-commutative84.9%
associate-*r*84.9%
fma-define84.9%
*-commutative84.9%
associate-*r/86.3%
*-commutative86.3%
Simplified86.3%
Final simplification84.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 -1e-309)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D_m (* d 2.0))) 2.0)) l)))
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 <= -1e-309) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D_m / (d * 2.0))), 2.0)) / l))) * ((sqrt(-d) / sqrt(-h)) * sqrt((d / l)));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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 <= -1e-309) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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, -1e-309], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 71.4%
Simplified70.5%
associate-*r/70.7%
frac-times71.6%
associate-/l*70.7%
*-commutative70.7%
Applied egg-rr70.7%
frac-2neg70.7%
sqrt-div78.7%
Applied egg-rr78.7%
if -1.000000000000002e-309 < l Initial program 70.5%
Simplified69.1%
Applied egg-rr82.2%
unpow182.2%
associate-*l/85.6%
associate-/l*85.5%
+-commutative85.5%
associate-*r*85.5%
fma-define85.5%
*-commutative85.5%
associate-*r/86.9%
*-commutative86.9%
Simplified86.9%
Final simplification83.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 (<= l -1e-309)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* (/ h l) (pow (* (/ M_m 2.0) (/ D_m d)) 2.0)))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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 <= -1e-309) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (0.5 * ((h / l) * pow(((M_m / 2.0) * (D_m / d)), 2.0))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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 <= -1e-309) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h / l) * (Float64(Float64(M_m / 2.0) * Float64(D_m / d)) ^ 2.0))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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, -1e-309], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h / l), $MachinePrecision] * N[Power[N[(N[(M$95$m / 2.0), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(\frac{M\_m}{2} \cdot \frac{D\_m}{d}\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -1.000000000000002e-309Initial program 71.4%
Simplified70.5%
frac-2neg70.5%
sqrt-div78.4%
Applied egg-rr78.4%
if -1.000000000000002e-309 < l Initial program 70.5%
Simplified69.1%
Applied egg-rr82.2%
unpow182.2%
associate-*l/85.6%
associate-/l*85.5%
+-commutative85.5%
associate-*r*85.5%
fma-define85.5%
*-commutative85.5%
associate-*r/86.9%
*-commutative86.9%
Simplified86.9%
Final simplification83.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.5e-83)
(*
(- 1.0 (* 0.5 (/ (* h (pow (* M_m (/ D_m (* d 2.0))) 2.0)) l)))
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d)))))
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* M_m D_m) (* d 2.0)) 2.0) 1.0)
(* (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.5e-83) {
tmp = (1.0 - (0.5 * ((h * pow((M_m * (D_m / (d * 2.0))), 2.0)) / l))) * (sqrt((d / l)) * (1.0 / sqrt((h / d))));
} else {
tmp = d * (fma(((h / l) * -0.5), pow(((M_m * D_m) / (d * 2.0)), 2.0), 1.0) / (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 <= 1.5e-83) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0)) / l))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d))))); else tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / Float64(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, 1.5e-83], N[(N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / 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}\;\ell \leq 1.5 \cdot 10^{-83}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.50000000000000005e-83Initial program 73.8%
Simplified73.2%
associate-*r/75.4%
frac-times76.0%
associate-/l*75.4%
*-commutative75.4%
Applied egg-rr75.4%
clear-num75.4%
sqrt-div75.4%
metadata-eval75.4%
Applied egg-rr75.4%
if 1.50000000000000005e-83 < l Initial program 66.4%
Simplified64.4%
Applied egg-rr81.3%
unpow181.3%
associate-*l/86.2%
associate-/l*87.0%
+-commutative87.0%
associate-*r*87.0%
fma-define87.0%
*-commutative87.0%
associate-*r/88.9%
*-commutative88.9%
Simplified88.9%
Final simplification80.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
(if (<= d -1.55e-176)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* h (/ (pow (* (/ d M_m) (/ 2.0 D_m)) -2.0) l)))))
(if (<= d 1.4e-307)
(* (sqrt (* h (pow l -3.0))) (* 0.125 (/ (pow (* M_m D_m) 2.0) d)))
(*
d
(/
(+ 1.0 (* (pow (* M_m (/ D_m (* d 2.0))) 2.0) (* (/ h l) -0.5)))
(* (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.55e-176) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (pow(((d / M_m) * (2.0 / D_m)), -2.0) / l))));
} else if (d <= 1.4e-307) {
tmp = sqrt((h * pow(l, -3.0))) * (0.125 * (pow((M_m * D_m), 2.0) / d));
} else {
tmp = d * ((1.0 + (pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.55d-176)) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (h * ((((d / m_m) * (2.0d0 / d_m)) ** (-2.0d0)) / l))))
else if (d <= 1.4d-307) then
tmp = sqrt((h * (l ** (-3.0d0)))) * (0.125d0 * (((m_m * d_m) ** 2.0d0) / d))
else
tmp = d * ((1.0d0 + (((m_m * (d_m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0)))) / (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.55e-176) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (Math.pow(((d / M_m) * (2.0 / D_m)), -2.0) / l))));
} else if (d <= 1.4e-307) {
tmp = Math.sqrt((h * Math.pow(l, -3.0))) * (0.125 * (Math.pow((M_m * D_m), 2.0) / d));
} else {
tmp = d * ((1.0 + (Math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.55e-176: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (math.pow(((d / M_m) * (2.0 / D_m)), -2.0) / l)))) elif d <= 1.4e-307: tmp = math.sqrt((h * math.pow(l, -3.0))) * (0.125 * (math.pow((M_m * D_m), 2.0) / d)) else: tmp = d * ((1.0 + (math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.55e-176) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(d / M_m) * Float64(2.0 / D_m)) ^ -2.0) / l))))); elseif (d <= 1.4e-307) tmp = Float64(sqrt(Float64(h * (l ^ -3.0))) * Float64(0.125 * Float64((Float64(M_m * D_m) ^ 2.0) / d))); else tmp = Float64(d * Float64(Float64(1.0 + Float64((Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5))) / 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.55e-176)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * ((((d / M_m) * (2.0 / D_m)) ^ -2.0) / l))));
elseif (d <= 1.4e-307)
tmp = sqrt((h * (l ^ -3.0))) * (0.125 * (((M_m * D_m) ^ 2.0) / d));
else
tmp = d * ((1.0 + (((M_m * (D_m / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5))) / (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.55e-176], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.4e-307], N[(N[Sqrt[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.125 * N[(N[Power[N[(M$95$m * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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}\;d \leq -1.55 \cdot 10^{-176}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{d}{M\_m} \cdot \frac{2}{D\_m}\right)}^{-2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.4 \cdot 10^{-307}:\\
\;\;\;\;\sqrt{h \cdot {\ell}^{-3}} \cdot \left(0.125 \cdot \frac{{\left(M\_m \cdot D\_m\right)}^{2}}{d}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.54999999999999996e-176Initial program 78.8%
Simplified77.7%
associate-*r/78.0%
frac-times79.1%
associate-/l*78.0%
*-commutative78.0%
Applied egg-rr78.0%
pow178.0%
Applied egg-rr78.0%
unpow178.0%
*-commutative78.0%
unpow278.0%
*-lft-identity78.0%
associate-*r/78.0%
associate-*r/78.0%
associate-*l/78.0%
associate-/r/78.0%
unpow-178.0%
*-lft-identity78.0%
associate-*r/79.2%
associate-*r/79.2%
associate-*l/79.1%
associate-/r/79.1%
unpow-179.1%
pow-sqr79.2%
times-frac78.1%
metadata-eval78.1%
Simplified78.1%
pow178.1%
sqrt-unprod73.5%
cancel-sign-sub-inv73.5%
metadata-eval73.5%
associate-/l*74.7%
Applied egg-rr74.7%
unpow174.7%
*-commutative74.7%
Simplified74.7%
if -1.54999999999999996e-176 < d < 1.4e-307Initial program 46.7%
Simplified46.7%
associate-*r/46.7%
frac-times46.7%
associate-/l*46.7%
*-commutative46.7%
Applied egg-rr46.7%
*-commutative46.7%
associate-/l*46.7%
associate-*r/46.7%
*-commutative46.7%
Simplified46.7%
Taylor expanded in h around -inf 0.0%
associate-*r*0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.2%
associate-*l*47.2%
*-commutative47.2%
mul-1-neg47.2%
unpow247.2%
unpow247.2%
swap-sqr54.5%
unpow254.5%
Simplified54.5%
pow154.5%
associate-*r*54.5%
div-inv54.5%
pow-flip58.0%
metadata-eval58.0%
*-commutative58.0%
Applied egg-rr58.0%
unpow158.0%
associate-*l*58.0%
distribute-frac-neg58.0%
neg-mul-158.0%
associate-*r*58.0%
metadata-eval58.0%
unpow258.0%
swap-sqr50.8%
unpow250.8%
unpow250.8%
*-commutative50.8%
*-commutative50.8%
unpow250.8%
unpow250.8%
swap-sqr58.0%
unpow258.0%
*-commutative58.0%
Simplified58.0%
if 1.4e-307 < d Initial program 71.0%
Simplified69.6%
Applied egg-rr82.7%
unpow182.7%
associate-*l/86.2%
associate-/l*86.1%
+-commutative86.1%
associate-*r*86.1%
fma-define86.1%
*-commutative86.1%
associate-*r/87.5%
*-commutative87.5%
Simplified87.5%
fma-undefine87.5%
*-commutative87.5%
associate-*r/86.1%
Applied egg-rr86.1%
Final simplification79.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 (pow (* M_m (/ D_m (* d 2.0))) 2.0)))
(if (<= l 1e-83)
(*
(- 1.0 (* 0.5 (/ (* h t_0) l)))
(* (sqrt (/ d l)) (/ 1.0 (sqrt (/ h d)))))
(* d (/ (+ 1.0 (* t_0 (* (/ h l) -0.5))) (* (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 * (D_m / (d * 2.0))), 2.0);
double tmp;
if (l <= 1e-83) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / l)) * (1.0 / sqrt((h / d))));
} else {
tmp = d * ((1.0 + (t_0 * ((h / l) * -0.5))) / (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 = (m_m * (d_m / (d * 2.0d0))) ** 2.0d0
if (l <= 1d-83) then
tmp = (1.0d0 - (0.5d0 * ((h * t_0) / l))) * (sqrt((d / l)) * (1.0d0 / sqrt((h / d))))
else
tmp = d * ((1.0d0 + (t_0 * ((h / l) * (-0.5d0)))) / (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 * (D_m / (d * 2.0))), 2.0);
double tmp;
if (l <= 1e-83) {
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (Math.sqrt((d / l)) * (1.0 / Math.sqrt((h / d))));
} else {
tmp = d * ((1.0 + (t_0 * ((h / l) * -0.5))) / (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 * (D_m / (d * 2.0))), 2.0) tmp = 0 if l <= 1e-83: tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (math.sqrt((d / l)) * (1.0 / math.sqrt((h / d)))) else: tmp = d * ((1.0 + (t_0 * ((h / l) * -0.5))) / (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(D_m / Float64(d * 2.0))) ^ 2.0 tmp = 0.0 if (l <= 1e-83) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(Float64(h * t_0) / l))) * Float64(sqrt(Float64(d / l)) * Float64(1.0 / sqrt(Float64(h / d))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64(t_0 * Float64(Float64(h / l) * -0.5))) / 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 * (D_m / (d * 2.0))) ^ 2.0;
tmp = 0.0;
if (l <= 1e-83)
tmp = (1.0 - (0.5 * ((h * t_0) / l))) * (sqrt((d / l)) * (1.0 / sqrt((h / d))));
else
tmp = d * ((1.0 + (t_0 * ((h / l) * -0.5))) / (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[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[l, 1e-83], N[(N[(1.0 - N[(0.5 * N[(N[(h * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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 \frac{D\_m}{d \cdot 2}\right)}^{2}\\
\mathbf{if}\;\ell \leq 10^{-83}:\\
\;\;\;\;\left(1 - 0.5 \cdot \frac{h \cdot t\_0}{\ell}\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{1}{\sqrt{\frac{h}{d}}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1e-83Initial program 73.8%
Simplified73.2%
associate-*r/75.4%
frac-times76.0%
associate-/l*75.4%
*-commutative75.4%
Applied egg-rr75.4%
clear-num75.4%
sqrt-div75.4%
metadata-eval75.4%
Applied egg-rr75.4%
if 1e-83 < l Initial program 66.4%
Simplified64.4%
Applied egg-rr81.3%
unpow181.3%
associate-*l/86.2%
associate-/l*87.0%
+-commutative87.0%
associate-*r*87.0%
fma-define87.0%
*-commutative87.0%
associate-*r/88.9%
*-commutative88.9%
Simplified88.9%
fma-undefine88.9%
*-commutative88.9%
associate-*r/87.0%
Applied egg-rr87.0%
Final simplification80.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 (<= l 4.2e-120)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* h (/ (pow (* (/ d M_m) (/ 2.0 D_m)) -2.0) l)))))
(if (<= l 2.7e+99)
(/
(* d (fma (pow (* D_m (/ M_m (* d 2.0))) 2.0) (* (/ h l) -0.5) 1.0))
(sqrt (* h 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 (l <= 4.2e-120) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (pow(((d / M_m) * (2.0 / D_m)), -2.0) / l))));
} else if (l <= 2.7e+99) {
tmp = (d * fma(pow((D_m * (M_m / (d * 2.0))), 2.0), ((h / l) * -0.5), 1.0)) / sqrt((h * l));
} 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 <= 4.2e-120) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(d / M_m) * Float64(2.0 / D_m)) ^ -2.0) / l))))); elseif (l <= 2.7e+99) tmp = Float64(Float64(d * fma((Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0), Float64(Float64(h / l) * -0.5), 1.0)) / sqrt(Float64(h * l))); 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, 4.2e-120], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.7e+99], N[(N[(d * N[(N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $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 4.2 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{d}{M\_m} \cdot \frac{2}{D\_m}\right)}^{-2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.7 \cdot 10^{+99}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left({\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 4.2000000000000001e-120Initial program 73.3%
Simplified72.7%
associate-*r/74.9%
frac-times75.6%
associate-/l*74.9%
*-commutative74.9%
Applied egg-rr74.9%
pow174.9%
Applied egg-rr74.9%
unpow174.9%
*-commutative74.9%
unpow274.9%
*-lft-identity74.9%
associate-*r/74.9%
associate-*r/74.9%
associate-*l/74.9%
associate-/r/74.9%
unpow-174.9%
*-lft-identity74.9%
associate-*r/75.6%
associate-*r/75.6%
associate-*l/75.6%
associate-/r/75.6%
unpow-175.6%
pow-sqr75.6%
times-frac75.0%
metadata-eval75.0%
Simplified75.0%
pow175.0%
sqrt-unprod70.3%
cancel-sign-sub-inv70.3%
metadata-eval70.3%
associate-/l*70.3%
Applied egg-rr70.3%
unpow170.3%
*-commutative70.3%
Simplified70.3%
if 4.2000000000000001e-120 < l < 2.69999999999999989e99Initial program 70.6%
Simplified68.8%
Applied egg-rr87.2%
unpow187.2%
associate-*r*87.2%
*-commutative87.2%
associate-*r/88.9%
*-commutative88.9%
associate-*r/88.9%
associate-*r*88.9%
associate-*r*88.9%
associate-/r*88.9%
Simplified88.9%
associate-*l/92.5%
+-commutative92.5%
*-commutative92.5%
associate-/l/92.5%
*-commutative92.5%
associate-/l*92.5%
fma-define92.5%
associate-/l*92.5%
sqrt-unprod84.2%
*-commutative84.2%
Applied egg-rr84.2%
if 2.69999999999999989e99 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification72.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 (* (/ d M_m) (/ 2.0 D_m)) -2.0)))
(if (<= l 2.1e-120)
(* (sqrt (* (/ d h) (/ d l))) (+ 1.0 (* -0.5 (* h (/ t_0 l)))))
(if (<= l 2.55e+99)
(* d (/ (fma (/ h l) (* -0.5 t_0) 1.0) (sqrt (* h 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 t_0 = pow(((d / M_m) * (2.0 / D_m)), -2.0);
double tmp;
if (l <= 2.1e-120) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (t_0 / l))));
} else if (l <= 2.55e+99) {
tmp = d * (fma((h / l), (-0.5 * t_0), 1.0) / sqrt((h * l)));
} 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) t_0 = Float64(Float64(d / M_m) * Float64(2.0 / D_m)) ^ -2.0 tmp = 0.0 if (l <= 2.1e-120) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64(t_0 / l))))); elseif (l <= 2.55e+99) tmp = Float64(d * Float64(fma(Float64(h / l), Float64(-0.5 * t_0), 1.0) / sqrt(Float64(h * l)))); 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_] := Block[{t$95$0 = N[Power[N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]}, If[LessEqual[l, 2.1e-120], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.55e+99], N[(d * N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $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}
t_0 := {\left(\frac{d}{M\_m} \cdot \frac{2}{D\_m}\right)}^{-2}\\
\mathbf{if}\;\ell \leq 2.1 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{t\_0}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.55 \cdot 10^{+99}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot t\_0, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 2.1e-120Initial program 73.3%
Simplified72.7%
associate-*r/74.9%
frac-times75.6%
associate-/l*74.9%
*-commutative74.9%
Applied egg-rr74.9%
pow174.9%
Applied egg-rr74.9%
unpow174.9%
*-commutative74.9%
unpow274.9%
*-lft-identity74.9%
associate-*r/74.9%
associate-*r/74.9%
associate-*l/74.9%
associate-/r/74.9%
unpow-174.9%
*-lft-identity74.9%
associate-*r/75.6%
associate-*r/75.6%
associate-*l/75.6%
associate-/r/75.6%
unpow-175.6%
pow-sqr75.6%
times-frac75.0%
metadata-eval75.0%
Simplified75.0%
pow175.0%
sqrt-unprod70.3%
cancel-sign-sub-inv70.3%
metadata-eval70.3%
associate-/l*70.3%
Applied egg-rr70.3%
unpow170.3%
*-commutative70.3%
Simplified70.3%
if 2.1e-120 < l < 2.54999999999999976e99Initial program 70.6%
Simplified68.8%
Applied egg-rr87.2%
unpow187.2%
associate-*l/90.8%
associate-/l*90.8%
+-commutative90.8%
associate-*r*90.8%
fma-define90.8%
*-commutative90.8%
associate-*r/92.5%
*-commutative92.5%
Simplified92.5%
*-un-lft-identity92.5%
*-commutative92.5%
associate-*r/90.8%
*-commutative90.8%
sqrt-prod82.5%
Applied egg-rr82.5%
*-lft-identity82.5%
Simplified84.1%
if 2.54999999999999976e99 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification72.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 (<= l 1.7e-83)
(*
(- 1.0 (* 0.5 (* h (/ (pow (/ (* M_m D_m) (* d 2.0)) 2.0) l))))
(* (sqrt (/ d h)) (sqrt (/ d l))))
(*
d
(/
(+ 1.0 (* (pow (* M_m (/ D_m (* d 2.0))) 2.0) (* (/ h l) -0.5)))
(* (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.7e-83) {
tmp = (1.0 - (0.5 * (h * (pow(((M_m * D_m) / (d * 2.0)), 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = d * ((1.0 + (pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.7d-83) then
tmp = (1.0d0 - (0.5d0 * (h * ((((m_m * d_m) / (d * 2.0d0)) ** 2.0d0) / l)))) * (sqrt((d / h)) * sqrt((d / l)))
else
tmp = d * ((1.0d0 + (((m_m * (d_m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0)))) / (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.7e-83) {
tmp = (1.0 - (0.5 * (h * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) / l)))) * (Math.sqrt((d / h)) * Math.sqrt((d / l)));
} else {
tmp = d * ((1.0 + (Math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.7e-83: tmp = (1.0 - (0.5 * (h * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) / l)))) * (math.sqrt((d / h)) * math.sqrt((d / l))) else: tmp = d * ((1.0 + (math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.7e-83) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) / l)))) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(d * Float64(Float64(1.0 + Float64((Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5))) / 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 (l <= 1.7e-83)
tmp = (1.0 - (0.5 * (h * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) / l)))) * (sqrt((d / h)) * sqrt((d / l)));
else
tmp = d * ((1.0 + (((M_m * (D_m / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5))) / (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.7e-83], N[(N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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}\;\ell \leq 1.7 \cdot 10^{-83}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.6999999999999999e-83Initial program 73.8%
Simplified73.2%
associate-*r/75.4%
frac-times76.0%
associate-/l*75.4%
*-commutative75.4%
Applied egg-rr75.4%
*-commutative75.4%
associate-/l*74.8%
associate-*r/75.4%
*-commutative75.4%
Simplified75.4%
if 1.6999999999999999e-83 < l Initial program 66.4%
Simplified64.4%
Applied egg-rr81.3%
unpow181.3%
associate-*l/86.2%
associate-/l*87.0%
+-commutative87.0%
associate-*r*87.0%
fma-define87.0%
*-commutative87.0%
associate-*r/88.9%
*-commutative88.9%
Simplified88.9%
fma-undefine88.9%
*-commutative88.9%
associate-*r/87.0%
Applied egg-rr87.0%
Final simplification80.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 (<= l -5.8e-297)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(*
d
(/
(+ 1.0 (* (pow (* M_m (/ D_m (* d 2.0))) 2.0) (* (/ h l) -0.5)))
(* (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.8e-297) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else {
tmp = d * ((1.0 + (pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.8d-297)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0)))))
else
tmp = d * ((1.0d0 + (((m_m * (d_m / (d * 2.0d0))) ** 2.0d0) * ((h / l) * (-0.5d0)))) / (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.8e-297) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else {
tmp = d * ((1.0 + (Math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.8e-297: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) else: tmp = d * ((1.0 + (math.pow((M_m * (D_m / (d * 2.0))), 2.0) * ((h / l) * -0.5))) / (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.8e-297) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64((Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0) * Float64(Float64(h / l) * -0.5))) / 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 (l <= -5.8e-297)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0)))));
else
tmp = d * ((1.0 + (((M_m * (D_m / (d * 2.0))) ^ 2.0) * ((h / l) * -0.5))) / (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.8e-297], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 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}\;\ell \leq -5.8 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5.79999999999999979e-297Initial program 72.7%
Simplified71.9%
if -5.79999999999999979e-297 < l Initial program 69.5%
Simplified68.2%
Applied egg-rr81.0%
unpow181.0%
associate-*l/84.4%
associate-/l*84.4%
+-commutative84.4%
associate-*r*84.4%
fma-define84.4%
*-commutative84.4%
associate-*r/85.7%
*-commutative85.7%
Simplified85.7%
fma-undefine85.7%
*-commutative85.7%
associate-*r/84.4%
Applied egg-rr84.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
(let* ((t_0 (* (/ h l) -0.5)))
(if (<= l -5.8e-297)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (+ 1.0 (* t_0 (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)))))
(*
d
(/
(+ 1.0 (* (pow (* M_m (/ D_m (* d 2.0))) 2.0) t_0))
(* (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 = (h / l) * -0.5;
double tmp;
if (l <= -5.8e-297) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (t_0 * pow(((D_m / d) * (0.5 * M_m)), 2.0))));
} else {
tmp = d * ((1.0 + (pow((M_m * (D_m / (d * 2.0))), 2.0) * t_0)) / (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 = (h / l) * (-0.5d0)
if (l <= (-5.8d-297)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (t_0 * (((d_m / d) * (0.5d0 * m_m)) ** 2.0d0))))
else
tmp = d * ((1.0d0 + (((m_m * (d_m / (d * 2.0d0))) ** 2.0d0) * t_0)) / (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 = (h / l) * -0.5;
double tmp;
if (l <= -5.8e-297) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (t_0 * Math.pow(((D_m / d) * (0.5 * M_m)), 2.0))));
} else {
tmp = d * ((1.0 + (Math.pow((M_m * (D_m / (d * 2.0))), 2.0) * t_0)) / (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 = (h / l) * -0.5 tmp = 0 if l <= -5.8e-297: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (t_0 * math.pow(((D_m / d) * (0.5 * M_m)), 2.0)))) else: tmp = d * ((1.0 + (math.pow((M_m * (D_m / (d * 2.0))), 2.0) * t_0)) / (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(Float64(h / l) * -0.5) tmp = 0.0 if (l <= -5.8e-297) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(t_0 * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64((Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0) * t_0)) / 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 = (h / l) * -0.5;
tmp = 0.0;
if (l <= -5.8e-297)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (t_0 * (((D_m / d) * (0.5 * M_m)) ^ 2.0))));
else
tmp = d * ((1.0 + (((M_m * (D_m / (d * 2.0))) ^ 2.0) * t_0)) / (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[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[l, -5.8e-297], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(t$95$0 * 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[(d * N[(N[(1.0 + N[(N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] / 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 := \frac{h}{\ell} \cdot -0.5\\
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{-297}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + t\_0 \cdot {\left(\frac{D\_m}{d} \cdot \left(0.5 \cdot M\_m\right)\right)}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + {\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2} \cdot t\_0}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5.79999999999999979e-297Initial program 72.7%
Simplified71.0%
fma-undefine71.0%
associate-*r*71.0%
Applied egg-rr71.0%
if -5.79999999999999979e-297 < l Initial program 69.5%
Simplified68.2%
Applied egg-rr81.0%
unpow181.0%
associate-*l/84.4%
associate-/l*84.4%
+-commutative84.4%
associate-*r*84.4%
fma-define84.4%
*-commutative84.4%
associate-*r/85.7%
*-commutative85.7%
Simplified85.7%
fma-undefine85.7%
*-commutative85.7%
associate-*r/84.4%
Applied egg-rr84.4%
Final simplification78.7%
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 -8.8e-100)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l -1e-309)
(* d (exp (* 0.5 (- (log1p (+ (* h l) -1.0))))))
(if (<= l 2.6e+99)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.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 (l <= -8.8e-100) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= -1e-309) {
tmp = d * exp((0.5 * -log1p(((h * l) + -1.0))));
} else if (l <= 2.6e+99) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
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 <= -8.8e-100) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= -1e-309) {
tmp = d * Math.exp((0.5 * -Math.log1p(((h * l) + -1.0))));
} else if (l <= 2.6e+99) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.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 l <= -8.8e-100: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= -1e-309: tmp = d * math.exp((0.5 * -math.log1p(((h * l) + -1.0)))) elif l <= 2.6e+99: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= -8.8e-100) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= -1e-309) tmp = Float64(d * exp(Float64(0.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))))); elseif (l <= 2.6e+99) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); 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, -8.8e-100], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(d * N[Exp[N[(0.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+99], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 -8.8 \cdot 10^{-100}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;d \cdot e^{0.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)}\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+99}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -8.79999999999999957e-100Initial program 69.0%
Simplified66.6%
Taylor expanded in M around 0 51.3%
if -8.79999999999999957e-100 < l < -1.000000000000002e-309Initial program 76.6%
Simplified76.6%
Taylor expanded in d around inf 25.7%
pow1/225.7%
pow-to-exp25.7%
log-rec25.5%
Applied egg-rr25.5%
log1p-expm1-u57.3%
expm1-undefine57.3%
add-exp-log57.3%
Applied egg-rr57.3%
if -1.000000000000002e-309 < l < 2.6e99Initial program 74.0%
Simplified73.0%
Applied egg-rr85.5%
unpow185.5%
associate-*r*85.5%
*-commutative85.5%
associate-*r/86.5%
*-commutative86.5%
associate-*r/86.5%
associate-*r*86.5%
associate-*r*86.5%
associate-/r*86.5%
Simplified86.5%
Taylor expanded in l around 0 75.0%
if 2.6e99 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification63.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-120)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* h (/ (pow (* (/ d M_m) (/ 2.0 D_m)) -2.0) l)))))
(if (<= l 4.7e+98)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.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 (l <= 2.9e-120) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (pow(((d / M_m) * (2.0 / D_m)), -2.0) / l))));
} else if (l <= 4.7e+98) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 2.9d-120) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * (h * ((((d / m_m) * (2.0d0 / d_m)) ** (-2.0d0)) / l))))
else if (l <= 4.7d+98) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.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 (l <= 2.9e-120) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (Math.pow(((d / M_m) * (2.0 / D_m)), -2.0) / l))));
} else if (l <= 4.7e+98) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.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 l <= 2.9e-120: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * (math.pow(((d / M_m) * (2.0 / D_m)), -2.0) / l)))) elif l <= 4.7e+98: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 2.9e-120) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(h * Float64((Float64(Float64(d / M_m) * Float64(2.0 / D_m)) ^ -2.0) / l))))); elseif (l <= 4.7e+98) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= 2.9e-120)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * (h * ((((d / M_m) * (2.0 / D_m)) ^ -2.0) / l))));
elseif (l <= 4.7e+98)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.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[l, 2.9e-120], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(h * N[(N[Power[N[(N[(d / M$95$m), $MachinePrecision] * N[(2.0 / D$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.7e+98], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 2.9 \cdot 10^{-120}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(h \cdot \frac{{\left(\frac{d}{M\_m} \cdot \frac{2}{D\_m}\right)}^{-2}}{\ell}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.7 \cdot 10^{+98}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 2.9e-120Initial program 73.3%
Simplified72.7%
associate-*r/74.9%
frac-times75.6%
associate-/l*74.9%
*-commutative74.9%
Applied egg-rr74.9%
pow174.9%
Applied egg-rr74.9%
unpow174.9%
*-commutative74.9%
unpow274.9%
*-lft-identity74.9%
associate-*r/74.9%
associate-*r/74.9%
associate-*l/74.9%
associate-/r/74.9%
unpow-174.9%
*-lft-identity74.9%
associate-*r/75.6%
associate-*r/75.6%
associate-*l/75.6%
associate-/r/75.6%
unpow-175.6%
pow-sqr75.6%
times-frac75.0%
metadata-eval75.0%
Simplified75.0%
pow175.0%
sqrt-unprod70.3%
cancel-sign-sub-inv70.3%
metadata-eval70.3%
associate-/l*70.3%
Applied egg-rr70.3%
unpow170.3%
*-commutative70.3%
Simplified70.3%
if 2.9e-120 < l < 4.6999999999999997e98Initial program 70.6%
Simplified68.8%
Applied egg-rr87.2%
unpow187.2%
associate-*r*87.2%
*-commutative87.2%
associate-*r/88.9%
*-commutative88.9%
associate-*r/88.9%
associate-*r*88.9%
associate-*r*88.9%
associate-/r*88.9%
Simplified88.9%
Taylor expanded in l around 0 80.6%
if 4.6999999999999997e98 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification71.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 (<= l 3.7e-140)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* (/ h l) (* (pow (* M_m (/ D_m (* d 2.0))) 2.0) -0.5))))
(if (<= l 2.6e+99)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.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 (l <= 3.7e-140) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((h / l) * (pow((M_m * (D_m / (d * 2.0))), 2.0) * -0.5)));
} else if (l <= 2.6e+99) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 3.7d-140) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((h / l) * (((m_m * (d_m / (d * 2.0d0))) ** 2.0d0) * (-0.5d0))))
else if (l <= 2.6d+99) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.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 (l <= 3.7e-140) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + ((h / l) * (Math.pow((M_m * (D_m / (d * 2.0))), 2.0) * -0.5)));
} else if (l <= 2.6e+99) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.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 l <= 3.7e-140: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + ((h / l) * (math.pow((M_m * (D_m / (d * 2.0))), 2.0) * -0.5))) elif l <= 2.6e+99: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 3.7e-140) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(M_m * Float64(D_m / Float64(d * 2.0))) ^ 2.0) * -0.5)))); elseif (l <= 2.6e+99) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= 3.7e-140)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + ((h / l) * (((M_m * (D_m / (d * 2.0))) ^ 2.0) * -0.5)));
elseif (l <= 2.6e+99)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.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[l, 3.7e-140], N[(N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(M$95$m * N[(D$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+99], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 3.7 \cdot 10^{-140}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left({\left(M\_m \cdot \frac{D\_m}{d \cdot 2}\right)}^{2} \cdot -0.5\right)\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+99}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 3.69999999999999977e-140Initial program 74.3%
Simplified73.7%
associate-*r/74.6%
frac-times75.2%
associate-/l*74.6%
*-commutative74.6%
Applied egg-rr74.6%
frac-2neg74.6%
sqrt-div58.1%
Applied egg-rr58.1%
pow158.1%
sqrt-undiv74.6%
frac-2neg74.6%
sqrt-unprod69.9%
cancel-sign-sub-inv69.9%
metadata-eval69.9%
associate-/l*69.0%
Applied egg-rr69.0%
unpow169.0%
associate-*r*69.0%
*-commutative69.0%
Simplified69.0%
if 3.69999999999999977e-140 < l < 2.6e99Initial program 68.2%
Simplified66.5%
Applied egg-rr84.2%
unpow184.2%
associate-*r*84.2%
*-commutative84.2%
associate-*r/85.9%
*-commutative85.9%
associate-*r/85.9%
associate-*r*85.9%
associate-*r*85.9%
associate-/r*85.9%
Simplified85.9%
Taylor expanded in l around 0 77.9%
if 2.6e99 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification70.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 (<= l 3.5e-140)
(*
(sqrt (* (/ d h) (/ d l)))
(+ 1.0 (* -0.5 (* (/ h l) (pow (* D_m (/ M_m (* d 2.0))) 2.0)))))
(if (<= l 4.8e+98)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.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 (l <= 3.5e-140) {
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * pow((D_m * (M_m / (d * 2.0))), 2.0))));
} else if (l <= 4.8e+98) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 3.5d-140) then
tmp = sqrt(((d / h) * (d / l))) * (1.0d0 + ((-0.5d0) * ((h / l) * ((d_m * (m_m / (d * 2.0d0))) ** 2.0d0))))
else if (l <= 4.8d+98) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.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 (l <= 3.5e-140) {
tmp = Math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * Math.pow((D_m * (M_m / (d * 2.0))), 2.0))));
} else if (l <= 4.8e+98) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.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 l <= 3.5e-140: tmp = math.sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * math.pow((D_m * (M_m / (d * 2.0))), 2.0)))) elif l <= 4.8e+98: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.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 (l <= 3.5e-140) tmp = Float64(sqrt(Float64(Float64(d / h) * Float64(d / l))) * Float64(1.0 + Float64(-0.5 * Float64(Float64(h / l) * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))))); elseif (l <= 4.8e+98) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.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)
tmp = 0.0;
if (l <= 3.5e-140)
tmp = sqrt(((d / h) * (d / l))) * (1.0 + (-0.5 * ((h / l) * ((D_m * (M_m / (d * 2.0))) ^ 2.0))));
elseif (l <= 4.8e+98)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.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[l, 3.5e-140], 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[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.8e+98], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $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 3.5 \cdot 10^{-140}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}} \cdot \left(1 + -0.5 \cdot \left(\frac{h}{\ell} \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.8 \cdot 10^{+98}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < 3.4999999999999998e-140Initial program 74.3%
Simplified73.7%
associate-*r/74.6%
frac-times75.2%
associate-/l*74.6%
*-commutative74.6%
Applied egg-rr74.6%
pow174.6%
sqrt-unprod69.9%
cancel-sign-sub-inv69.9%
metadata-eval69.9%
associate-/l*69.0%
Applied egg-rr69.0%
unpow169.0%
*-commutative69.0%
associate-*r/69.6%
associate-*l/69.0%
*-commutative69.0%
*-commutative69.0%
Simplified69.0%
if 3.4999999999999998e-140 < l < 4.7999999999999997e98Initial program 68.2%
Simplified66.5%
Applied egg-rr84.2%
unpow184.2%
associate-*r*84.2%
*-commutative84.2%
associate-*r/85.9%
*-commutative85.9%
associate-*r/85.9%
associate-*r*85.9%
associate-*r*85.9%
associate-/r*85.9%
Simplified85.9%
Taylor expanded in l around 0 77.9%
if 4.7999999999999997e98 < l Initial program 63.6%
Simplified61.4%
Taylor expanded in d around inf 42.1%
sqrt-div42.0%
metadata-eval42.0%
*-commutative42.0%
sqrt-unprod63.4%
div-inv63.7%
associate-/r*63.8%
Applied egg-rr63.8%
Final simplification70.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 (<= l -5.2e-100)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 3.5e-275)
(* d (exp (* 0.5 (- (log1p (+ (* h l) -1.0))))))
(if (<= l 1.05e-198)
(/ (- d) (sqrt (* h 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 (l <= -5.2e-100) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 3.5e-275) {
tmp = d * exp((0.5 * -log1p(((h * l) + -1.0))));
} else if (l <= 1.05e-198) {
tmp = -d / sqrt((h * l));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
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-100) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 3.5e-275) {
tmp = d * Math.exp((0.5 * -Math.log1p(((h * l) + -1.0))));
} else if (l <= 1.05e-198) {
tmp = -d / Math.sqrt((h * l));
} 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-100: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= 3.5e-275: tmp = d * math.exp((0.5 * -math.log1p(((h * l) + -1.0)))) elif l <= 1.05e-198: tmp = -d / math.sqrt((h * l)) 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-100) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 3.5e-275) tmp = Float64(d * exp(Float64(0.5 * Float64(-log1p(Float64(Float64(h * l) + -1.0)))))); elseif (l <= 1.05e-198) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); 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, -5.2e-100], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.5e-275], N[(d * N[Exp[N[(0.5 * (-N[Log[1 + N[(N[(h * l), $MachinePrecision] + -1.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.05e-198], N[((-d) / N[Sqrt[N[(h * l), $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^{-100}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 3.5 \cdot 10^{-275}:\\
\;\;\;\;d \cdot e^{0.5 \cdot \left(-\mathsf{log1p}\left(h \cdot \ell + -1\right)\right)}\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{-198}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -5.1999999999999997e-100Initial program 69.0%
Simplified66.6%
Taylor expanded in M around 0 51.3%
if -5.1999999999999997e-100 < l < 3.49999999999999969e-275Initial program 75.9%
Simplified75.9%
Taylor expanded in d around inf 28.8%
pow1/228.8%
pow-to-exp28.5%
log-rec28.4%
Applied egg-rr28.4%
log1p-expm1-u52.7%
expm1-undefine52.7%
add-exp-log52.7%
Applied egg-rr52.7%
if 3.49999999999999969e-275 < l < 1.04999999999999996e-198Initial program 87.3%
Simplified87.3%
associate-*r/87.6%
frac-times87.6%
associate-/l*87.6%
*-commutative87.6%
Applied egg-rr87.6%
*-commutative87.6%
associate-/l*81.8%
associate-*r/81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt52.0%
mul-1-neg52.0%
remove-double-neg52.0%
associate-/r*52.0%
unpow1/252.0%
associate-/r*52.0%
rem-exp-log52.0%
exp-neg52.0%
exp-prod52.0%
distribute-lft-neg-out52.0%
exp-neg52.0%
exp-to-pow52.0%
unpow1/252.0%
Simplified52.0%
if 1.04999999999999996e-198 < l Initial program 68.2%
Simplified66.5%
Taylor expanded in d around inf 41.4%
sqrt-div42.2%
metadata-eval42.2%
*-commutative42.2%
sqrt-unprod56.7%
div-inv56.8%
associate-/r*56.9%
Applied egg-rr56.9%
Final simplification54.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 (/ (/ 1.0 h) l)))
(if (<= l -1.4e-115)
(* (- d) (sqrt t_0))
(if (<= l -5.8e-297)
(* d (cbrt (pow t_0 1.5)))
(if (<= l 1.3e-198)
(/ (- d) (sqrt (* h 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 t_0 = (1.0 / h) / l;
double tmp;
if (l <= -1.4e-115) {
tmp = -d * sqrt(t_0);
} else if (l <= -5.8e-297) {
tmp = d * cbrt(pow(t_0, 1.5));
} else if (l <= 1.3e-198) {
tmp = -d / sqrt((h * l));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
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 / h) / l;
double tmp;
if (l <= -1.4e-115) {
tmp = -d * Math.sqrt(t_0);
} else if (l <= -5.8e-297) {
tmp = d * Math.cbrt(Math.pow(t_0, 1.5));
} else if (l <= 1.3e-198) {
tmp = -d / Math.sqrt((h * l));
} 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(Float64(1.0 / h) / l) tmp = 0.0 if (l <= -1.4e-115) tmp = Float64(Float64(-d) * sqrt(t_0)); elseif (l <= -5.8e-297) tmp = Float64(d * cbrt((t_0 ^ 1.5))); elseif (l <= 1.3e-198) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); 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_] := Block[{t$95$0 = N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[l, -1.4e-115], N[((-d) * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.8e-297], N[(d * N[Power[N[Power[t$95$0, 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-198], N[((-d) / N[Sqrt[N[(h * l), $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 := \frac{\frac{1}{h}}{\ell}\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-115}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{t\_0}\\
\mathbf{elif}\;\ell \leq -5.8 \cdot 10^{-297}:\\
\;\;\;\;d \cdot \sqrt[3]{{t\_0}^{1.5}}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-198}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.39999999999999994e-115Initial program 69.8%
Simplified68.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.1%
neg-mul-147.1%
Simplified47.1%
if -1.39999999999999994e-115 < l < -5.79999999999999979e-297Initial program 80.2%
Simplified80.2%
Taylor expanded in d around inf 28.9%
add-cbrt-cube35.8%
pow1/335.8%
add-sqr-sqrt35.8%
pow135.8%
pow1/235.8%
pow-prod-up35.8%
associate-/r*35.8%
metadata-eval35.8%
Applied egg-rr35.8%
unpow1/335.8%
Simplified35.8%
if -5.79999999999999979e-297 < l < 1.30000000000000003e-198Initial program 76.2%
Simplified76.2%
associate-*r/76.9%
frac-times76.9%
associate-/l*76.9%
*-commutative76.9%
Applied egg-rr76.9%
*-commutative76.9%
associate-/l*73.2%
associate-*r/73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.5%
mul-1-neg45.5%
remove-double-neg45.5%
associate-/r*45.5%
unpow1/245.5%
associate-/r*45.5%
rem-exp-log45.2%
exp-neg45.2%
exp-prod45.2%
distribute-lft-neg-out45.2%
exp-neg45.2%
exp-to-pow45.5%
unpow1/245.5%
Simplified45.5%
if 1.30000000000000003e-198 < l Initial program 68.2%
Simplified66.5%
Taylor expanded in d around inf 41.4%
sqrt-div42.2%
metadata-eval42.2%
*-commutative42.2%
sqrt-unprod56.7%
div-inv56.8%
associate-/r*56.9%
Applied egg-rr56.9%
Final simplification50.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 (<= l -2.3e-115)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5.8e-297)
(/ d (cbrt (pow (* h l) 1.5)))
(if (<= l 1.1e-198)
(/ (- d) (sqrt (* h 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 (l <= -2.3e-115) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5.8e-297) {
tmp = d / cbrt(pow((h * l), 1.5));
} else if (l <= 1.1e-198) {
tmp = -d / sqrt((h * l));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
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.3e-115) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5.8e-297) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else if (l <= 1.1e-198) {
tmp = -d / Math.sqrt((h * l));
} 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 <= -2.3e-115) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5.8e-297) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); elseif (l <= 1.1e-198) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); 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, -2.3e-115], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5.8e-297], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.1e-198], N[((-d) / N[Sqrt[N[(h * l), $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 -2.3 \cdot 10^{-115}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5.8 \cdot 10^{-297}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{-198}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.29999999999999985e-115Initial program 69.8%
Simplified68.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.1%
neg-mul-147.1%
Simplified47.1%
if -2.29999999999999985e-115 < l < -5.79999999999999979e-297Initial program 80.2%
Simplified80.2%
associate-*r/83.7%
frac-times83.7%
associate-/l*83.7%
*-commutative83.7%
Applied egg-rr83.7%
*-commutative83.7%
associate-/l*80.8%
associate-*r/80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in d around inf 28.9%
associate-/r*28.9%
unpow1/228.9%
associate-/r*28.9%
rem-exp-log28.9%
exp-neg28.9%
exp-prod28.8%
distribute-lft-neg-out28.8%
exp-neg28.8%
exp-to-pow28.8%
unpow1/228.8%
unpow-128.8%
unpow-128.8%
associate-/l*28.8%
*-rgt-identity28.8%
Simplified28.8%
add-cbrt-cube35.6%
pow1/335.6%
add-sqr-sqrt35.6%
pow135.6%
pow1/235.6%
pow-prod-up35.6%
metadata-eval35.6%
Applied egg-rr35.6%
unpow1/335.6%
Simplified35.6%
if -5.79999999999999979e-297 < l < 1.1e-198Initial program 76.2%
Simplified76.2%
associate-*r/76.9%
frac-times76.9%
associate-/l*76.9%
*-commutative76.9%
Applied egg-rr76.9%
*-commutative76.9%
associate-/l*73.2%
associate-*r/73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt45.5%
mul-1-neg45.5%
remove-double-neg45.5%
associate-/r*45.5%
unpow1/245.5%
associate-/r*45.5%
rem-exp-log45.2%
exp-neg45.2%
exp-prod45.2%
distribute-lft-neg-out45.2%
exp-neg45.2%
exp-to-pow45.5%
unpow1/245.5%
Simplified45.5%
if 1.1e-198 < l Initial program 68.2%
Simplified66.5%
Taylor expanded in d around inf 41.4%
sqrt-div42.2%
metadata-eval42.2%
*-commutative42.2%
sqrt-unprod56.7%
div-inv56.8%
associate-/r*56.9%
Applied egg-rr56.9%
Final simplification50.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 (<= l -1.9e+200)
(* (sqrt (/ d h)) (sqrt (/ d l)))
(if (<= l 1.45e-198)
(* (- d) (sqrt (/ (/ 1.0 h) 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 (l <= -1.9e+200) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else if (l <= 1.45e-198) {
tmp = -d * sqrt(((1.0 / h) / l));
} 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.9d+200)) then
tmp = sqrt((d / h)) * sqrt((d / l))
else if (l <= 1.45d-198) then
tmp = -d * sqrt(((1.0d0 / h) / l))
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.9e+200) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else if (l <= 1.45e-198) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} 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.9e+200: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) elif l <= 1.45e-198: tmp = -d * math.sqrt(((1.0 / h) / l)) 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.9e+200) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); elseif (l <= 1.45e-198) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); 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.9e+200)
tmp = sqrt((d / h)) * sqrt((d / l));
elseif (l <= 1.45e-198)
tmp = -d * sqrt(((1.0 / h) / l));
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.9e+200], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.45e-198], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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.9 \cdot 10^{+200}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.45 \cdot 10^{-198}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.89999999999999991e200Initial program 56.9%
Simplified56.9%
Taylor expanded in M around 0 62.3%
if -1.89999999999999991e200 < l < 1.45e-198Initial program 76.3%
Simplified75.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt40.5%
neg-mul-140.5%
Simplified40.5%
if 1.45e-198 < l Initial program 68.2%
Simplified66.5%
Taylor expanded in d around inf 41.4%
sqrt-div42.2%
metadata-eval42.2%
*-commutative42.2%
sqrt-unprod56.7%
div-inv56.8%
associate-/r*56.9%
Applied egg-rr56.9%
Final simplification50.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.1e-304) (* (- d) (sqrt (/ (/ 1.0 h) 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.1e-304) {
tmp = -d * sqrt(((1.0 / h) / l));
} 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 (h <= 3.1d-304) then
tmp = -d * sqrt(((1.0d0 / h) / l))
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 (h <= 3.1e-304) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} 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 h <= 3.1e-304: tmp = -d * math.sqrt(((1.0 / h) / l)) 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 (h <= 3.1e-304) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); 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 (h <= 3.1e-304)
tmp = -d * sqrt(((1.0 / h) / l));
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[h, 3.1e-304], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $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}\;h \leq 3.1 \cdot 10^{-304}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < 3.09999999999999985e-304Initial program 71.9%
Simplified71.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt39.2%
neg-mul-139.2%
Simplified39.2%
if 3.09999999999999985e-304 < h Initial program 70.1%
Simplified68.7%
associate-*r/69.5%
frac-times70.8%
associate-/l*69.5%
*-commutative69.5%
Applied egg-rr69.5%
*-commutative69.5%
associate-/l*70.2%
associate-*r/71.6%
*-commutative71.6%
Simplified71.6%
Taylor expanded in d around inf 38.9%
associate-/r*39.8%
unpow1/239.8%
associate-/r*38.9%
rem-exp-log37.1%
exp-neg37.1%
exp-prod37.8%
distribute-lft-neg-out37.8%
exp-neg37.9%
exp-to-pow39.6%
unpow1/239.6%
unpow-139.6%
unpow-139.6%
associate-/l*39.7%
*-rgt-identity39.7%
Simplified39.7%
sqrt-prod52.8%
*-commutative52.8%
Applied egg-rr52.8%
Final simplification46.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 (sqrt (/ (/ 1.0 h) l)))) (if (<= h 2.4e-270) (* (- 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 (h <= 2.4e-270) {
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 (h <= 2.4d-270) 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 (h <= 2.4e-270) {
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 h <= 2.4e-270: 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 (h <= 2.4e-270) tmp = Float64(Float64(-d) * 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 (h <= 2.4e-270)
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[h, 2.4e-270], 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}\;h \leq 2.4 \cdot 10^{-270}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if h < 2.40000000000000002e-270Initial program 71.2%
Simplified70.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.6%
neg-mul-138.6%
Simplified38.6%
if 2.40000000000000002e-270 < h Initial program 70.6%
Simplified69.1%
Taylor expanded in d around inf 40.7%
associate-/r*41.6%
Simplified41.6%
Final simplification40.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 (<= h 2.4e-270) (* (- d) (pow (* h l) -0.5)) (* 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 (h <= 2.4e-270) {
tmp = -d * pow((h * l), -0.5);
} 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 (h <= 2.4d-270) then
tmp = -d * ((h * l) ** (-0.5d0))
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 (h <= 2.4e-270) {
tmp = -d * Math.pow((h * l), -0.5);
} 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 h <= 2.4e-270: tmp = -d * math.pow((h * l), -0.5) 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 (h <= 2.4e-270) tmp = Float64(Float64(-d) * (Float64(h * l) ^ -0.5)); 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 (h <= 2.4e-270)
tmp = -d * ((h * l) ^ -0.5);
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[h, 2.4e-270], N[((-d) * N[Power[N[(h * l), $MachinePrecision], -0.5], $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}\;h \leq 2.4 \cdot 10^{-270}:\\
\;\;\;\;\left(-d\right) \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if h < 2.40000000000000002e-270Initial program 71.2%
Simplified70.4%
associate-*r/70.6%
frac-times71.4%
associate-/l*70.6%
*-commutative70.6%
Applied egg-rr70.6%
pow170.6%
Applied egg-rr70.6%
unpow170.6%
*-commutative70.6%
unpow270.6%
*-lft-identity70.6%
associate-*r/70.6%
associate-*r/70.6%
associate-*l/70.6%
associate-/r/70.6%
unpow-170.6%
*-lft-identity70.6%
associate-*r/71.4%
associate-*r/71.4%
associate-*l/71.4%
associate-/r/71.4%
unpow-171.4%
pow-sqr71.4%
times-frac70.6%
metadata-eval70.6%
Simplified70.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt37.0%
*-commutative37.0%
neg-mul-137.0%
unpow-137.0%
metadata-eval37.0%
pow-sqr37.0%
rem-sqrt-square37.2%
rem-square-sqrt37.1%
fabs-sqr37.1%
rem-square-sqrt37.2%
Simplified37.2%
if 2.40000000000000002e-270 < h Initial program 70.6%
Simplified69.1%
Taylor expanded in d around inf 40.7%
associate-/r*41.6%
Simplified41.6%
Final simplification39.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 (<= h 2.4e-270) (/ (- d) (sqrt (* h l))) (* 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 (h <= 2.4e-270) {
tmp = -d / sqrt((h * l));
} 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 (h <= 2.4d-270) then
tmp = -d / sqrt((h * l))
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 (h <= 2.4e-270) {
tmp = -d / Math.sqrt((h * l));
} 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 h <= 2.4e-270: tmp = -d / math.sqrt((h * l)) 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 (h <= 2.4e-270) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); 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 (h <= 2.4e-270)
tmp = -d / sqrt((h * l));
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[h, 2.4e-270], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \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 2.4 \cdot 10^{-270}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if h < 2.40000000000000002e-270Initial program 71.2%
Simplified70.4%
associate-*r/70.6%
frac-times71.4%
associate-/l*70.6%
*-commutative70.6%
Applied egg-rr70.6%
*-commutative70.6%
associate-/l*70.6%
associate-*r/71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt37.0%
mul-1-neg37.0%
remove-double-neg37.0%
associate-/r*38.6%
unpow1/238.6%
associate-/r*37.0%
rem-exp-log35.3%
exp-neg35.3%
exp-prod35.5%
distribute-lft-neg-out35.5%
exp-neg35.5%
exp-to-pow37.2%
unpow1/237.2%
Simplified37.2%
if 2.40000000000000002e-270 < h Initial program 70.6%
Simplified69.1%
Taylor expanded in d around inf 40.7%
associate-/r*41.6%
Simplified41.6%
Final simplification39.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 (* h l)))) (if (<= d -4e-174) (/ (- 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((h * l));
double tmp;
if (d <= -4e-174) {
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((h * l))
if (d <= (-4d-174)) 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((h * l));
double tmp;
if (d <= -4e-174) {
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((h * l)) tmp = 0 if d <= -4e-174: 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(h * l)) tmp = 0.0 if (d <= -4e-174) tmp = Float64(Float64(-d) / 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((h * l));
tmp = 0.0;
if (d <= -4e-174)
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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -4e-174], 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{h \cdot \ell}\\
\mathbf{if}\;d \leq -4 \cdot 10^{-174}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if d < -4e-174Initial program 79.6%
Simplified78.3%
associate-*r/78.6%
frac-times79.8%
associate-/l*78.6%
*-commutative78.6%
Applied egg-rr78.6%
*-commutative78.6%
associate-/l*78.7%
associate-*r/79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt41.6%
mul-1-neg41.6%
remove-double-neg41.6%
associate-/r*43.9%
unpow1/243.9%
associate-/r*41.6%
rem-exp-log39.4%
exp-neg39.4%
exp-prod39.6%
distribute-lft-neg-out39.6%
exp-neg39.6%
exp-to-pow41.9%
unpow1/241.9%
Simplified41.9%
if -4e-174 < d Initial program 66.9%
Simplified65.7%
associate-*r/66.4%
frac-times67.5%
associate-/l*66.4%
*-commutative66.4%
Applied egg-rr66.4%
*-commutative66.4%
associate-/l*67.0%
associate-*r/68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in d around inf 37.5%
associate-/r*38.2%
unpow1/238.2%
associate-/r*37.5%
rem-exp-log36.0%
exp-neg36.0%
exp-prod36.6%
distribute-lft-neg-out36.6%
exp-neg36.6%
exp-to-pow38.0%
unpow1/238.0%
unpow-138.0%
unpow-138.0%
associate-/l*38.1%
*-rgt-identity38.1%
Simplified38.1%
Final simplification39.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 (/ d (sqrt (* 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) {
return d / sqrt((h * l));
}
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((h * l))
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((h * l));
}
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((h * l))
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(h * l))) 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((h * l));
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[(h * 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])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 70.9%
Simplified69.7%
associate-*r/70.2%
frac-times71.4%
associate-/l*70.2%
*-commutative70.2%
Applied egg-rr70.2%
*-commutative70.2%
associate-/l*70.7%
associate-*r/71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in d around inf 28.0%
associate-/r*28.5%
unpow1/228.5%
associate-/r*28.0%
rem-exp-log27.0%
exp-neg27.0%
exp-prod27.4%
distribute-lft-neg-out27.4%
exp-neg27.4%
exp-to-pow28.4%
unpow1/228.4%
unpow-128.4%
unpow-128.4%
associate-/l*28.4%
*-rgt-identity28.4%
Simplified28.4%
herbie shell --seed 2024101
(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)))))