
(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 21 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 (pow (* D_m (/ M_m d)) 2.0)))
(if (<= d -3.8e-189)
(*
(/ (sqrt (- d)) (sqrt (- h)))
(* (sqrt (/ d l)) (+ (* -0.125 (* h (/ t_0 l))) 1.0)))
(if (<= d 2.95e-270)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(fma -0.5 (* h (/ (/ t_0 4.0) l)) 1.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 = pow((D_m * (M_m / d)), 2.0);
double tmp;
if (d <= -3.8e-189) {
tmp = (sqrt(-d) / sqrt(-h)) * (sqrt((d / l)) * ((-0.125 * (h * (t_0 / l))) + 1.0));
} else if (d <= 2.95e-270) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * fma(-0.5, (h * ((t_0 / 4.0) / l)), 1.0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -3.8e-189) tmp = Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * Float64(Float64(-0.125 * Float64(h * Float64(t_0 / l))) + 1.0))); elseif (d <= 2.95e-270) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * fma(-0.5, Float64(h * Float64(Float64(t_0 / 4.0) / l)), 1.0)); 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -3.8e-189], N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(-0.125 * N[(h * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.95e-270], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h * N[(N[(t$95$0 / 4.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $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(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(h \cdot \frac{t\_0}{\ell}\right) + 1\right)\right)\\
\mathbf{elif}\;d \leq 2.95 \cdot 10^{-270}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{\frac{t\_0}{4}}{\ell}, 1\right)\\
\end{array}
\end{array}
if d < -3.80000000000000022e-189Initial program 75.0%
Simplified74.3%
fma-undefine74.3%
unpow-prod-down74.3%
metadata-eval74.3%
Applied egg-rr74.3%
frac-2neg74.3%
sqrt-div80.4%
Applied egg-rr80.4%
Taylor expanded in M around 0 51.1%
*-commutative51.1%
times-frac50.3%
*-commutative50.3%
associate-/l*51.5%
associate-*l*53.4%
*-commutative53.4%
times-frac52.7%
associate-/r*54.6%
associate-/l*54.6%
unpow254.6%
unpow254.6%
unpow254.6%
times-frac66.9%
swap-sqr84.7%
unpow284.7%
Simplified84.7%
if -3.80000000000000022e-189 < d < 2.95e-270Initial program 22.7%
Simplified22.2%
add-sqr-sqrt22.3%
pow222.3%
sqrt-prod22.2%
sqrt-pow122.7%
metadata-eval22.7%
frac-times25.1%
associate-/l*22.7%
pow122.7%
*-commutative22.7%
Applied egg-rr22.7%
associate-*r/25.1%
*-commutative25.1%
associate-*r/20.7%
associate-*l*20.8%
Simplified20.8%
Taylor expanded in h around 0 22.7%
associate-*r*22.7%
fma-define22.7%
unpow222.7%
unpow222.7%
swap-sqr31.7%
unpow231.7%
cube-div53.3%
Simplified53.3%
Taylor expanded in D around inf 31.4%
associate-*l/31.5%
associate-/l*31.5%
unpow231.5%
unpow231.5%
swap-sqr40.7%
unpow240.7%
cube-div62.2%
metadata-eval62.2%
pow-sqr62.2%
rem-sqrt-square83.0%
metadata-eval83.0%
pow-sqr83.1%
fabs-sqr83.1%
pow-sqr83.0%
metadata-eval83.0%
Simplified83.0%
if 2.95e-270 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
+-commutative84.3%
fma-define84.3%
associate-*l/89.0%
associate-/l*90.7%
associate-*r/91.4%
*-commutative91.4%
associate-/l*92.3%
Simplified92.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.65e-158)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(* h (- (fma (/ (pow (/ (* D_m M_m) d) 2.0) l) 0.125 (/ -1.0 h))))))
(if (<= d 1.26e-272)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(fma -0.5 (* h (/ (/ (pow (* D_m (/ M_m d)) 2.0) 4.0) l)) 1.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 tmp;
if (d <= -1.65e-158) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (h * -fma((pow(((D_m * M_m) / d), 2.0) / l), 0.125, (-1.0 / h))));
} else if (d <= 1.26e-272) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * fma(-0.5, (h * ((pow((D_m * (M_m / d)), 2.0) / 4.0) / l)), 1.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) tmp = 0.0 if (d <= -1.65e-158) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(h * Float64(-fma(Float64((Float64(Float64(D_m * M_m) / d) ^ 2.0) / l), 0.125, Float64(-1.0 / h)))))); elseif (d <= 1.26e-272) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * fma(-0.5, Float64(h * Float64(Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / 4.0) / l)), 1.0)); 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[d, -1.65e-158], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * (-N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.26e-272], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h * N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 4.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.65 \cdot 10^{-158}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-\mathsf{fma}\left(\frac{{\left(\frac{D\_m \cdot M\_m}{d}\right)}^{2}}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.26 \cdot 10^{-272}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{\frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{4}}{\ell}, 1\right)\\
\end{array}
\end{array}
if d < -1.6500000000000001e-158Initial program 77.9%
Simplified77.1%
Taylor expanded in h around -inf 49.7%
mul-1-neg49.7%
distribute-rgt-neg-in49.7%
*-commutative49.7%
fma-neg49.7%
Simplified80.9%
Taylor expanded in D around 0 81.7%
if -1.6500000000000001e-158 < d < 1.25999999999999995e-272Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 1.25999999999999995e-272 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
+-commutative84.3%
fma-define84.3%
associate-*l/89.0%
associate-/l*90.7%
associate-*r/91.4%
*-commutative91.4%
associate-/l*92.3%
Simplified92.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 (* D_m (/ M_m d)) 2.0)))
(if (<= d -1.68e-161)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (* h (- (fma (/ t_0 l) 0.125 (/ -1.0 h))))))
(if (<= d 5.4e-272)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(fma -0.5 (* h (/ (/ t_0 4.0) l)) 1.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 = pow((D_m * (M_m / d)), 2.0);
double tmp;
if (d <= -1.68e-161) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (h * -fma((t_0 / l), 0.125, (-1.0 / h))));
} else if (d <= 5.4e-272) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * fma(-0.5, (h * ((t_0 / 4.0) / l)), 1.0);
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -1.68e-161) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(h * Float64(-fma(Float64(t_0 / l), 0.125, Float64(-1.0 / h)))))); elseif (d <= 5.4e-272) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * fma(-0.5, Float64(h * Float64(Float64(t_0 / 4.0) / l)), 1.0)); 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -1.68e-161], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(h * (-N[(N[(t$95$0 / l), $MachinePrecision] * 0.125 + N[(-1.0 / h), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.4e-272], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h * N[(N[(t$95$0 / 4.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $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(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -1.68 \cdot 10^{-161}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(h \cdot \left(-\mathsf{fma}\left(\frac{t\_0}{\ell}, 0.125, \frac{-1}{h}\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 5.4 \cdot 10^{-272}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{\frac{t\_0}{4}}{\ell}, 1\right)\\
\end{array}
\end{array}
if d < -1.68e-161Initial program 77.9%
Simplified77.1%
Taylor expanded in h around -inf 49.7%
mul-1-neg49.7%
distribute-rgt-neg-in49.7%
*-commutative49.7%
fma-neg49.7%
Simplified80.9%
if -1.68e-161 < d < 5.39999999999999985e-272Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 5.39999999999999985e-272 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
+-commutative84.3%
fma-define84.3%
associate-*l/89.0%
associate-/l*90.7%
associate-*r/91.4%
*-commutative91.4%
associate-/l*92.3%
Simplified92.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.9e-168)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0))) l))))
(if (<= d 5.5e-272)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(fma -0.5 (* h (/ (/ (pow (* D_m (/ M_m d)) 2.0) 4.0) l)) 1.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 tmp;
if (d <= -1.9e-168) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0))) / l)));
} else if (d <= 5.5e-272) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * fma(-0.5, (h * ((pow((D_m * (M_m / d)), 2.0) / 4.0) / l)), 1.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) tmp = 0.0 if (d <= -1.9e-168) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); elseif (d <= 5.5e-272) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * fma(-0.5, Float64(h * Float64(Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / 4.0) / l)), 1.0)); 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[d, -1.9e-168], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.5e-272], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-0.5 * N[(h * N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 4.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + 1.0), $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.9 \cdot 10^{-168}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 5.5 \cdot 10^{-272}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \mathsf{fma}\left(-0.5, h \cdot \frac{\frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{4}}{\ell}, 1\right)\\
\end{array}
\end{array}
if d < -1.9e-168Initial program 77.9%
Simplified77.1%
associate-*l/80.1%
*-commutative80.1%
add-sqr-sqrt80.1%
pow280.1%
sqrt-pow180.1%
metadata-eval80.1%
pow180.1%
associate-/l/80.1%
Applied egg-rr80.1%
if -1.9e-168 < d < 5.4999999999999999e-272Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 5.4999999999999999e-272 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
+-commutative84.3%
fma-define84.3%
associate-*l/89.0%
associate-/l*90.7%
associate-*r/91.4%
*-commutative91.4%
associate-/l*92.3%
Simplified92.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (/ h l))))))))
(if (<= d -7.2e-165)
t_0
(if (<= d 9.5e-146)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(if (<= d 2.6e+90) t_0 (* d (/ (pow h -0.5) (sqrt l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (-0.125 * (pow((D_m * (M_m / d)), 2.0) * (h / l)))));
double tmp;
if (d <= -7.2e-165) {
tmp = t_0;
} else if (d <= 9.5e-146) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else if (d <= 2.6e+90) {
tmp = t_0;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (h / l)))))
if (d <= (-7.2d-165)) then
tmp = t_0
else if (d <= 9.5d-146) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else if (d <= 2.6d+90) then
tmp = t_0
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (-0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (h / l)))));
double tmp;
if (d <= -7.2e-165) {
tmp = t_0;
} else if (d <= 9.5e-146) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else if (d <= 2.6e+90) {
tmp = t_0;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (-0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (h / l))))) tmp = 0 if d <= -7.2e-165: tmp = t_0 elif d <= 9.5e-146: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h elif d <= 2.6e+90: tmp = t_0 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(h / l)))))) tmp = 0.0 if (d <= -7.2e-165) tmp = t_0; elseif (d <= 9.5e-146) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); elseif (d <= 2.6e+90) tmp = t_0; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (-0.125 * (((D_m * (M_m / d)) ^ 2.0) * (h / l)))));
tmp = 0.0;
if (d <= -7.2e-165)
tmp = t_0;
elseif (d <= 9.5e-146)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
elseif (d <= 2.6e+90)
tmp = t_0;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.2e-165], t$95$0, If[LessEqual[d, 9.5e-146], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 2.6e+90], t$95$0, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + -0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{if}\;d \leq -7.2 \cdot 10^{-165}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 9.5 \cdot 10^{-146}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -7.19999999999999969e-165 or 9.5000000000000005e-146 < d < 2.5999999999999998e90Initial program 81.2%
Simplified80.1%
fma-undefine80.1%
unpow-prod-down80.1%
metadata-eval80.1%
Applied egg-rr80.1%
Taylor expanded in M around 0 52.8%
associate-/l*52.8%
*-commutative52.8%
*-commutative52.8%
*-commutative52.8%
times-frac54.3%
associate-*l*54.3%
*-commutative54.3%
unpow254.3%
unpow254.3%
unpow254.3%
times-frac62.7%
swap-sqr80.7%
unpow280.7%
Simplified80.7%
if -7.19999999999999969e-165 < d < 9.5000000000000005e-146Initial program 35.6%
Simplified35.3%
add-sqr-sqrt35.3%
pow235.3%
sqrt-prod35.3%
sqrt-pow135.5%
metadata-eval35.5%
frac-times38.1%
associate-/l*35.5%
pow135.5%
*-commutative35.5%
Applied egg-rr35.5%
associate-*r/38.1%
*-commutative38.1%
associate-*r/36.4%
associate-*l*36.4%
Simplified36.4%
Taylor expanded in h around 0 23.4%
associate-*r*23.4%
fma-define23.4%
unpow223.4%
unpow223.4%
swap-sqr28.9%
unpow228.9%
cube-div49.2%
Simplified49.2%
Taylor expanded in D around inf 28.7%
associate-*l/28.7%
associate-/l*28.7%
unpow228.7%
unpow228.7%
swap-sqr36.0%
unpow236.0%
cube-div58.0%
metadata-eval58.0%
pow-sqr58.0%
rem-sqrt-square72.6%
metadata-eval72.6%
pow-sqr72.6%
fabs-sqr72.6%
pow-sqr72.6%
metadata-eval72.6%
Simplified72.6%
if 2.5999999999999998e90 < d Initial program 68.1%
Simplified70.3%
Taylor expanded in d around inf 78.7%
associate-/r*80.8%
Simplified80.8%
*-un-lft-identity80.8%
sqrt-div87.8%
inv-pow87.8%
sqrt-pow187.7%
metadata-eval87.7%
Applied egg-rr87.7%
*-lft-identity87.7%
Simplified87.7%
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
(let* ((t_0 (pow (* D_m M_m) 2.0))
(t_1 (pow (/ h l) 1.5))
(t_2
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))))
(if (<= d -1.66e-158)
t_2
(if (<= d 2.05e-168)
(/ (* -0.125 (* t_0 (/ t_1 d))) h)
(if (<= d 1.95e+23)
(/ (+ (* t_1 (/ -0.125 (/ d t_0))) (* d (sqrt (/ h l)))) h)
(if (<= d 6.6e+87) t_2 (* d (/ (pow h -0.5) (sqrt l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * M_m), 2.0);
double t_1 = pow((h / l), 1.5);
double t_2 = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (d <= -1.66e-158) {
tmp = t_2;
} else if (d <= 2.05e-168) {
tmp = (-0.125 * (t_0 * (t_1 / d))) / h;
} else if (d <= 1.95e+23) {
tmp = ((t_1 * (-0.125 / (d / t_0))) + (d * sqrt((h / l)))) / h;
} else if (d <= 6.6e+87) {
tmp = t_2;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (d_m * m_m) ** 2.0d0
t_1 = (h / l) ** 1.5d0
t_2 = sqrt(((d / l) * (d / h))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0))))
if (d <= (-1.66d-158)) then
tmp = t_2
else if (d <= 2.05d-168) then
tmp = ((-0.125d0) * (t_0 * (t_1 / d))) / h
else if (d <= 1.95d+23) then
tmp = ((t_1 * ((-0.125d0) / (d / t_0))) + (d * sqrt((h / l)))) / h
else if (d <= 6.6d+87) then
tmp = t_2
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.pow((D_m * M_m), 2.0);
double t_1 = Math.pow((h / l), 1.5);
double t_2 = Math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (d <= -1.66e-158) {
tmp = t_2;
} else if (d <= 2.05e-168) {
tmp = (-0.125 * (t_0 * (t_1 / d))) / h;
} else if (d <= 1.95e+23) {
tmp = ((t_1 * (-0.125 / (d / t_0))) + (d * Math.sqrt((h / l)))) / h;
} else if (d <= 6.6e+87) {
tmp = t_2;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.pow((D_m * M_m), 2.0) t_1 = math.pow((h / l), 1.5) t_2 = math.sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0)))) tmp = 0 if d <= -1.66e-158: tmp = t_2 elif d <= 2.05e-168: tmp = (-0.125 * (t_0 * (t_1 / d))) / h elif d <= 1.95e+23: tmp = ((t_1 * (-0.125 / (d / t_0))) + (d * math.sqrt((h / l)))) / h elif d <= 6.6e+87: tmp = t_2 else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * M_m) ^ 2.0 t_1 = Float64(h / l) ^ 1.5 t_2 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (d <= -1.66e-158) tmp = t_2; elseif (d <= 2.05e-168) tmp = Float64(Float64(-0.125 * Float64(t_0 * Float64(t_1 / d))) / h); elseif (d <= 1.95e+23) tmp = Float64(Float64(Float64(t_1 * Float64(-0.125 / Float64(d / t_0))) + Float64(d * sqrt(Float64(h / l)))) / h); elseif (d <= 6.6e+87) tmp = t_2; else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m * M_m) ^ 2.0;
t_1 = (h / l) ^ 1.5;
t_2 = sqrt(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (d <= -1.66e-158)
tmp = t_2;
elseif (d <= 2.05e-168)
tmp = (-0.125 * (t_0 * (t_1 / d))) / h;
elseif (d <= 1.95e+23)
tmp = ((t_1 * (-0.125 / (d / t_0))) + (d * sqrt((h / l)))) / h;
elseif (d <= 6.6e+87)
tmp = t_2;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.66e-158], t$95$2, If[LessEqual[d, 2.05e-168], N[(N[(-0.125 * N[(t$95$0 * N[(t$95$1 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.95e+23], N[(N[(N[(t$95$1 * N[(-0.125 / N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 6.6e+87], t$95$2, N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D\_m \cdot M\_m\right)}^{2}\\
t_1 := {\left(\frac{h}{\ell}\right)}^{1.5}\\
t_2 := \sqrt{\frac{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{-158}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{-168}:\\
\;\;\;\;\frac{-0.125 \cdot \left(t\_0 \cdot \frac{t\_1}{d}\right)}{h}\\
\mathbf{elif}\;d \leq 1.95 \cdot 10^{+23}:\\
\;\;\;\;\frac{t\_1 \cdot \frac{-0.125}{\frac{d}{t\_0}} + d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{+87}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.66000000000000009e-158 or 1.95e23 < d < 6.6000000000000003e87Initial program 80.0%
Simplified79.3%
add-sqr-sqrt79.3%
pow279.3%
sqrt-prod79.2%
sqrt-pow179.3%
metadata-eval79.3%
frac-times80.1%
associate-/l*79.3%
pow179.3%
*-commutative79.3%
Applied egg-rr79.3%
associate-*r/80.1%
*-commutative80.1%
associate-*r/79.3%
associate-*l*78.6%
Simplified78.6%
pow178.6%
sqrt-unprod64.3%
cancel-sign-sub-inv64.3%
metadata-eval64.3%
associate-*r*65.0%
unpow-prod-down65.0%
pow265.0%
add-sqr-sqrt65.0%
Applied egg-rr65.0%
unpow165.0%
associate-*r*65.0%
associate-*r/65.7%
*-commutative65.7%
Simplified65.7%
if -1.66000000000000009e-158 < d < 2.0499999999999999e-168Initial program 37.5%
Simplified37.2%
add-sqr-sqrt37.2%
pow237.2%
sqrt-prod37.2%
sqrt-pow137.4%
metadata-eval37.4%
frac-times40.2%
associate-/l*37.4%
pow137.4%
*-commutative37.4%
Applied egg-rr37.4%
associate-*r/40.2%
*-commutative40.2%
associate-*r/38.4%
associate-*l*38.4%
Simplified38.4%
Taylor expanded in h around 0 24.7%
associate-*r*24.7%
fma-define24.7%
unpow224.7%
unpow224.7%
swap-sqr30.4%
unpow230.4%
cube-div51.7%
Simplified51.7%
Taylor expanded in D around inf 30.2%
associate-*l/30.2%
associate-/l*30.3%
unpow230.3%
unpow230.3%
swap-sqr37.8%
unpow237.8%
cube-div61.0%
metadata-eval61.0%
pow-sqr61.0%
rem-sqrt-square74.6%
metadata-eval74.6%
pow-sqr74.6%
fabs-sqr74.6%
pow-sqr74.6%
metadata-eval74.6%
Simplified74.6%
if 2.0499999999999999e-168 < d < 1.95e23Initial program 78.5%
Simplified75.7%
add-sqr-sqrt75.8%
pow275.8%
sqrt-prod75.7%
sqrt-pow175.7%
metadata-eval75.7%
frac-times78.5%
associate-/l*75.7%
pow175.7%
*-commutative75.7%
Applied egg-rr75.7%
associate-*r/78.5%
*-commutative78.5%
associate-*r/78.5%
associate-*l*78.6%
Simplified78.6%
Taylor expanded in h around 0 27.4%
associate-*r*27.4%
fma-define27.4%
unpow227.4%
unpow227.4%
swap-sqr30.9%
unpow230.9%
cube-div64.1%
Simplified64.1%
fma-undefine64.1%
clear-num64.1%
un-div-inv64.1%
sqrt-pow175.8%
metadata-eval75.8%
Applied egg-rr75.8%
if 6.6000000000000003e87 < d Initial program 68.1%
Simplified70.3%
Taylor expanded in d around inf 78.7%
associate-/r*80.8%
Simplified80.8%
*-un-lft-identity80.8%
sqrt-div87.8%
inv-pow87.8%
sqrt-pow187.7%
metadata-eval87.7%
Applied egg-rr87.7%
*-lft-identity87.7%
Simplified87.7%
Final simplification72.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 (<= d -5.4e-163)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* h (* -0.5 (pow (* D_m (/ M_m (* d 2.0))) 2.0))) l))))
(if (<= d 1.6e-269)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (/ (pow (* D_m (/ M_m d)) 2.0) 4.0) (* (/ h l) -0.5)))))))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 <= -5.4e-163) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * pow((D_m * (M_m / (d * 2.0))), 2.0))) / l)));
} else if (d <= 1.6e-269) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5)));
}
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 <= (-5.4d-163)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h * ((-0.5d0) * ((d_m * (m_m / (d * 2.0d0))) ** 2.0d0))) / l)))
else if (d <= 1.6d-269) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + ((((d_m * (m_m / d)) ** 2.0d0) / 4.0d0) * ((h / l) * (-0.5d0))))
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 <= -5.4e-163) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * Math.pow((D_m * (M_m / (d * 2.0))), 2.0))) / l)));
} else if (d <= 1.6e-269) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((Math.pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5)));
}
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 <= -5.4e-163: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h * (-0.5 * math.pow((D_m * (M_m / (d * 2.0))), 2.0))) / l))) elif d <= 1.6e-269: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((math.pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5))) 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 <= -5.4e-163) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h * Float64(-0.5 * (Float64(D_m * Float64(M_m / Float64(d * 2.0))) ^ 2.0))) / l)))); elseif (d <= 1.6e-269) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / 4.0) * Float64(Float64(h / l) * -0.5)))); 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 <= -5.4e-163)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h * (-0.5 * ((D_m * (M_m / (d * 2.0))) ^ 2.0))) / l)));
elseif (d <= 1.6e-269)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((((D_m * (M_m / d)) ^ 2.0) / 4.0) * ((h / l) * -0.5)));
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, -5.4e-163], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h * N[(-0.5 * N[Power[N[(D$95$m * N[(M$95$m / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.6e-269], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 4.0), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $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 -5.4 \cdot 10^{-163}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{M\_m}{d \cdot 2}\right)}^{2}\right)}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{-269}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{4} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if d < -5.40000000000000029e-163Initial program 77.9%
Simplified77.1%
associate-*l/80.1%
*-commutative80.1%
add-sqr-sqrt80.1%
pow280.1%
sqrt-pow180.1%
metadata-eval80.1%
pow180.1%
associate-/l/80.1%
Applied egg-rr80.1%
if -5.40000000000000029e-163 < d < 1.6000000000000001e-269Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 1.6000000000000001e-269 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
associate-*r*84.3%
*-commutative84.3%
associate-*r/85.0%
*-commutative85.0%
associate-/l*85.9%
Simplified85.9%
Final simplification82.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 (<= d -4.1e-160)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* h (* (pow (* (/ D_m d) (/ M_m 2.0)) 2.0) (/ -0.5 l))))))
(if (<= d 1.65e-269)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (/ (pow (* D_m (/ M_m d)) 2.0) 4.0) (* (/ h l) -0.5)))))))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 <= -4.1e-160) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * (pow(((D_m / d) * (M_m / 2.0)), 2.0) * (-0.5 / l)))));
} else if (d <= 1.65e-269) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5)));
}
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 <= (-4.1d-160)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + (h * ((((d_m / d) * (m_m / 2.0d0)) ** 2.0d0) * ((-0.5d0) / l)))))
else if (d <= 1.65d-269) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + ((((d_m * (m_m / d)) ** 2.0d0) / 4.0d0) * ((h / l) * (-0.5d0))))
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 <= -4.1e-160) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + (h * (Math.pow(((D_m / d) * (M_m / 2.0)), 2.0) * (-0.5 / l)))));
} else if (d <= 1.65e-269) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((Math.pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5)));
}
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 <= -4.1e-160: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + (h * (math.pow(((D_m / d) * (M_m / 2.0)), 2.0) * (-0.5 / l))))) elif d <= 1.65e-269: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((math.pow((D_m * (M_m / d)), 2.0) / 4.0) * ((h / l) * -0.5))) 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 <= -4.1e-160) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(h * Float64((Float64(Float64(D_m / d) * Float64(M_m / 2.0)) ^ 2.0) * Float64(-0.5 / l)))))); elseif (d <= 1.65e-269) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / 4.0) * Float64(Float64(h / l) * -0.5)))); 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 <= -4.1e-160)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + (h * ((((D_m / d) * (M_m / 2.0)) ^ 2.0) * (-0.5 / l)))));
elseif (d <= 1.65e-269)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((((D_m * (M_m / d)) ^ 2.0) / 4.0) * ((h / l) * -0.5)));
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, -4.1e-160], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(h * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(M$95$m / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-0.5 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.65e-269], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / 4.0), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $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 -4.1 \cdot 10^{-160}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + h \cdot \left({\left(\frac{D\_m}{d} \cdot \frac{M\_m}{2}\right)}^{2} \cdot \frac{-0.5}{\ell}\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.65 \cdot 10^{-269}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{4} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if d < -4.10000000000000002e-160Initial program 77.9%
Simplified77.1%
associate-*l/80.1%
*-commutative80.1%
add-sqr-sqrt80.1%
pow280.1%
sqrt-pow180.1%
metadata-eval80.1%
pow180.1%
associate-/l/80.1%
Applied egg-rr80.1%
associate-/l*80.9%
*-un-lft-identity80.9%
times-frac80.9%
metadata-eval80.9%
associate-*r/81.7%
times-frac80.9%
Applied egg-rr80.9%
associate-*r/80.9%
*-commutative80.9%
associate-/l*80.9%
Simplified80.9%
if -4.10000000000000002e-160 < d < 1.65e-269Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 1.65e-269 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
associate-*r*84.3%
*-commutative84.3%
associate-*r/85.0%
*-commutative85.0%
associate-/l*85.9%
Simplified85.9%
Final simplification82.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 (pow (* D_m (/ M_m d)) 2.0)))
(if (<= d -9e-159)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (+ 1.0 (* -0.125 (* t_0 (/ h l))))))
(if (<= d 1.8e-270)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* (/ t_0 4.0) (* (/ h l) -0.5))))))))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_m / d)), 2.0);
double tmp;
if (d <= -9e-159) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (-0.125 * (t_0 * (h / l)))));
} else if (d <= 1.8e-270) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((t_0 / 4.0) * ((h / l) * -0.5)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = (d_m * (m_m / d)) ** 2.0d0
if (d <= (-9d-159)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((-0.125d0) * (t_0 * (h / l)))))
else if (d <= 1.8d-270) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0d0 + ((t_0 / 4.0d0) * ((h / l) * (-0.5d0))))
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((D_m * (M_m / d)), 2.0);
double tmp;
if (d <= -9e-159) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + (-0.125 * (t_0 * (h / l)))));
} else if (d <= 1.8e-270) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = (d / (Math.sqrt(l) * Math.sqrt(h))) * (1.0 + ((t_0 / 4.0) * ((h / l) * -0.5)));
}
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((D_m * (M_m / d)), 2.0) tmp = 0 if d <= -9e-159: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + (-0.125 * (t_0 * (h / l))))) elif d <= 1.8e-270: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = (d / (math.sqrt(l) * math.sqrt(h))) * (1.0 + ((t_0 / 4.0) * ((h / l) * -0.5))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -9e-159) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(-0.125 * Float64(t_0 * Float64(h / l)))))); elseif (d <= 1.8e-270) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(Float64(t_0 / 4.0) * Float64(Float64(h / l) * -0.5)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (D_m * (M_m / d)) ^ 2.0;
tmp = 0.0;
if (d <= -9e-159)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + (-0.125 * (t_0 * (h / l)))));
elseif (d <= 1.8e-270)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + ((t_0 / 4.0) * ((h / l) * -0.5)));
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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -9e-159], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(-0.125 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-270], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(t$95$0 / 4.0), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $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(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -9 \cdot 10^{-159}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + -0.125 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-270}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + \frac{t\_0}{4} \cdot \left(\frac{h}{\ell} \cdot -0.5\right)\right)\\
\end{array}
\end{array}
if d < -8.99999999999999977e-159Initial program 77.9%
Simplified77.1%
fma-undefine77.1%
unpow-prod-down77.1%
metadata-eval77.1%
Applied egg-rr77.1%
Taylor expanded in M around 0 48.8%
associate-/l*48.8%
*-commutative48.8%
*-commutative48.8%
*-commutative48.8%
times-frac48.7%
associate-*l*48.7%
*-commutative48.7%
unpow248.7%
unpow248.7%
unpow248.7%
times-frac60.3%
swap-sqr77.2%
unpow277.2%
Simplified77.2%
if -8.99999999999999977e-159 < d < 1.7999999999999999e-270Initial program 28.5%
Simplified28.2%
add-sqr-sqrt28.3%
pow228.3%
sqrt-prod28.2%
sqrt-pow128.5%
metadata-eval28.5%
frac-times33.0%
associate-/l*28.5%
pow128.5%
*-commutative28.5%
Applied egg-rr28.5%
associate-*r/33.0%
*-commutative33.0%
associate-*r/29.9%
associate-*l*29.9%
Simplified29.9%
Taylor expanded in h around 0 19.1%
associate-*r*19.1%
fma-define19.1%
unpow219.1%
unpow219.1%
swap-sqr25.4%
unpow225.4%
cube-div52.5%
Simplified52.5%
Taylor expanded in D around inf 28.2%
associate-*l/28.2%
associate-/l*28.2%
unpow228.2%
unpow228.2%
swap-sqr34.7%
unpow234.7%
cube-div61.7%
metadata-eval61.7%
pow-sqr61.7%
rem-sqrt-square79.2%
metadata-eval79.2%
pow-sqr79.3%
fabs-sqr79.3%
pow-sqr79.2%
metadata-eval79.2%
Simplified79.2%
if 1.7999999999999999e-270 < d Initial program 70.9%
Simplified70.9%
Applied egg-rr84.3%
unpow184.3%
associate-*r*84.3%
*-commutative84.3%
associate-*r/85.0%
*-commutative85.0%
associate-/l*85.9%
Simplified85.9%
Final simplification81.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(sqrt (* (/ d l) (/ d h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* D_m M_m) (* d 2.0)) 2.0)))))))
(if (<= d -1.75e-164)
t_0
(if (<= d 3.8e-164)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(if (or (<= d 6e+16) (not (<= d 1e+92)))
(* d (/ (pow h -0.5) (sqrt l)))
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(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * pow(((D_m * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (d <= -1.75e-164) {
tmp = t_0;
} else if (d <= 3.8e-164) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else if ((d <= 6e+16) || !(d <= 1e+92)) {
tmp = d * (pow(h, -0.5) / sqrt(l));
} else {
tmp = 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(((d / l) * (d / h))) * (1.0d0 + ((h / l) * ((-0.5d0) * (((d_m * m_m) / (d * 2.0d0)) ** 2.0d0))))
if (d <= (-1.75d-164)) then
tmp = t_0
else if (d <= 3.8d-164) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else if ((d <= 6d+16) .or. (.not. (d <= 1d+92))) then
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
else
tmp = 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(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * Math.pow(((D_m * M_m) / (d * 2.0)), 2.0))));
double tmp;
if (d <= -1.75e-164) {
tmp = t_0;
} else if (d <= 3.8e-164) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else if ((d <= 6e+16) || !(d <= 1e+92)) {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
} else {
tmp = 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(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * math.pow(((D_m * M_m) / (d * 2.0)), 2.0)))) tmp = 0 if d <= -1.75e-164: tmp = t_0 elif d <= 3.8e-164: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h elif (d <= 6e+16) or not (d <= 1e+92): tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) else: tmp = 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 = Float64(sqrt(Float64(Float64(d / l) * Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0))))) tmp = 0.0 if (d <= -1.75e-164) tmp = t_0; elseif (d <= 3.8e-164) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); elseif ((d <= 6e+16) || !(d <= 1e+92)) tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); else tmp = 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(((d / l) * (d / h))) * (1.0 + ((h / l) * (-0.5 * (((D_m * M_m) / (d * 2.0)) ^ 2.0))));
tmp = 0.0;
if (d <= -1.75e-164)
tmp = t_0;
elseif (d <= 3.8e-164)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
elseif ((d <= 6e+16) || ~((d <= 1e+92)))
tmp = d * ((h ^ -0.5) / sqrt(l));
else
tmp = 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[(N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.75e-164], t$95$0, If[LessEqual[d, 3.8e-164], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[Or[LessEqual[d, 6e+16], N[Not[LessEqual[d, 1e+92]], $MachinePrecision]], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\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{d}{\ell} \cdot \frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}\right)\right)\\
\mathbf{if}\;d \leq -1.75 \cdot 10^{-164}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 3.8 \cdot 10^{-164}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{elif}\;d \leq 6 \cdot 10^{+16} \lor \neg \left(d \leq 10^{+92}\right):\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d < -1.75e-164 or 6e16 < d < 1e92Initial program 80.3%
Simplified79.6%
add-sqr-sqrt79.6%
pow279.6%
sqrt-prod79.5%
sqrt-pow179.7%
metadata-eval79.7%
frac-times80.4%
associate-/l*79.7%
pow179.7%
*-commutative79.7%
Applied egg-rr79.7%
associate-*r/80.4%
*-commutative80.4%
associate-*r/79.6%
associate-*l*78.9%
Simplified78.9%
pow178.9%
sqrt-unprod64.1%
cancel-sign-sub-inv64.1%
metadata-eval64.1%
associate-*r*64.8%
unpow-prod-down64.7%
pow264.7%
add-sqr-sqrt64.8%
Applied egg-rr64.8%
unpow164.8%
associate-*r*64.8%
associate-*r/65.4%
*-commutative65.4%
Simplified65.4%
if -1.75e-164 < d < 3.79999999999999989e-164Initial program 36.9%
Simplified36.5%
add-sqr-sqrt36.5%
pow236.5%
sqrt-prod36.5%
sqrt-pow136.7%
metadata-eval36.7%
frac-times39.5%
associate-/l*36.7%
pow136.7%
*-commutative36.7%
Applied egg-rr36.7%
associate-*r/39.5%
*-commutative39.5%
associate-*r/37.7%
associate-*l*37.7%
Simplified37.7%
Taylor expanded in h around 0 24.3%
associate-*r*24.3%
fma-define24.3%
unpow224.3%
unpow224.3%
swap-sqr29.8%
unpow229.8%
cube-div50.8%
Simplified50.8%
Taylor expanded in D around inf 29.7%
associate-*l/29.7%
associate-/l*29.7%
unpow229.7%
unpow229.7%
swap-sqr37.2%
unpow237.2%
cube-div59.9%
metadata-eval59.9%
pow-sqr59.9%
rem-sqrt-square75.0%
metadata-eval75.0%
pow-sqr75.0%
fabs-sqr75.0%
pow-sqr75.0%
metadata-eval75.0%
Simplified75.0%
if 3.79999999999999989e-164 < d < 6e16 or 1e92 < d Initial program 73.0%
Simplified73.0%
Taylor expanded in d around inf 62.1%
associate-/r*63.4%
Simplified63.4%
*-un-lft-identity63.4%
sqrt-div77.6%
inv-pow77.6%
sqrt-pow177.6%
metadata-eval77.6%
Applied egg-rr77.6%
*-lft-identity77.6%
Simplified77.6%
Final simplification71.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -4.65e+126)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -1.3e-39)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d 6.2e-163)
(/ (* -0.125 (* (pow (* D_m M_m) 2.0) (/ (pow (/ h l) 1.5) d))) h)
(* d (/ (pow h -0.5) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.65e+126) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -1.3e-39) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= 6.2e-163) {
tmp = (-0.125 * (pow((D_m * M_m), 2.0) * (pow((h / l), 1.5) / d))) / h;
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-4.65d+126)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= (-1.3d-39)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= 6.2d-163) then
tmp = ((-0.125d0) * (((d_m * m_m) ** 2.0d0) * (((h / l) ** 1.5d0) / d))) / h
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.65e+126) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= -1.3e-39) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= 6.2e-163) {
tmp = (-0.125 * (Math.pow((D_m * M_m), 2.0) * (Math.pow((h / l), 1.5) / d))) / h;
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -4.65e+126: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= -1.3e-39: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= 6.2e-163: tmp = (-0.125 * (math.pow((D_m * M_m), 2.0) * (math.pow((h / l), 1.5) / d))) / h else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -4.65e+126) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -1.3e-39) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= 6.2e-163) tmp = Float64(Float64(-0.125 * Float64((Float64(D_m * M_m) ^ 2.0) * Float64((Float64(h / l) ^ 1.5) / d))) / h); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -4.65e+126)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= -1.3e-39)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= 6.2e-163)
tmp = (-0.125 * (((D_m * M_m) ^ 2.0) * (((h / l) ^ 1.5) / d))) / h;
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -4.65e+126], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.3e-39], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.2e-163], N[(N[(-0.125 * N[(N[Power[N[(D$95$m * M$95$m), $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.65 \cdot 10^{+126}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -1.3 \cdot 10^{-39}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 6.2 \cdot 10^{-163}:\\
\;\;\;\;\frac{-0.125 \cdot \left({\left(D\_m \cdot M\_m\right)}^{2} \cdot \frac{{\left(\frac{h}{\ell}\right)}^{1.5}}{d}\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -4.64999999999999999e126Initial program 76.2%
Simplified78.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.2%
neg-mul-173.2%
Simplified73.2%
if -4.64999999999999999e126 < d < -1.3e-39Initial program 89.6%
Simplified89.6%
Taylor expanded in M around 0 58.5%
if -1.3e-39 < d < 6.19999999999999949e-163Initial program 47.6%
Simplified45.2%
add-sqr-sqrt45.3%
pow245.3%
sqrt-prod45.3%
sqrt-pow145.5%
metadata-eval45.5%
frac-times49.5%
associate-/l*45.5%
pow145.5%
*-commutative45.5%
Applied egg-rr45.5%
associate-*r/49.5%
*-commutative49.5%
associate-*r/47.2%
associate-*l*46.1%
Simplified46.1%
Taylor expanded in h around 0 19.0%
associate-*r*19.0%
fma-define19.0%
unpow219.0%
unpow219.0%
swap-sqr22.7%
unpow222.7%
cube-div45.0%
Simplified45.0%
Taylor expanded in D around inf 24.6%
associate-*l/24.7%
associate-/l*24.7%
unpow224.7%
unpow224.7%
swap-sqr29.7%
unpow229.7%
cube-div50.0%
metadata-eval50.0%
pow-sqr50.0%
rem-sqrt-square63.9%
metadata-eval63.9%
pow-sqr63.8%
fabs-sqr63.8%
pow-sqr63.9%
metadata-eval63.9%
Simplified63.9%
if 6.19999999999999949e-163 < d Initial program 77.2%
Simplified77.3%
Taylor expanded in d around inf 59.0%
associate-/r*60.1%
Simplified60.1%
*-un-lft-identity60.1%
sqrt-div72.0%
inv-pow72.0%
sqrt-pow172.0%
metadata-eval72.0%
Applied egg-rr72.0%
*-lft-identity72.0%
Simplified72.0%
Final simplification67.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -9.4e+125)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -2.45e-78)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= d 8.5e-306)
(* d (pow (pow (* h l) 2.0) -0.25))
(* d (/ (pow h -0.5) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -9.4e+125) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -2.45e-78) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (d <= 8.5e-306) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-9.4d+125)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= (-2.45d-78)) then
tmp = sqrt((d / l)) * sqrt((d / h))
else if (d <= 8.5d-306) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -9.4e+125) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= -2.45e-78) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (d <= 8.5e-306) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -9.4e+125: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= -2.45e-78: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif d <= 8.5e-306: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -9.4e+125) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -2.45e-78) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (d <= 8.5e-306) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -9.4e+125)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= -2.45e-78)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (d <= 8.5e-306)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -9.4e+125], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.45e-78], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.5e-306], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -9.4 \cdot 10^{+125}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2.45 \cdot 10^{-78}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-306}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -9.39999999999999944e125Initial program 76.2%
Simplified78.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
*-commutative0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt73.2%
neg-mul-173.2%
Simplified73.2%
if -9.39999999999999944e125 < d < -2.45000000000000015e-78Initial program 88.5%
Simplified88.6%
Taylor expanded in M around 0 53.5%
if -2.45000000000000015e-78 < d < 8.5000000000000002e-306Initial program 46.3%
Simplified42.6%
Taylor expanded in d around inf 15.9%
*-commutative15.9%
Simplified15.9%
add-log-exp26.4%
pow1/226.4%
inv-pow26.4%
pow-pow26.4%
metadata-eval26.4%
Applied egg-rr26.4%
rem-log-exp14.2%
sqr-pow14.2%
pow-prod-down21.4%
pow221.4%
*-commutative21.4%
metadata-eval21.4%
Applied egg-rr21.4%
if 8.5000000000000002e-306 < d Initial program 68.4%
Simplified68.4%
Taylor expanded in d around inf 50.2%
associate-/r*50.9%
Simplified50.9%
*-un-lft-identity50.9%
sqrt-div60.7%
inv-pow60.7%
sqrt-pow160.8%
metadata-eval60.8%
Applied egg-rr60.8%
*-lft-identity60.8%
Simplified60.8%
Final simplification53.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.85e+62)
(/ (- d) (sqrt (* h l)))
(if (<= d -8.4e-76)
(/ (* d (sqrt (/ h l))) h)
(if (<= d 8.5e-306)
(* d (pow (pow (* h l) 2.0) -0.25))
(* d (/ (pow h -0.5) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.85e+62) {
tmp = -d / sqrt((h * l));
} else if (d <= -8.4e-76) {
tmp = (d * sqrt((h / l))) / h;
} else if (d <= 8.5e-306) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.85d+62)) then
tmp = -d / sqrt((h * l))
else if (d <= (-8.4d-76)) then
tmp = (d * sqrt((h / l))) / h
else if (d <= 8.5d-306) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((h ** (-0.5d0)) / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.85e+62) {
tmp = -d / Math.sqrt((h * l));
} else if (d <= -8.4e-76) {
tmp = (d * Math.sqrt((h / l))) / h;
} else if (d <= 8.5e-306) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.85e+62: tmp = -d / math.sqrt((h * l)) elif d <= -8.4e-76: tmp = (d * math.sqrt((h / l))) / h elif d <= 8.5e-306: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d * (math.pow(h, -0.5) / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.85e+62) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); elseif (d <= -8.4e-76) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); elseif (d <= 8.5e-306) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.85e+62)
tmp = -d / sqrt((h * l));
elseif (d <= -8.4e-76)
tmp = (d * sqrt((h / l))) / h;
elseif (d <= 8.5e-306)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d * ((h ^ -0.5) / sqrt(l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.85e+62], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.4e-76], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 8.5e-306], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.85 \cdot 10^{+62}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -8.4 \cdot 10^{-76}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-306}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.85000000000000007e62Initial program 78.8%
Simplified80.7%
Taylor expanded in d around inf 5.4%
associate-/r*5.4%
Simplified5.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
mul-1-neg68.6%
*-commutative68.6%
rem-exp-log65.0%
*-commutative65.0%
exp-neg65.0%
unpow1/265.0%
exp-prod65.0%
distribute-lft-neg-out65.0%
exp-neg65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
exp-to-pow68.6%
unpow1/268.6%
*-commutative68.6%
Simplified68.6%
if -1.85000000000000007e62 < d < -8.39999999999999969e-76Initial program 89.7%
Simplified89.7%
add-sqr-sqrt89.6%
pow289.6%
sqrt-prod89.6%
sqrt-pow189.6%
metadata-eval89.6%
frac-times89.7%
associate-/l*89.6%
pow189.6%
*-commutative89.6%
Applied egg-rr89.6%
associate-*r/89.7%
*-commutative89.7%
associate-*r/86.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in h around 0 16.5%
associate-*r*16.5%
fma-define16.5%
unpow216.5%
unpow216.5%
swap-sqr16.7%
unpow216.7%
cube-div52.3%
Simplified52.3%
Taylor expanded in D around 0 47.2%
if -8.39999999999999969e-76 < d < 8.5000000000000002e-306Initial program 46.3%
Simplified42.6%
Taylor expanded in d around inf 15.9%
*-commutative15.9%
Simplified15.9%
add-log-exp26.4%
pow1/226.4%
inv-pow26.4%
pow-pow26.4%
metadata-eval26.4%
Applied egg-rr26.4%
rem-log-exp14.2%
sqr-pow14.2%
pow-prod-down21.4%
pow221.4%
*-commutative21.4%
metadata-eval21.4%
Applied egg-rr21.4%
if 8.5000000000000002e-306 < d Initial program 68.4%
Simplified68.4%
Taylor expanded in d around inf 50.2%
associate-/r*50.9%
Simplified50.9%
*-un-lft-identity50.9%
sqrt-div60.7%
inv-pow60.7%
sqrt-pow160.8%
metadata-eval60.8%
Applied egg-rr60.8%
*-lft-identity60.8%
Simplified60.8%
Final simplification52.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 (<= d -1.5e+62)
(/ (- d) (sqrt (* h l)))
(if (<= d -2.45e-78)
(/ (* d (sqrt (/ h l))) h)
(if (<= d 8.5e-306)
(* d (cbrt (pow (* h l) -1.5)))
(* d (/ (pow h -0.5) (sqrt l)))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.5e+62) {
tmp = -d / sqrt((h * l));
} else if (d <= -2.45e-78) {
tmp = (d * sqrt((h / l))) / h;
} else if (d <= 8.5e-306) {
tmp = d * cbrt(pow((h * l), -1.5));
} else {
tmp = d * (pow(h, -0.5) / sqrt(l));
}
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 (d <= -1.5e+62) {
tmp = -d / Math.sqrt((h * l));
} else if (d <= -2.45e-78) {
tmp = (d * Math.sqrt((h / l))) / h;
} else if (d <= 8.5e-306) {
tmp = d * Math.cbrt(Math.pow((h * l), -1.5));
} else {
tmp = d * (Math.pow(h, -0.5) / Math.sqrt(l));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.5e+62) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); elseif (d <= -2.45e-78) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); elseif (d <= 8.5e-306) tmp = Float64(d * cbrt((Float64(h * l) ^ -1.5))); else tmp = Float64(d * Float64((h ^ -0.5) / sqrt(l))); 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[d, -1.5e+62], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.45e-78], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 8.5e-306], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[h, -0.5], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2.45 \cdot 10^{-78}:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{elif}\;d \leq 8.5 \cdot 10^{-306}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{{h}^{-0.5}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.5e62Initial program 78.8%
Simplified80.7%
Taylor expanded in d around inf 5.4%
associate-/r*5.4%
Simplified5.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
mul-1-neg68.6%
*-commutative68.6%
rem-exp-log65.0%
*-commutative65.0%
exp-neg65.0%
unpow1/265.0%
exp-prod65.0%
distribute-lft-neg-out65.0%
exp-neg65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
exp-to-pow68.6%
unpow1/268.6%
*-commutative68.6%
Simplified68.6%
if -1.5e62 < d < -2.45000000000000015e-78Initial program 89.7%
Simplified89.7%
add-sqr-sqrt89.6%
pow289.6%
sqrt-prod89.6%
sqrt-pow189.6%
metadata-eval89.6%
frac-times89.7%
associate-/l*89.6%
pow189.6%
*-commutative89.6%
Applied egg-rr89.6%
associate-*r/89.7%
*-commutative89.7%
associate-*r/86.7%
associate-*l*86.6%
Simplified86.6%
Taylor expanded in h around 0 16.5%
associate-*r*16.5%
fma-define16.5%
unpow216.5%
unpow216.5%
swap-sqr16.7%
unpow216.7%
cube-div52.3%
Simplified52.3%
Taylor expanded in D around 0 47.2%
if -2.45000000000000015e-78 < d < 8.5000000000000002e-306Initial program 46.3%
Simplified42.6%
Taylor expanded in d around inf 15.9%
*-commutative15.9%
Simplified15.9%
add-cbrt-cube21.3%
pow1/321.3%
add-sqr-sqrt21.3%
pow121.3%
pow1/221.3%
pow-prod-up21.3%
associate-/r*21.3%
metadata-eval21.3%
Applied egg-rr21.3%
unpow1/321.3%
Simplified21.3%
*-un-lft-identity21.3%
div-inv21.3%
inv-pow21.3%
inv-pow21.3%
pow-prod-down21.3%
inv-pow21.3%
Applied egg-rr21.3%
*-lft-identity21.3%
rem-exp-log21.3%
*-commutative21.3%
exp-neg21.3%
exp-prod21.3%
distribute-lft-neg-out21.3%
distribute-rgt-neg-in21.3%
*-commutative21.3%
exp-to-pow21.3%
*-commutative21.3%
metadata-eval21.3%
Simplified21.3%
if 8.5000000000000002e-306 < d Initial program 68.4%
Simplified68.4%
Taylor expanded in d around inf 50.2%
associate-/r*50.9%
Simplified50.9%
*-un-lft-identity50.9%
sqrt-div60.7%
inv-pow60.7%
sqrt-pow160.8%
metadata-eval60.8%
Applied egg-rr60.8%
*-lft-identity60.8%
Simplified60.8%
Final simplification52.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 (/ (* d (sqrt (/ h l))) h)))
(if (<= d -1.12e+61)
(/ (- d) (sqrt (* h l)))
(if (<= d -3.1e-78)
t_0
(if (<= d 2e-147)
(* d (cbrt (pow (* h l) -1.5)))
(if (<= d 5.8e+16) t_0 (* 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 t_0 = (d * sqrt((h / l))) / h;
double tmp;
if (d <= -1.12e+61) {
tmp = -d / sqrt((h * l));
} else if (d <= -3.1e-78) {
tmp = t_0;
} else if (d <= 2e-147) {
tmp = d * cbrt(pow((h * l), -1.5));
} else if (d <= 5.8e+16) {
tmp = t_0;
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
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 = (d * Math.sqrt((h / l))) / h;
double tmp;
if (d <= -1.12e+61) {
tmp = -d / Math.sqrt((h * l));
} else if (d <= -3.1e-78) {
tmp = t_0;
} else if (d <= 2e-147) {
tmp = d * Math.cbrt(Math.pow((h * l), -1.5));
} else if (d <= 5.8e+16) {
tmp = t_0;
} 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) t_0 = Float64(Float64(d * sqrt(Float64(h / l))) / h) tmp = 0.0 if (d <= -1.12e+61) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); elseif (d <= -3.1e-78) tmp = t_0; elseif (d <= 2e-147) tmp = Float64(d * cbrt((Float64(h * l) ^ -1.5))); elseif (d <= 5.8e+16) tmp = t_0; else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); 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[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -1.12e+61], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.1e-78], t$95$0, If[LessEqual[d, 2e-147], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], -1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e+16], t$95$0, 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}
t_0 := \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{if}\;d \leq -1.12 \cdot 10^{+61}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -3.1 \cdot 10^{-78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-147}:\\
\;\;\;\;d \cdot \sqrt[3]{{\left(h \cdot \ell\right)}^{-1.5}}\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -1.12e61Initial program 78.8%
Simplified80.7%
Taylor expanded in d around inf 5.4%
associate-/r*5.4%
Simplified5.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
mul-1-neg68.6%
*-commutative68.6%
rem-exp-log65.0%
*-commutative65.0%
exp-neg65.0%
unpow1/265.0%
exp-prod65.0%
distribute-lft-neg-out65.0%
exp-neg65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
exp-to-pow68.6%
unpow1/268.6%
*-commutative68.6%
Simplified68.6%
if -1.12e61 < d < -3.10000000000000018e-78 or 1.9999999999999999e-147 < d < 5.8e16Initial program 87.7%
Simplified86.1%
add-sqr-sqrt86.1%
pow286.1%
sqrt-prod86.1%
sqrt-pow186.1%
metadata-eval86.1%
frac-times87.7%
associate-/l*86.1%
pow186.1%
*-commutative86.1%
Applied egg-rr86.1%
associate-*r/87.7%
*-commutative87.7%
associate-*r/86.1%
associate-*l*86.1%
Simplified86.1%
Taylor expanded in h around 0 24.0%
associate-*r*24.0%
fma-define24.0%
unpow224.0%
unpow224.0%
swap-sqr25.9%
unpow225.9%
cube-div61.5%
Simplified61.5%
Taylor expanded in D around 0 52.1%
if -3.10000000000000018e-78 < d < 1.9999999999999999e-147Initial program 43.6%
Simplified41.1%
Taylor expanded in d around inf 19.0%
*-commutative19.0%
Simplified19.0%
add-cbrt-cube22.4%
pow1/322.1%
add-sqr-sqrt22.1%
pow122.1%
pow1/222.1%
pow-prod-up22.1%
associate-/r*22.1%
metadata-eval22.1%
Applied egg-rr22.1%
unpow1/322.5%
Simplified22.5%
*-un-lft-identity22.5%
div-inv22.4%
inv-pow22.4%
inv-pow22.4%
pow-prod-down22.5%
inv-pow22.5%
Applied egg-rr22.5%
*-lft-identity22.5%
rem-exp-log22.3%
*-commutative22.3%
exp-neg22.3%
exp-prod22.1%
distribute-lft-neg-out22.1%
distribute-rgt-neg-in22.1%
*-commutative22.1%
exp-to-pow22.4%
*-commutative22.4%
metadata-eval22.4%
Simplified22.4%
if 5.8e16 < d Initial program 75.9%
Simplified77.6%
Taylor expanded in d around inf 69.8%
associate-/r*71.5%
Simplified71.5%
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
(let* ((t_0 (/ (* d (sqrt (/ h l))) h)))
(if (<= d -3.2e+61)
(/ (- d) (sqrt (* h l)))
(if (<= d -8.4e-76)
t_0
(if (<= d 5.3e-73)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= d 5.2e+16) t_0 (* 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 t_0 = (d * sqrt((h / l))) / h;
double tmp;
if (d <= -3.2e+61) {
tmp = -d / sqrt((h * l));
} else if (d <= -8.4e-76) {
tmp = t_0;
} else if (d <= 5.3e-73) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (d <= 5.2e+16) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (d * sqrt((h / l))) / h
if (d <= (-3.2d+61)) then
tmp = -d / sqrt((h * l))
else if (d <= (-8.4d-76)) then
tmp = t_0
else if (d <= 5.3d-73) then
tmp = d * sqrt((1.0d0 / (h * l)))
else if (d <= 5.2d+16) then
tmp = t_0
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 t_0 = (d * Math.sqrt((h / l))) / h;
double tmp;
if (d <= -3.2e+61) {
tmp = -d / Math.sqrt((h * l));
} else if (d <= -8.4e-76) {
tmp = t_0;
} else if (d <= 5.3e-73) {
tmp = d * Math.sqrt((1.0 / (h * l)));
} else if (d <= 5.2e+16) {
tmp = t_0;
} 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): t_0 = (d * math.sqrt((h / l))) / h tmp = 0 if d <= -3.2e+61: tmp = -d / math.sqrt((h * l)) elif d <= -8.4e-76: tmp = t_0 elif d <= 5.3e-73: tmp = d * math.sqrt((1.0 / (h * l))) elif d <= 5.2e+16: tmp = t_0 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) t_0 = Float64(Float64(d * sqrt(Float64(h / l))) / h) tmp = 0.0 if (d <= -3.2e+61) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); elseif (d <= -8.4e-76) tmp = t_0; elseif (d <= 5.3e-73) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= 5.2e+16) tmp = t_0; 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)
t_0 = (d * sqrt((h / l))) / h;
tmp = 0.0;
if (d <= -3.2e+61)
tmp = -d / sqrt((h * l));
elseif (d <= -8.4e-76)
tmp = t_0;
elseif (d <= 5.3e-73)
tmp = d * sqrt((1.0 / (h * l)));
elseif (d <= 5.2e+16)
tmp = t_0;
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_] := Block[{t$95$0 = N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[d, -3.2e+61], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -8.4e-76], t$95$0, If[LessEqual[d, 5.3e-73], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.2e+16], t$95$0, 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}
t_0 := \frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{if}\;d \leq -3.2 \cdot 10^{+61}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -8.4 \cdot 10^{-76}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 5.3 \cdot 10^{-73}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 5.2 \cdot 10^{+16}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -3.1999999999999998e61Initial program 78.8%
Simplified80.7%
Taylor expanded in d around inf 5.4%
associate-/r*5.4%
Simplified5.4%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt68.6%
associate-*r*68.6%
mul-1-neg68.6%
*-commutative68.6%
rem-exp-log65.0%
*-commutative65.0%
exp-neg65.0%
unpow1/265.0%
exp-prod65.0%
distribute-lft-neg-out65.0%
exp-neg65.0%
associate-*r/65.0%
*-rgt-identity65.0%
*-commutative65.0%
exp-to-pow68.6%
unpow1/268.6%
*-commutative68.6%
Simplified68.6%
if -3.1999999999999998e61 < d < -8.39999999999999969e-76 or 5.29999999999999972e-73 < d < 5.2e16Initial program 89.5%
Simplified89.5%
add-sqr-sqrt89.5%
pow289.5%
sqrt-prod89.4%
sqrt-pow189.4%
metadata-eval89.4%
frac-times89.4%
associate-/l*89.4%
pow189.4%
*-commutative89.4%
Applied egg-rr89.4%
associate-*r/89.4%
*-commutative89.4%
associate-*r/87.6%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in h around 0 20.3%
associate-*r*20.3%
fma-define20.3%
unpow220.3%
unpow220.3%
swap-sqr22.5%
unpow222.5%
cube-div60.5%
Simplified60.5%
Taylor expanded in D around 0 53.4%
if -8.39999999999999969e-76 < d < 5.29999999999999972e-73Initial program 46.9%
Simplified43.7%
Taylor expanded in d around inf 22.6%
*-commutative22.6%
Simplified22.6%
if 5.2e16 < d Initial program 75.9%
Simplified77.6%
Taylor expanded in d around inf 69.8%
associate-/r*71.5%
Simplified71.5%
Final simplification49.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 (<= d -7.2e-137) (/ (- 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 (d <= -7.2e-137) {
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 (d <= (-7.2d-137)) 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 (d <= -7.2e-137) {
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 d <= -7.2e-137: 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 (d <= -7.2e-137) 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 (d <= -7.2e-137)
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[d, -7.2e-137], 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}\;d \leq -7.2 \cdot 10^{-137}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if d < -7.20000000000000013e-137Initial program 79.1%
Simplified78.3%
Taylor expanded in d around inf 8.0%
associate-/r*8.0%
Simplified8.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.0%
associate-*r*47.0%
mul-1-neg47.0%
*-commutative47.0%
rem-exp-log44.5%
*-commutative44.5%
exp-neg44.5%
unpow1/244.5%
exp-prod44.9%
distribute-lft-neg-out44.9%
exp-neg44.9%
associate-*r/44.9%
*-rgt-identity44.9%
*-commutative44.9%
exp-to-pow47.4%
unpow1/247.4%
*-commutative47.4%
Simplified47.4%
if -7.20000000000000013e-137 < d Initial program 61.2%
Simplified61.1%
Taylor expanded in d around inf 41.9%
associate-/r*42.6%
Simplified42.6%
Final simplification44.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 (<= d -9.5e-137) (/ (- 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 (d <= -9.5e-137) {
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 (d <= (-9.5d-137)) 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 (d <= -9.5e-137) {
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 d <= -9.5e-137: 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 (d <= -9.5e-137) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * sqrt(Float64(1.0 / Float64(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 (d <= -9.5e-137)
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[d, -9.5e-137], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $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 -9.5 \cdot 10^{-137}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -9.5000000000000007e-137Initial program 79.1%
Simplified78.3%
Taylor expanded in d around inf 8.0%
associate-/r*8.0%
Simplified8.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.0%
associate-*r*47.0%
mul-1-neg47.0%
*-commutative47.0%
rem-exp-log44.5%
*-commutative44.5%
exp-neg44.5%
unpow1/244.5%
exp-prod44.9%
distribute-lft-neg-out44.9%
exp-neg44.9%
associate-*r/44.9%
*-rgt-identity44.9%
*-commutative44.9%
exp-to-pow47.4%
unpow1/247.4%
*-commutative47.4%
Simplified47.4%
if -9.5000000000000007e-137 < d Initial program 61.2%
Simplified61.1%
Taylor expanded in d around inf 41.9%
*-commutative41.9%
Simplified41.9%
Final simplification44.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 (<= d -9e-136) (/ (- d) (sqrt (* h l))) (* d (pow (* h l) -0.5))))
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 <= -9e-136) {
tmp = -d / sqrt((h * l));
} else {
tmp = d * pow((h * l), -0.5);
}
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 <= (-9d-136)) then
tmp = -d / sqrt((h * l))
else
tmp = d * ((h * l) ** (-0.5d0))
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 <= -9e-136) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
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 <= -9e-136: tmp = -d / math.sqrt((h * l)) else: tmp = d * math.pow((h * l), -0.5) 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 <= -9e-136) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); 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 <= -9e-136)
tmp = -d / sqrt((h * l));
else
tmp = d * ((h * l) ^ -0.5);
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, -9e-136], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \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 -9 \cdot 10^{-136}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if d < -8.99999999999999944e-136Initial program 79.1%
Simplified78.3%
Taylor expanded in d around inf 8.0%
associate-/r*8.0%
Simplified8.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.0%
associate-*r*47.0%
mul-1-neg47.0%
*-commutative47.0%
rem-exp-log44.5%
*-commutative44.5%
exp-neg44.5%
unpow1/244.5%
exp-prod44.9%
distribute-lft-neg-out44.9%
exp-neg44.9%
associate-*r/44.9%
*-rgt-identity44.9%
*-commutative44.9%
exp-to-pow47.4%
unpow1/247.4%
*-commutative47.4%
Simplified47.4%
if -8.99999999999999944e-136 < d Initial program 61.2%
Simplified61.1%
Taylor expanded in d around inf 41.9%
*-commutative41.9%
Simplified41.9%
Taylor expanded in l around 0 41.9%
*-commutative41.9%
unpow-141.9%
metadata-eval41.9%
pow-sqr41.9%
rem-sqrt-square41.8%
rem-square-sqrt41.6%
fabs-sqr41.6%
rem-square-sqrt41.8%
Simplified41.8%
Final simplification44.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 (* h l)))) (if (<= d -1.35e-136) (/ (- 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 <= -1.35e-136) {
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 <= (-1.35d-136)) 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 <= -1.35e-136) {
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 <= -1.35e-136: 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 <= -1.35e-136) 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 <= -1.35e-136)
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, -1.35e-136], 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 -1.35 \cdot 10^{-136}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0}\\
\end{array}
\end{array}
if d < -1.3499999999999999e-136Initial program 79.1%
Simplified78.3%
Taylor expanded in d around inf 8.0%
associate-/r*8.0%
Simplified8.0%
Taylor expanded in h around -inf 0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.0%
associate-*r*47.0%
mul-1-neg47.0%
*-commutative47.0%
rem-exp-log44.5%
*-commutative44.5%
exp-neg44.5%
unpow1/244.5%
exp-prod44.9%
distribute-lft-neg-out44.9%
exp-neg44.9%
associate-*r/44.9%
*-rgt-identity44.9%
*-commutative44.9%
exp-to-pow47.4%
unpow1/247.4%
*-commutative47.4%
Simplified47.4%
if -1.3499999999999999e-136 < d Initial program 61.2%
Simplified61.1%
Taylor expanded in d around inf 41.9%
associate-/r*42.6%
Simplified42.6%
Taylor expanded in d around 0 41.9%
*-commutative41.9%
rem-exp-log39.9%
*-commutative39.9%
exp-neg39.9%
unpow1/239.9%
exp-prod39.7%
distribute-lft-neg-out39.7%
exp-neg39.7%
associate-*r/39.7%
*-rgt-identity39.7%
*-commutative39.7%
exp-to-pow41.8%
unpow1/241.8%
*-commutative41.8%
Simplified41.8%
Final simplification44.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 (/ 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 68.5%
Simplified68.1%
Taylor expanded in d around inf 28.0%
associate-/r*28.4%
Simplified28.4%
Taylor expanded in d around 0 28.0%
*-commutative28.0%
rem-exp-log26.8%
*-commutative26.8%
exp-neg26.8%
unpow1/226.8%
exp-prod26.7%
distribute-lft-neg-out26.7%
exp-neg26.7%
associate-*r/26.7%
*-rgt-identity26.7%
*-commutative26.7%
exp-to-pow27.9%
unpow1/227.9%
*-commutative27.9%
Simplified27.9%
herbie shell --seed 2024085
(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)))))