
(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 18 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 (* (/ h l) -0.5)) (t_1 (sqrt (- d))))
(if (<= d -2e-310)
(*
(* (/ t_1 (sqrt (- h))) (/ t_1 (sqrt (- l))))
(- 1.0 (* 0.5 (* (pow (* (/ D_m 2.0) (/ M_m d)) 2.0) (/ h l)))))
(if (<= d 1.8e-157)
(/
(* d (fma t_0 (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(if (<= d 1.35e+143)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(-
1.0
(*
0.5
(pow (/ (* (* 0.5 D_m) (sqrt h)) (* (/ d M_m) (sqrt l))) 2.0))))
(*
(+ 1.0 (* t_0 (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 = (h / l) * -0.5;
double t_1 = sqrt(-d);
double tmp;
if (d <= -2e-310) {
tmp = ((t_1 / sqrt(-h)) * (t_1 / sqrt(-l))) * (1.0 - (0.5 * (pow(((D_m / 2.0) * (M_m / d)), 2.0) * (h / l))));
} else if (d <= 1.8e-157) {
tmp = (d * fma(t_0, pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else if (d <= 1.35e+143) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * pow((((0.5 * D_m) * sqrt(h)) / ((d / M_m) * sqrt(l))), 2.0)));
} else {
tmp = (1.0 + (t_0 * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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(Float64(h / l) * -0.5) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(t_1 / sqrt(Float64(-l)))) * Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D_m / 2.0) * Float64(M_m / d)) ^ 2.0) * Float64(h / l))))); elseif (d <= 1.8e-157) tmp = Float64(Float64(d * fma(t_0, (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); elseif (d <= 1.35e+143) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * D_m) * sqrt(h)) / Float64(Float64(d / M_m) * sqrt(l))) ^ 2.0)))); else tmp = Float64(Float64(1.0 + Float64(t_0 * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-157], N[(N[(d * N[(t$95$0 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.35e+143], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * D$95$m), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[(d / M$95$m), $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$0 * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \frac{h}{\ell} \cdot -0.5\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t_1}{\sqrt{-h}} \cdot \frac{t_1}{\sqrt{-\ell}}\right) \cdot \left(1 - 0.5 \cdot \left({\left(\frac{D_m}{2} \cdot \frac{M_m}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-157}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(t_0, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.35 \cdot 10^{+143}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\frac{\left(0.5 \cdot D_m\right) \cdot \sqrt{h}}{\frac{d}{M_m} \cdot \sqrt{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0 \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 70.8%
Simplified70.9%
frac-2neg70.9%
sqrt-div79.3%
Applied egg-rr79.3%
frac-2neg79.3%
sqrt-div86.9%
Applied egg-rr86.9%
if -1.999999999999994e-310 < d < 1.8e-157Initial program 21.7%
Simplified21.6%
Applied egg-rr36.9%
distribute-rgt1-in36.9%
+-commutative36.9%
associate-*l*36.9%
Simplified36.9%
associate-*r/68.4%
+-commutative68.4%
fma-def68.4%
sqrt-unprod51.6%
*-commutative51.6%
Applied egg-rr51.6%
if 1.8e-157 < d < 1.3500000000000001e143Initial program 80.2%
Simplified80.2%
add-sqr-sqrt80.2%
pow280.2%
sqrt-prod80.2%
frac-times80.2%
*-commutative80.2%
frac-times80.2%
unpow280.2%
sqrt-prod48.4%
add-sqr-sqrt84.5%
div-inv84.5%
metadata-eval84.5%
Applied egg-rr84.5%
Taylor expanded in M around 0 83.0%
associate-*r*83.0%
associate-*r/84.5%
Simplified84.5%
associate-*r*84.5%
*-commutative84.5%
clear-num84.5%
div-inv84.5%
sqrt-div90.1%
frac-times90.0%
*-commutative90.0%
Applied egg-rr90.0%
if 1.3500000000000001e143 < d Initial program 68.6%
Simplified68.7%
Applied egg-rr75.4%
distribute-rgt1-in96.7%
+-commutative96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in M around 0 96.7%
Final simplification85.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 (sqrt (/ d h)))
(t_1 (* (/ h l) -0.5))
(t_2 (* (/ D_m d) (* 0.5 M_m))))
(if (<= d -2e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) t_0)
(- 1.0 (* 0.5 (/ (* h (pow t_2 2.0)) l))))
(if (<= d 7.6e-128)
(/
(* d (fma t_1 (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(if (<= d 1.45e+145)
(*
(* t_0 (sqrt (/ d l)))
(- 1.0 (* 0.5 (pow (* t_2 (/ (sqrt h) (sqrt l))) 2.0))))
(*
(+ 1.0 (* t_1 (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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));
double t_1 = (h / l) * -0.5;
double t_2 = (D_m / d) * (0.5 * M_m);
double tmp;
if (d <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * (1.0 - (0.5 * ((h * pow(t_2, 2.0)) / l)));
} else if (d <= 7.6e-128) {
tmp = (d * fma(t_1, pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else if (d <= 1.45e+145) {
tmp = (t_0 * sqrt((d / l))) * (1.0 - (0.5 * pow((t_2 * (sqrt(h) / sqrt(l))), 2.0)));
} else {
tmp = (1.0 + (t_1 * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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 = sqrt(Float64(d / h)) t_1 = Float64(Float64(h / l) * -0.5) t_2 = Float64(Float64(D_m / d) * Float64(0.5 * M_m)) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (t_2 ^ 2.0)) / l)))); elseif (d <= 7.6e-128) tmp = Float64(Float64(d * fma(t_1, (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); elseif (d <= 1.45e+145) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(t_2 * Float64(sqrt(h) / sqrt(l))) ^ 2.0)))); else tmp = Float64(Float64(1.0 + Float64(t_1 * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.6e-128], N[(N[(d * N[(t$95$1 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.45e+145], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(t$95$2 * N[(N[Sqrt[h], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$1 * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{h}{\ell} \cdot -0.5\\
t_2 := \frac{D_m}{d} \cdot \left(0.5 \cdot M_m\right)\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {t_2}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 7.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(t_1, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.45 \cdot 10^{+145}:\\
\;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(t_2 \cdot \frac{\sqrt{h}}{\sqrt{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_1 \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 70.8%
Simplified70.9%
associate-*r/72.6%
frac-times72.6%
*-commutative72.6%
frac-times71.9%
add-sqr-sqrt41.2%
add-sqr-sqrt71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
frac-2neg70.9%
sqrt-div79.3%
Applied egg-rr83.8%
if -1.999999999999994e-310 < d < 7.6000000000000005e-128Initial program 30.4%
Simplified30.4%
Applied egg-rr43.7%
distribute-rgt1-in43.7%
+-commutative43.7%
associate-*l*43.7%
Simplified43.7%
associate-*r/72.3%
+-commutative72.3%
fma-def72.3%
sqrt-unprod56.5%
*-commutative56.5%
Applied egg-rr56.5%
if 7.6000000000000005e-128 < d < 1.45e145Initial program 79.4%
Simplified79.3%
add-sqr-sqrt79.4%
pow279.4%
sqrt-prod79.4%
frac-times79.4%
*-commutative79.4%
frac-times79.4%
unpow279.4%
sqrt-prod47.0%
add-sqr-sqrt84.0%
div-inv84.0%
metadata-eval84.0%
Applied egg-rr84.0%
sqrt-div88.4%
Applied egg-rr88.4%
if 1.45e145 < d Initial program 68.6%
Simplified68.7%
Applied egg-rr75.4%
distribute-rgt1-in96.7%
+-commutative96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in M around 0 96.7%
Final simplification83.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (* (/ h l) -0.5)))
(if (<= d -2e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) t_0)
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)) l))))
(if (<= d 2.2e-161)
(/
(* d (fma t_1 (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(if (<= d 1.05e+144)
(*
(* t_0 (sqrt (/ d l)))
(-
1.0
(*
0.5
(pow (/ (* (* 0.5 D_m) (sqrt h)) (* (/ d M_m) (sqrt l))) 2.0))))
(*
(+ 1.0 (* t_1 (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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));
double t_1 = (h / l) * -0.5;
double tmp;
if (d <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_0) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (0.5 * M_m)), 2.0)) / l)));
} else if (d <= 2.2e-161) {
tmp = (d * fma(t_1, pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else if (d <= 1.05e+144) {
tmp = (t_0 * sqrt((d / l))) * (1.0 - (0.5 * pow((((0.5 * D_m) * sqrt(h)) / ((d / M_m) * sqrt(l))), 2.0)));
} else {
tmp = (1.0 + (t_1 * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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 = sqrt(Float64(d / h)) t_1 = Float64(Float64(h / l) * -0.5) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_0) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0)) / l)))); elseif (d <= 2.2e-161) tmp = Float64(Float64(d * fma(t_1, (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); elseif (d <= 1.05e+144) tmp = Float64(Float64(t_0 * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * (Float64(Float64(Float64(0.5 * D_m) * sqrt(h)) / Float64(Float64(d / M_m) * sqrt(l))) ^ 2.0)))); else tmp = Float64(Float64(1.0 + Float64(t_1 * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-161], N[(N[(d * N[(t$95$1 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.05e+144], N[(N[(t$95$0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[Power[N[(N[(N[(0.5 * D$95$m), $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[(N[(d / M$95$m), $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$1 * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{h}{\ell} \cdot -0.5\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t_0\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D_m}{d} \cdot \left(0.5 \cdot M_m\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-161}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(t_1, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 1.05 \cdot 10^{+144}:\\
\;\;\;\;\left(t_0 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot {\left(\frac{\left(0.5 \cdot D_m\right) \cdot \sqrt{h}}{\frac{d}{M_m} \cdot \sqrt{\ell}}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_1 \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 70.8%
Simplified70.9%
associate-*r/72.6%
frac-times72.6%
*-commutative72.6%
frac-times71.9%
add-sqr-sqrt41.2%
add-sqr-sqrt71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
frac-2neg70.9%
sqrt-div79.3%
Applied egg-rr83.8%
if -1.999999999999994e-310 < d < 2.20000000000000002e-161Initial program 21.7%
Simplified21.6%
Applied egg-rr36.9%
distribute-rgt1-in36.9%
+-commutative36.9%
associate-*l*36.9%
Simplified36.9%
associate-*r/68.4%
+-commutative68.4%
fma-def68.4%
sqrt-unprod51.6%
*-commutative51.6%
Applied egg-rr51.6%
if 2.20000000000000002e-161 < d < 1.04999999999999998e144Initial program 80.2%
Simplified80.2%
add-sqr-sqrt80.2%
pow280.2%
sqrt-prod80.2%
frac-times80.2%
*-commutative80.2%
frac-times80.2%
unpow280.2%
sqrt-prod48.4%
add-sqr-sqrt84.5%
div-inv84.5%
metadata-eval84.5%
Applied egg-rr84.5%
Taylor expanded in M around 0 83.0%
associate-*r*83.0%
associate-*r/84.5%
Simplified84.5%
associate-*r*84.5%
*-commutative84.5%
clear-num84.5%
div-inv84.5%
sqrt-div90.1%
frac-times90.0%
*-commutative90.0%
Applied egg-rr90.0%
if 1.04999999999999998e144 < d Initial program 68.6%
Simplified68.7%
Applied egg-rr75.4%
distribute-rgt1-in96.7%
+-commutative96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in M around 0 96.7%
Final simplification83.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 (* (/ h l) -0.5)))
(if (<= d -2e-310)
(*
(- 1.0 (* 0.5 (* (pow (* (/ D_m 2.0) (/ M_m d)) 2.0) (/ h l))))
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h))))
(if (<= d 2e-206)
(/
(* d (fma t_0 (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(*
(+ 1.0 (* t_0 (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 = (h / l) * -0.5;
double tmp;
if (d <= -2e-310) {
tmp = (1.0 - (0.5 * (pow(((D_m / 2.0) * (M_m / d)), 2.0) * (h / l)))) * ((sqrt(-d) / sqrt(-l)) * sqrt((d / h)));
} else if (d <= 2e-206) {
tmp = (d * fma(t_0, pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else {
tmp = (1.0 + (t_0 * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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(Float64(h / l) * -0.5) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(1.0 - Float64(0.5 * Float64((Float64(Float64(D_m / 2.0) * Float64(M_m / d)) ^ 2.0) * Float64(h / l)))) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h)))); elseif (d <= 2e-206) tmp = Float64(Float64(d * fma(t_0, (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); else tmp = Float64(Float64(1.0 + Float64(t_0 * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(1.0 - N[(0.5 * N[(N[Power[N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-206], N[(N[(d * N[(t$95$0 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$0 * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \frac{h}{\ell} \cdot -0.5\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(1 - 0.5 \cdot \left({\left(\frac{D_m}{2} \cdot \frac{M_m}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right) \cdot \left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-206}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(t_0, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0 \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 70.8%
Simplified70.9%
frac-2neg70.9%
sqrt-div79.3%
Applied egg-rr79.3%
if -1.999999999999994e-310 < d < 2.00000000000000006e-206Initial program 14.7%
Simplified14.7%
Applied egg-rr21.3%
distribute-rgt1-in21.3%
+-commutative21.3%
associate-*l*21.3%
Simplified21.3%
associate-*r/65.4%
+-commutative65.4%
fma-def65.4%
sqrt-unprod41.7%
*-commutative41.7%
Applied egg-rr41.7%
if 2.00000000000000006e-206 < d Initial program 73.2%
Simplified73.2%
Applied egg-rr77.2%
distribute-rgt1-in86.0%
+-commutative86.0%
associate-*l*86.0%
Simplified86.0%
Taylor expanded in M around 0 86.1%
Final simplification79.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 (* (/ h l) -0.5)))
(if (<= d -2e-310)
(*
(* (/ (sqrt (- d)) (sqrt (- l))) (sqrt (/ d h)))
(- 1.0 (* 0.5 (/ (* h (pow (* (/ D_m d) (* 0.5 M_m)) 2.0)) l))))
(if (<= d 2.5e-206)
(/
(* d (fma t_0 (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(*
(+ 1.0 (* t_0 (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 = (h / l) * -0.5;
double tmp;
if (d <= -2e-310) {
tmp = ((sqrt(-d) / sqrt(-l)) * sqrt((d / h))) * (1.0 - (0.5 * ((h * pow(((D_m / d) * (0.5 * M_m)), 2.0)) / l)));
} else if (d <= 2.5e-206) {
tmp = (d * fma(t_0, pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else {
tmp = (1.0 + (t_0 * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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(Float64(h / l) * -0.5) tmp = 0.0 if (d <= -2e-310) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * sqrt(Float64(d / h))) * Float64(1.0 - Float64(0.5 * Float64(Float64(h * (Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0)) / l)))); elseif (d <= 2.5e-206) tmp = Float64(Float64(d * fma(t_0, (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); else tmp = Float64(Float64(1.0 + Float64(t_0 * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[d, -2e-310], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(N[(h * N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-206], N[(N[(d * N[(t$95$0 * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t$95$0 * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \frac{h}{\ell} \cdot -0.5\\
\mathbf{if}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 - 0.5 \cdot \frac{h \cdot {\left(\frac{D_m}{d} \cdot \left(0.5 \cdot M_m\right)\right)}^{2}}{\ell}\right)\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-206}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(t_0, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t_0 \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.999999999999994e-310Initial program 70.8%
Simplified70.9%
associate-*r/72.6%
frac-times72.6%
*-commutative72.6%
frac-times71.9%
add-sqr-sqrt41.2%
add-sqr-sqrt71.9%
div-inv71.9%
metadata-eval71.9%
Applied egg-rr71.9%
frac-2neg70.9%
sqrt-div79.3%
Applied egg-rr83.8%
if -1.999999999999994e-310 < d < 2.5e-206Initial program 14.7%
Simplified14.7%
Applied egg-rr21.3%
distribute-rgt1-in21.3%
+-commutative21.3%
associate-*l*21.3%
Simplified21.3%
associate-*r/65.4%
+-commutative65.4%
fma-def65.4%
sqrt-unprod41.7%
*-commutative41.7%
Applied egg-rr41.7%
if 2.5e-206 < d Initial program 73.2%
Simplified73.2%
Applied egg-rr77.2%
distribute-rgt1-in86.0%
+-commutative86.0%
associate-*l*86.0%
Simplified86.0%
Taylor expanded in M around 0 86.1%
Final simplification81.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -9.4e+144)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= l 4.3e-302)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.5 (pow (/ (* 0.5 D_m) (/ d M_m)) 2.0))))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 (l <= -9.4e+144) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (l <= 4.3e-302) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * pow(((0.5 * D_m) / (d / M_m)), 2.0)))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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 (l <= (-9.4d+144)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (l <= 4.3d-302) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.5d0) * (((0.5d0 * d_m) / (d / m_m)) ** 2.0d0)))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((0.5d0 * ((d_m * m_m) / d)) ** 2.0d0))) * (d / (sqrt(h) * 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 (l <= -9.4e+144) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (l <= 4.3e-302) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * Math.pow(((0.5 * D_m) / (d / M_m)), 2.0)))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (Math.sqrt(h) * 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 l <= -9.4e+144: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif l <= 4.3e-302: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * math.pow(((0.5 * D_m) / (d / M_m)), 2.0))))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (math.sqrt(h) * 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 (l <= -9.4e+144) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (l <= 4.3e-302) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(Float64(0.5 * D_m) / Float64(d / M_m)) ^ 2.0)))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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 (l <= -9.4e+144)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (l <= 4.3e-302)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.5 * (((0.5 * D_m) / (d / M_m)) ^ 2.0)))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((0.5 * ((D_m * M_m) / d)) ^ 2.0))) * (d / (sqrt(h) * 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[l, -9.4e+144], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e-302], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(N[(0.5 * D$95$m), $MachinePrecision] / N[(d / M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}\;\ell \leq -9.4 \cdot 10^{+144}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-302}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(\frac{0.5 \cdot D_m}{\frac{d}{M_m}}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.4000000000000004e144Initial program 52.9%
Simplified55.8%
frac-2neg55.8%
sqrt-div71.9%
Applied egg-rr71.9%
Taylor expanded in d around -inf 58.0%
mul-1-neg58.0%
distribute-rgt-neg-in58.0%
associate-/r*58.0%
unpow1/258.0%
associate-/r*58.0%
rem-exp-log54.8%
exp-neg54.8%
exp-prod54.8%
distribute-lft-neg-out54.8%
distribute-rgt-neg-in54.8%
metadata-eval54.8%
exp-to-pow57.9%
Simplified57.9%
Taylor expanded in l around -inf 73.0%
distribute-lft-in73.0%
exp-sum72.9%
*-commutative72.9%
exp-to-pow73.2%
mul-1-neg73.2%
*-commutative73.2%
*-commutative73.2%
associate-*l*73.2%
metadata-eval73.2%
exp-to-pow79.2%
Simplified79.2%
if -9.4000000000000004e144 < l < 4.3000000000000002e-302Initial program 76.4%
Simplified74.6%
frac-times76.4%
*-commutative76.4%
frac-times75.5%
clear-num75.5%
un-div-inv75.5%
div-inv75.5%
metadata-eval75.5%
Applied egg-rr75.5%
if 4.3000000000000002e-302 < l Initial program 63.8%
Simplified63.8%
Applied egg-rr69.1%
distribute-rgt1-in75.8%
+-commutative75.8%
associate-*l*75.8%
Simplified75.8%
Taylor expanded in M around 0 75.9%
Final simplification76.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 (/ (* D_m M_m) d)))
(if (<= l -4.3e+145)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= l -1e-309)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (+ 1.0 (/ (* -0.5 (* (pow t_0 2.0) 0.25)) (/ l h)))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* 0.5 t_0) 2.0)))
(/ d (* (sqrt h) (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 = (D_m * M_m) / d;
double tmp;
if (l <= -4.3e+145) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (l <= -1e-309) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((-0.5 * (pow(t_0, 2.0) * 0.25)) / (l / h))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((0.5 * t_0), 2.0))) * (d / (sqrt(h) * 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 = (d_m * m_m) / d
if (l <= (-4.3d+145)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (l <= (-1d-309)) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + (((-0.5d0) * ((t_0 ** 2.0d0) * 0.25d0)) / (l / h))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((0.5d0 * t_0) ** 2.0d0))) * (d / (sqrt(h) * 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 = (D_m * M_m) / d;
double tmp;
if (l <= -4.3e+145) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (l <= -1e-309) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((-0.5 * (Math.pow(t_0, 2.0) * 0.25)) / (l / h))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((0.5 * t_0), 2.0))) * (d / (Math.sqrt(h) * 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 = (D_m * M_m) / d tmp = 0 if l <= -4.3e+145: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif l <= -1e-309: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((-0.5 * (math.pow(t_0, 2.0) * 0.25)) / (l / h)))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((0.5 * t_0), 2.0))) * (d / (math.sqrt(h) * 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(Float64(D_m * M_m) / d) tmp = 0.0 if (l <= -4.3e+145) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (l <= -1e-309) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(-0.5 * Float64((t_0 ^ 2.0) * 0.25)) / Float64(l / h))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(0.5 * t_0) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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) / d;
tmp = 0.0;
if (l <= -4.3e+145)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (l <= -1e-309)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((-0.5 * ((t_0 ^ 2.0) * 0.25)) / (l / h))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((0.5 * t_0) ^ 2.0))) * (d / (sqrt(h) * 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[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[l, -4.3e+145], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-309], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(-0.5 * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / N[(l / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(0.5 * t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}
t_0 := \frac{D_m \cdot M_m}{d}\\
\mathbf{if}\;\ell \leq -4.3 \cdot 10^{+145}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{-0.5 \cdot \left({t_0}^{2} \cdot 0.25\right)}{\frac{\ell}{h}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(0.5 \cdot t_0\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.29999999999999998e145Initial program 52.9%
Simplified55.8%
frac-2neg55.8%
sqrt-div71.9%
Applied egg-rr71.9%
Taylor expanded in d around -inf 58.0%
mul-1-neg58.0%
distribute-rgt-neg-in58.0%
associate-/r*58.0%
unpow1/258.0%
associate-/r*58.0%
rem-exp-log54.8%
exp-neg54.8%
exp-prod54.8%
distribute-lft-neg-out54.8%
distribute-rgt-neg-in54.8%
metadata-eval54.8%
exp-to-pow57.9%
Simplified57.9%
Taylor expanded in l around -inf 73.0%
distribute-lft-in73.0%
exp-sum72.9%
*-commutative72.9%
exp-to-pow73.2%
mul-1-neg73.2%
*-commutative73.2%
*-commutative73.2%
associate-*l*73.2%
metadata-eval73.2%
exp-to-pow79.2%
Simplified79.2%
if -4.29999999999999998e145 < l < -1.000000000000002e-309Initial program 77.0%
Simplified75.1%
frac-times76.9%
*-commutative76.9%
frac-times76.0%
clear-num76.0%
un-div-inv76.0%
div-inv76.0%
metadata-eval76.0%
Applied egg-rr76.0%
*-commutative76.0%
clear-num76.0%
un-div-inv77.0%
*-commutative77.0%
div-inv77.0%
*-commutative77.0%
clear-num77.0%
associate-*r*77.0%
*-commutative77.0%
unpow-prod-down77.0%
associate-*r/77.9%
metadata-eval77.9%
Applied egg-rr77.9%
if -1.000000000000002e-309 < l Initial program 63.6%
Simplified63.6%
Applied egg-rr68.0%
distribute-rgt1-in75.4%
+-commutative75.4%
associate-*l*75.4%
Simplified75.4%
Taylor expanded in M around 0 75.5%
Final simplification76.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -2.35e+144)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= l 4.7e-290)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (/ (pow (* (/ D_m d) (* 0.5 M_m)) 2.0) l)))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 (l <= -2.35e+144) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (l <= 4.7e-290) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (pow(((D_m / d) * (0.5 * M_m)), 2.0) / l))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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 (l <= (-2.35d+144)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (l <= 4.7d-290) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * (h * ((((d_m / d) * (0.5d0 * m_m)) ** 2.0d0) / l))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((0.5d0 * ((d_m * m_m) / d)) ** 2.0d0))) * (d / (sqrt(h) * 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 (l <= -2.35e+144) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (l <= 4.7e-290) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (h * (Math.pow(((D_m / d) * (0.5 * M_m)), 2.0) / l))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (Math.sqrt(h) * 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 l <= -2.35e+144: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif l <= 4.7e-290: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (h * (math.pow(((D_m / d) * (0.5 * M_m)), 2.0) / l)))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (math.sqrt(h) * 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 (l <= -2.35e+144) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (l <= 4.7e-290) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(D_m / d) * Float64(0.5 * M_m)) ^ 2.0) / l))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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 (l <= -2.35e+144)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (l <= 4.7e-290)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * ((((D_m / d) * (0.5 * M_m)) ^ 2.0) / l))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((0.5 * ((D_m * M_m) / d)) ^ 2.0))) * (d / (sqrt(h) * 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[l, -2.35e+144], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.7e-290], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(0.5 * N[(h * N[(N[Power[N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * M$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}\;\ell \leq -2.35 \cdot 10^{+144}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.7 \cdot 10^{-290}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - 0.5 \cdot \left(h \cdot \frac{{\left(\frac{D_m}{d} \cdot \left(0.5 \cdot M_m\right)\right)}^{2}}{\ell}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3500000000000001e144Initial program 52.9%
Simplified55.8%
frac-2neg55.8%
sqrt-div71.9%
Applied egg-rr71.9%
Taylor expanded in d around -inf 58.0%
mul-1-neg58.0%
distribute-rgt-neg-in58.0%
associate-/r*58.0%
unpow1/258.0%
associate-/r*58.0%
rem-exp-log54.8%
exp-neg54.8%
exp-prod54.8%
distribute-lft-neg-out54.8%
distribute-rgt-neg-in54.8%
metadata-eval54.8%
exp-to-pow57.9%
Simplified57.9%
Taylor expanded in l around -inf 73.0%
distribute-lft-in73.0%
exp-sum72.9%
*-commutative72.9%
exp-to-pow73.2%
mul-1-neg73.2%
*-commutative73.2%
*-commutative73.2%
associate-*l*73.2%
metadata-eval73.2%
exp-to-pow79.2%
Simplified79.2%
if -2.3500000000000001e144 < l < 4.7000000000000001e-290Initial program 76.1%
Simplified75.3%
associate-*r/77.4%
frac-times78.3%
*-commutative78.3%
frac-times76.5%
add-sqr-sqrt42.0%
add-sqr-sqrt76.5%
div-inv76.5%
metadata-eval76.5%
Applied egg-rr76.5%
expm1-log1p-u75.9%
expm1-udef75.9%
associate-/l*74.6%
associate-*l*74.6%
Applied egg-rr74.6%
expm1-def74.6%
expm1-log1p75.3%
associate-/r/77.5%
*-commutative77.5%
*-commutative77.5%
*-commutative77.5%
associate-*l*77.5%
Simplified77.5%
if 4.7000000000000001e-290 < l Initial program 63.8%
Simplified63.8%
Applied egg-rr70.1%
distribute-rgt1-in76.0%
+-commutative76.0%
associate-*l*76.0%
Simplified76.0%
Taylor expanded in M around 0 76.2%
Final simplification77.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -2.4e+146)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= l 2.4e-208)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.125 (pow (* D_m (/ M_m d)) 2.0))))))
(if (<= l 1.5e+122)
(/
(* d (fma (* (/ h l) -0.5) (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(sqrt (* h l)))
(* d (* (pow l -0.5) (pow h -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 (l <= -2.4e+146) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (l <= 2.4e-208) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.125 * pow((D_m * (M_m / d)), 2.0)))));
} else if (l <= 1.5e+122) {
tmp = (d * fma(((h / l) * -0.5), pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((h * l));
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 (l <= -2.4e+146) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (l <= 2.4e-208) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D_m * Float64(M_m / d)) ^ 2.0)))))); elseif (l <= 1.5e+122) tmp = Float64(Float64(d * fma(Float64(Float64(h / l) * -0.5), (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -0.5))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.4e+146], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-208], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e+122], N[(N[(d * N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+146}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-208}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D_m \cdot \frac{M_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if l < -2.4000000000000002e146Initial program 52.9%
Simplified55.8%
frac-2neg55.8%
sqrt-div71.9%
Applied egg-rr71.9%
Taylor expanded in d around -inf 58.0%
mul-1-neg58.0%
distribute-rgt-neg-in58.0%
associate-/r*58.0%
unpow1/258.0%
associate-/r*58.0%
rem-exp-log54.8%
exp-neg54.8%
exp-prod54.8%
distribute-lft-neg-out54.8%
distribute-rgt-neg-in54.8%
metadata-eval54.8%
exp-to-pow57.9%
Simplified57.9%
Taylor expanded in l around -inf 73.0%
distribute-lft-in73.0%
exp-sum72.9%
*-commutative72.9%
exp-to-pow73.2%
mul-1-neg73.2%
*-commutative73.2%
*-commutative73.2%
associate-*l*73.2%
metadata-eval73.2%
exp-to-pow79.2%
Simplified79.2%
if -2.4000000000000002e146 < l < 2.3999999999999999e-208Initial program 76.7%
Simplified75.1%
frac-times76.6%
*-commutative76.6%
frac-times75.9%
clear-num75.9%
un-div-inv75.9%
div-inv75.9%
metadata-eval75.9%
Applied egg-rr75.9%
expm1-log1p-u36.9%
expm1-udef36.9%
*-commutative36.9%
div-inv36.9%
*-commutative36.9%
clear-num36.9%
associate-*r*36.9%
*-commutative36.9%
unpow-prod-down36.9%
associate-*r/36.9%
metadata-eval36.9%
Applied egg-rr36.9%
expm1-def36.9%
expm1-log1p76.6%
*-commutative76.6%
associate-*r*76.6%
metadata-eval76.6%
associate-*r/75.9%
Simplified75.9%
if 2.3999999999999999e-208 < l < 1.49999999999999993e122Initial program 73.6%
Simplified73.6%
Applied egg-rr76.4%
distribute-rgt1-in83.2%
+-commutative83.2%
associate-*l*83.2%
Simplified83.2%
associate-*r/90.0%
+-commutative90.0%
fma-def90.0%
sqrt-unprod88.5%
*-commutative88.5%
Applied egg-rr88.5%
if 1.49999999999999993e122 < l Initial program 44.5%
Simplified44.5%
frac-2neg44.5%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 43.0%
associate-/r*42.9%
unpow1/242.9%
associate-/r*43.0%
rem-exp-log41.0%
exp-neg41.0%
exp-prod41.0%
distribute-lft-neg-out41.0%
distribute-rgt-neg-in41.0%
metadata-eval41.0%
exp-to-pow43.0%
Simplified43.0%
*-commutative43.0%
unpow-prod-down58.4%
Applied egg-rr58.4%
Final simplification76.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5.6e+144)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= l 4.3e-302)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(+ 1.0 (* (/ h l) (* -0.125 (pow (* D_m (/ M_m d)) 2.0))))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* 0.5 (/ (* D_m M_m) d)) 2.0)))
(/ d (* (sqrt h) (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 (l <= -5.6e+144) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (l <= 4.3e-302) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.125 * pow((D_m * (M_m / d)), 2.0)))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (sqrt(h) * 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 (l <= (-5.6d+144)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (l <= 4.3d-302) then
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0d0 + ((h / l) * ((-0.125d0) * ((d_m * (m_m / d)) ** 2.0d0)))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((0.5d0 * ((d_m * m_m) / d)) ** 2.0d0))) * (d / (sqrt(h) * 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 (l <= -5.6e+144) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (l <= 4.3e-302) {
tmp = Math.sqrt((d / h)) * (Math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.125 * Math.pow((D_m * (M_m / d)), 2.0)))));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (Math.sqrt(h) * 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 l <= -5.6e+144: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif l <= 4.3e-302: tmp = math.sqrt((d / h)) * (math.sqrt((d / l)) * (1.0 + ((h / l) * (-0.125 * math.pow((D_m * (M_m / d)), 2.0))))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((0.5 * ((D_m * M_m) / d)), 2.0))) * (d / (math.sqrt(h) * 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 (l <= -5.6e+144) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (l <= 4.3e-302) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.125 * (Float64(D_m * Float64(M_m / d)) ^ 2.0)))))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(0.5 * Float64(Float64(D_m * M_m) / d)) ^ 2.0))) * Float64(d / Float64(sqrt(h) * 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 (l <= -5.6e+144)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (l <= 4.3e-302)
tmp = sqrt((d / h)) * (sqrt((d / l)) * (1.0 + ((h / l) * (-0.125 * ((D_m * (M_m / d)) ^ 2.0)))));
else
tmp = (1.0 + (((h / l) * -0.5) * ((0.5 * ((D_m * M_m) / d)) ^ 2.0))) * (d / (sqrt(h) * 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[l, -5.6e+144], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e-302], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.125 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[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}\;\ell \leq -5.6 \cdot 10^{+144}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-302}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.125 \cdot {\left(D_m \cdot \frac{M_m}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(0.5 \cdot \frac{D_m \cdot M_m}{d}\right)}^{2}\right) \cdot \frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if l < -5.60000000000000013e144Initial program 52.9%
Simplified55.8%
frac-2neg55.8%
sqrt-div71.9%
Applied egg-rr71.9%
Taylor expanded in d around -inf 58.0%
mul-1-neg58.0%
distribute-rgt-neg-in58.0%
associate-/r*58.0%
unpow1/258.0%
associate-/r*58.0%
rem-exp-log54.8%
exp-neg54.8%
exp-prod54.8%
distribute-lft-neg-out54.8%
distribute-rgt-neg-in54.8%
metadata-eval54.8%
exp-to-pow57.9%
Simplified57.9%
Taylor expanded in l around -inf 73.0%
distribute-lft-in73.0%
exp-sum72.9%
*-commutative72.9%
exp-to-pow73.2%
mul-1-neg73.2%
*-commutative73.2%
*-commutative73.2%
associate-*l*73.2%
metadata-eval73.2%
exp-to-pow79.2%
Simplified79.2%
if -5.60000000000000013e144 < l < 4.3000000000000002e-302Initial program 76.4%
Simplified74.6%
frac-times76.4%
*-commutative76.4%
frac-times75.5%
clear-num75.5%
un-div-inv75.5%
div-inv75.5%
metadata-eval75.5%
Applied egg-rr75.5%
expm1-log1p-u39.4%
expm1-udef39.4%
*-commutative39.4%
div-inv39.4%
*-commutative39.4%
clear-num39.4%
associate-*r*39.4%
*-commutative39.4%
unpow-prod-down39.4%
associate-*r/39.4%
metadata-eval39.4%
Applied egg-rr39.4%
expm1-def39.4%
expm1-log1p76.4%
*-commutative76.4%
associate-*r*76.4%
metadata-eval76.4%
associate-*r/75.5%
Simplified75.5%
if 4.3000000000000002e-302 < l Initial program 63.8%
Simplified63.8%
Applied egg-rr69.1%
distribute-rgt1-in75.8%
+-commutative75.8%
associate-*l*75.8%
Simplified75.8%
Taylor expanded in M around 0 75.9%
Final simplification76.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 -4.6e-138)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= d 2.5e-305)
(* d (log (exp (pow (* h l) -0.5))))
(/
(* d (fma (* (/ h l) -0.5) (pow (* M_m (* 0.5 (/ D_m d))) 2.0) 1.0))
(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) {
double tmp;
if (d <= -4.6e-138) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (d <= 2.5e-305) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = (d * fma(((h / l) * -0.5), pow((M_m * (0.5 * (D_m / d))), 2.0), 1.0)) / sqrt((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 <= -4.6e-138) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (d <= 2.5e-305) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(Float64(d * fma(Float64(Float64(h / l) * -0.5), (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0), 1.0)) / sqrt(Float64(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_] := If[LessEqual[d, -4.6e-138], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-305], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d * N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / 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])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.6 \cdot 10^{-138}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -4.5999999999999998e-138Initial program 75.5%
Simplified75.6%
frac-2neg75.6%
sqrt-div82.4%
Applied egg-rr82.4%
Taylor expanded in d around -inf 52.0%
mul-1-neg52.0%
distribute-rgt-neg-in52.0%
associate-/r*52.3%
unpow1/252.3%
associate-/r*52.0%
rem-exp-log49.7%
exp-neg49.7%
exp-prod50.9%
distribute-lft-neg-out50.9%
distribute-rgt-neg-in50.9%
metadata-eval50.9%
exp-to-pow53.2%
Simplified53.2%
Taylor expanded in l around -inf 62.2%
distribute-lft-in62.2%
exp-sum62.4%
*-commutative62.4%
exp-to-pow62.7%
mul-1-neg62.7%
*-commutative62.7%
*-commutative62.7%
associate-*l*62.7%
metadata-eval62.7%
exp-to-pow66.7%
Simplified66.7%
if -4.5999999999999998e-138 < d < 2.49999999999999993e-305Initial program 50.4%
Simplified50.4%
Taylor expanded in d around inf 20.3%
add-log-exp44.5%
pow1/244.5%
inv-pow44.5%
pow-pow44.5%
metadata-eval44.5%
Applied egg-rr44.5%
if 2.49999999999999993e-305 < d Initial program 64.1%
Simplified64.1%
Applied egg-rr68.6%
distribute-rgt1-in76.0%
+-commutative76.0%
associate-*l*76.0%
Simplified76.0%
associate-*r/83.6%
+-commutative83.6%
fma-def83.6%
sqrt-unprod70.1%
*-commutative70.1%
Applied egg-rr70.1%
Final simplification65.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -4.6e-138)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= d 2.5e-305)
(* d (log (exp (pow (* h l) -0.5))))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M_m (* 0.5 (/ D_m d))) 2.0)))
(/ 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) {
double tmp;
if (d <= -4.6e-138) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (d <= 2.5e-305) {
tmp = d * log(exp(pow((h * l), -0.5)));
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / sqrt((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 <= (-4.6d-138)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (d <= 2.5d-305) then
tmp = d * log(exp(((h * l) ** (-0.5d0))))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0))) * (d / sqrt((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 <= -4.6e-138) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (d <= 2.5e-305) {
tmp = d * Math.log(Math.exp(Math.pow((h * l), -0.5)));
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / Math.sqrt((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 <= -4.6e-138: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif d <= 2.5e-305: tmp = d * math.log(math.exp(math.pow((h * l), -0.5))) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / math.sqrt((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 <= -4.6e-138) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (d <= 2.5e-305) tmp = Float64(d * log(exp((Float64(h * l) ^ -0.5)))); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0))) * Float64(d / sqrt(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 <= -4.6e-138)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (d <= 2.5e-305)
tmp = d * log(exp(((h * l) ^ -0.5)));
else
tmp = (1.0 + (((h / l) * -0.5) * ((M_m * (0.5 * (D_m / d))) ^ 2.0))) * (d / sqrt((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, -4.6e-138], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-305], N[(d * N[Log[N[Exp[N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[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 -4.6 \cdot 10^{-138}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \log \left(e^{{\left(h \cdot \ell\right)}^{-0.5}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -4.5999999999999998e-138Initial program 75.5%
Simplified75.6%
frac-2neg75.6%
sqrt-div82.4%
Applied egg-rr82.4%
Taylor expanded in d around -inf 52.0%
mul-1-neg52.0%
distribute-rgt-neg-in52.0%
associate-/r*52.3%
unpow1/252.3%
associate-/r*52.0%
rem-exp-log49.7%
exp-neg49.7%
exp-prod50.9%
distribute-lft-neg-out50.9%
distribute-rgt-neg-in50.9%
metadata-eval50.9%
exp-to-pow53.2%
Simplified53.2%
Taylor expanded in l around -inf 62.2%
distribute-lft-in62.2%
exp-sum62.4%
*-commutative62.4%
exp-to-pow62.7%
mul-1-neg62.7%
*-commutative62.7%
*-commutative62.7%
associate-*l*62.7%
metadata-eval62.7%
exp-to-pow66.7%
Simplified66.7%
if -4.5999999999999998e-138 < d < 2.49999999999999993e-305Initial program 50.4%
Simplified50.4%
Taylor expanded in d around inf 20.3%
add-log-exp44.5%
pow1/244.5%
inv-pow44.5%
pow-pow44.5%
metadata-eval44.5%
Applied egg-rr44.5%
if 2.49999999999999993e-305 < d Initial program 64.1%
Simplified64.1%
Applied egg-rr68.6%
distribute-rgt1-in76.0%
+-commutative76.0%
associate-*l*76.0%
Simplified76.0%
expm1-log1p-u74.3%
expm1-udef53.5%
sqrt-unprod47.7%
*-commutative47.7%
Applied egg-rr47.7%
expm1-def64.8%
expm1-log1p66.0%
Simplified66.0%
Final simplification63.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -7.2e-138)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= d 2.5e-305)
(* d (pow (pow (* h l) 2.0) -0.25))
(*
(+ 1.0 (* (* (/ h l) -0.5) (pow (* M_m (* 0.5 (/ D_m d))) 2.0)))
(/ 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) {
double tmp;
if (d <= -7.2e-138) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (d <= 2.5e-305) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = (1.0 + (((h / l) * -0.5) * pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / sqrt((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-138)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (d <= 2.5d-305) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = (1.0d0 + (((h / l) * (-0.5d0)) * ((m_m * (0.5d0 * (d_m / d))) ** 2.0d0))) * (d / sqrt((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-138) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (d <= 2.5e-305) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = (1.0 + (((h / l) * -0.5) * Math.pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / Math.sqrt((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-138: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif d <= 2.5e-305: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = (1.0 + (((h / l) * -0.5) * math.pow((M_m * (0.5 * (D_m / d))), 2.0))) * (d / math.sqrt((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-138) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (d <= 2.5e-305) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(M_m * Float64(0.5 * Float64(D_m / d))) ^ 2.0))) * Float64(d / sqrt(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 <= -7.2e-138)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (d <= 2.5e-305)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = (1.0 + (((h / l) * -0.5) * ((M_m * (0.5 * (D_m / d))) ^ 2.0))) * (d / sqrt((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-138], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-305], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(M$95$m * N[(0.5 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[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 -7.2 \cdot 10^{-138}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-305}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(M_m \cdot \left(0.5 \cdot \frac{D_m}{d}\right)\right)}^{2}\right) \cdot \frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -7.20000000000000036e-138Initial program 75.5%
Simplified75.6%
frac-2neg75.6%
sqrt-div82.4%
Applied egg-rr82.4%
Taylor expanded in d around -inf 52.0%
mul-1-neg52.0%
distribute-rgt-neg-in52.0%
associate-/r*52.3%
unpow1/252.3%
associate-/r*52.0%
rem-exp-log49.7%
exp-neg49.7%
exp-prod50.9%
distribute-lft-neg-out50.9%
distribute-rgt-neg-in50.9%
metadata-eval50.9%
exp-to-pow53.2%
Simplified53.2%
Taylor expanded in l around -inf 62.2%
distribute-lft-in62.2%
exp-sum62.4%
*-commutative62.4%
exp-to-pow62.7%
mul-1-neg62.7%
*-commutative62.7%
*-commutative62.7%
associate-*l*62.7%
metadata-eval62.7%
exp-to-pow66.7%
Simplified66.7%
if -7.20000000000000036e-138 < d < 2.49999999999999993e-305Initial program 50.4%
Simplified50.4%
Taylor expanded in d around inf 20.3%
add-log-exp44.5%
pow1/244.5%
inv-pow44.5%
pow-pow44.5%
metadata-eval44.5%
Applied egg-rr44.5%
rem-log-exp20.3%
sqr-pow20.3%
pow-prod-down34.3%
pow234.3%
metadata-eval34.3%
Applied egg-rr34.3%
if 2.49999999999999993e-305 < d Initial program 64.1%
Simplified64.1%
Applied egg-rr68.6%
distribute-rgt1-in76.0%
+-commutative76.0%
associate-*l*76.0%
Simplified76.0%
expm1-log1p-u74.3%
expm1-udef53.5%
sqrt-unprod47.7%
*-commutative47.7%
Applied egg-rr47.7%
expm1-def64.8%
expm1-log1p66.0%
Simplified66.0%
Final simplification62.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -6.5e-138)
(* d (* (pow (- h) -0.5) (- (pow (/ -1.0 l) 0.5))))
(if (<= d -2e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* d (* (pow l -0.5) (pow h -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 <= -6.5e-138) {
tmp = d * (pow(-h, -0.5) * -pow((-1.0 / l), 0.5));
} else if (d <= -2e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 <= (-6.5d-138)) then
tmp = d * ((-h ** (-0.5d0)) * -(((-1.0d0) / l) ** 0.5d0))
else if (d <= (-2d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 <= -6.5e-138) {
tmp = d * (Math.pow(-h, -0.5) * -Math.pow((-1.0 / l), 0.5));
} else if (d <= -2e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= -6.5e-138: tmp = d * (math.pow(-h, -0.5) * -math.pow((-1.0 / l), 0.5)) elif d <= -2e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 <= -6.5e-138) tmp = Float64(d * Float64((Float64(-h) ^ -0.5) * Float64(-(Float64(-1.0 / l) ^ 0.5)))); elseif (d <= -2e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 <= -6.5e-138)
tmp = d * ((-h ^ -0.5) * -((-1.0 / l) ^ 0.5));
elseif (d <= -2e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d * ((l ^ -0.5) * (h ^ -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, -6.5e-138], N[(d * N[(N[Power[(-h), -0.5], $MachinePrecision] * (-N[Power[N[(-1.0 / l), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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 -6.5 \cdot 10^{-138}:\\
\;\;\;\;d \cdot \left({\left(-h\right)}^{-0.5} \cdot \left(-{\left(\frac{-1}{\ell}\right)}^{0.5}\right)\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -6.4999999999999999e-138Initial program 75.5%
Simplified75.6%
frac-2neg75.6%
sqrt-div82.4%
Applied egg-rr82.4%
Taylor expanded in d around -inf 52.0%
mul-1-neg52.0%
distribute-rgt-neg-in52.0%
associate-/r*52.3%
unpow1/252.3%
associate-/r*52.0%
rem-exp-log49.7%
exp-neg49.7%
exp-prod50.9%
distribute-lft-neg-out50.9%
distribute-rgt-neg-in50.9%
metadata-eval50.9%
exp-to-pow53.2%
Simplified53.2%
Taylor expanded in l around -inf 62.2%
distribute-lft-in62.2%
exp-sum62.4%
*-commutative62.4%
exp-to-pow62.7%
mul-1-neg62.7%
*-commutative62.7%
*-commutative62.7%
associate-*l*62.7%
metadata-eval62.7%
exp-to-pow66.7%
Simplified66.7%
if -6.4999999999999999e-138 < d < -1.999999999999994e-310Initial program 52.3%
Simplified52.3%
Taylor expanded in d around inf 21.0%
add-log-exp46.2%
pow1/246.2%
inv-pow46.2%
pow-pow46.2%
metadata-eval46.2%
Applied egg-rr46.2%
rem-log-exp21.0%
sqr-pow21.0%
pow-prod-down35.5%
pow235.5%
metadata-eval35.5%
Applied egg-rr35.5%
if -1.999999999999994e-310 < d Initial program 63.6%
Simplified63.6%
frac-2neg63.6%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 41.8%
associate-/r*41.8%
unpow1/241.8%
associate-/r*41.8%
rem-exp-log39.8%
exp-neg39.8%
exp-prod39.8%
distribute-lft-neg-out39.8%
distribute-rgt-neg-in39.8%
metadata-eval39.8%
exp-to-pow41.8%
Simplified41.8%
*-commutative41.8%
unpow-prod-down50.3%
Applied egg-rr50.3%
Final simplification55.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -4.8e-138)
(* d (- (pow (* h l) -0.5)))
(if (<= d -2e-310)
(* d (pow (pow (* h l) 2.0) -0.25))
(* d (* (pow l -0.5) (pow h -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.8e-138) {
tmp = d * -pow((h * l), -0.5);
} else if (d <= -2e-310) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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.8d-138)) then
tmp = d * -((h * l) ** (-0.5d0))
else if (d <= (-2d-310)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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.8e-138) {
tmp = d * -Math.pow((h * l), -0.5);
} else if (d <= -2e-310) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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.8e-138: tmp = d * -math.pow((h * l), -0.5) elif d <= -2e-310: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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.8e-138) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); elseif (d <= -2e-310) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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.8e-138)
tmp = d * -((h * l) ^ -0.5);
elseif (d <= -2e-310)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d * ((l ^ -0.5) * (h ^ -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.8e-138], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], If[LessEqual[d, -2e-310], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $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.8 \cdot 10^{-138}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < -4.7999999999999998e-138Initial program 75.5%
Simplified75.6%
frac-2neg75.6%
sqrt-div82.4%
Applied egg-rr82.4%
Taylor expanded in d around -inf 52.0%
mul-1-neg52.0%
distribute-rgt-neg-in52.0%
associate-/r*52.3%
unpow1/252.3%
associate-/r*52.0%
rem-exp-log49.7%
exp-neg49.7%
exp-prod50.9%
distribute-lft-neg-out50.9%
distribute-rgt-neg-in50.9%
metadata-eval50.9%
exp-to-pow53.2%
Simplified53.2%
if -4.7999999999999998e-138 < d < -1.999999999999994e-310Initial program 52.3%
Simplified52.3%
Taylor expanded in d around inf 21.0%
add-log-exp46.2%
pow1/246.2%
inv-pow46.2%
pow-pow46.2%
metadata-eval46.2%
Applied egg-rr46.2%
rem-log-exp21.0%
sqr-pow21.0%
pow-prod-down35.5%
pow235.5%
metadata-eval35.5%
Applied egg-rr35.5%
if -1.999999999999994e-310 < d Initial program 63.6%
Simplified63.6%
frac-2neg63.6%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 41.8%
associate-/r*41.8%
unpow1/241.8%
associate-/r*41.8%
rem-exp-log39.8%
exp-neg39.8%
exp-prod39.8%
distribute-lft-neg-out39.8%
distribute-rgt-neg-in39.8%
metadata-eval39.8%
exp-to-pow41.8%
Simplified41.8%
*-commutative41.8%
unpow-prod-down50.3%
Applied egg-rr50.3%
Final simplification50.0%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 2.9e-305) (* d (- (pow (* h l) -0.5))) (* d (* (pow l -0.5) (pow h -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 <= 2.9e-305) {
tmp = d * -pow((h * l), -0.5);
} else {
tmp = d * (pow(l, -0.5) * pow(h, -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 <= 2.9d-305) then
tmp = d * -((h * l) ** (-0.5d0))
else
tmp = d * ((l ** (-0.5d0)) * (h ** (-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 <= 2.9e-305) {
tmp = d * -Math.pow((h * l), -0.5);
} else {
tmp = d * (Math.pow(l, -0.5) * Math.pow(h, -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 <= 2.9e-305: tmp = d * -math.pow((h * l), -0.5) else: tmp = d * (math.pow(l, -0.5) * math.pow(h, -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 <= 2.9e-305) tmp = Float64(d * Float64(-(Float64(h * l) ^ -0.5))); else tmp = Float64(d * Float64((l ^ -0.5) * (h ^ -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 <= 2.9e-305)
tmp = d * -((h * l) ^ -0.5);
else
tmp = d * ((l ^ -0.5) * (h ^ -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, 2.9e-305], N[(d * (-N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision])), $MachinePrecision], N[(d * N[(N[Power[l, -0.5], $MachinePrecision] * N[Power[h, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 2.9 \cdot 10^{-305}:\\
\;\;\;\;d \cdot \left(-{\left(h \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \left({\ell}^{-0.5} \cdot {h}^{-0.5}\right)\\
\end{array}
\end{array}
if d < 2.89999999999999988e-305Initial program 70.3%
Simplified70.4%
frac-2neg70.4%
sqrt-div78.7%
Applied egg-rr78.7%
Taylor expanded in d around -inf 45.2%
mul-1-neg45.2%
distribute-rgt-neg-in45.2%
associate-/r*45.4%
unpow1/245.4%
associate-/r*45.2%
rem-exp-log43.1%
exp-neg43.1%
exp-prod44.1%
distribute-lft-neg-out44.1%
distribute-rgt-neg-in44.1%
metadata-eval44.1%
exp-to-pow46.1%
Simplified46.1%
if 2.89999999999999988e-305 < d Initial program 64.1%
Simplified64.1%
frac-2neg64.1%
sqrt-div0.0%
Applied egg-rr0.0%
Taylor expanded in d around inf 42.1%
associate-/r*42.1%
unpow1/242.1%
associate-/r*42.1%
rem-exp-log40.1%
exp-neg40.1%
exp-prod40.1%
distribute-lft-neg-out40.1%
distribute-rgt-neg-in40.1%
metadata-eval40.1%
exp-to-pow42.1%
Simplified42.1%
*-commutative42.1%
unpow-prod-down50.7%
Applied egg-rr50.7%
Final simplification48.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 (* h l) -0.5))) (if (<= d -5.7e-208) (* 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 = pow((h * l), -0.5);
double tmp;
if (d <= -5.7e-208) {
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 = (h * l) ** (-0.5d0)
if (d <= (-5.7d-208)) 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.pow((h * l), -0.5);
double tmp;
if (d <= -5.7e-208) {
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.pow((h * l), -0.5) tmp = 0 if d <= -5.7e-208: 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 = Float64(h * l) ^ -0.5 tmp = 0.0 if (d <= -5.7e-208) tmp = Float64(d * Float64(-t_0)); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (h * l) ^ -0.5;
tmp = 0.0;
if (d <= -5.7e-208)
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[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]}, If[LessEqual[d, -5.7e-208], 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 := {\left(h \cdot \ell\right)}^{-0.5}\\
\mathbf{if}\;d \leq -5.7 \cdot 10^{-208}:\\
\;\;\;\;d \cdot \left(-t_0\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot t_0\\
\end{array}
\end{array}
if d < -5.7000000000000004e-208Initial program 73.3%
Simplified73.3%
frac-2neg73.3%
sqrt-div80.9%
Applied egg-rr80.9%
Taylor expanded in d around -inf 49.8%
mul-1-neg49.8%
distribute-rgt-neg-in49.8%
associate-/r*50.1%
unpow1/250.1%
associate-/r*49.8%
rem-exp-log47.6%
exp-neg47.6%
exp-prod48.6%
distribute-lft-neg-out48.6%
distribute-rgt-neg-in48.6%
metadata-eval48.6%
exp-to-pow50.9%
Simplified50.9%
if -5.7000000000000004e-208 < d Initial program 62.2%
Simplified62.2%
frac-2neg62.2%
sqrt-div6.7%
Applied egg-rr6.7%
Taylor expanded in d around inf 39.9%
associate-/r*39.9%
unpow1/239.9%
associate-/r*39.9%
rem-exp-log38.1%
exp-neg38.1%
exp-prod38.1%
distribute-lft-neg-out38.1%
distribute-rgt-neg-in38.1%
metadata-eval38.1%
exp-to-pow39.9%
Simplified39.9%
Final simplification45.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 (* 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) {
return d * pow((h * l), -0.5);
}
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 * ((h * l) ** (-0.5d0))
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.pow((h * l), -0.5);
}
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.pow((h * l), -0.5)
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 * (Float64(h * l) ^ -0.5)) 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 * ((h * l) ^ -0.5);
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[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])\\
\\
d \cdot {\left(h \cdot \ell\right)}^{-0.5}
\end{array}
Initial program 67.4%
Simplified67.4%
frac-2neg67.4%
sqrt-div41.5%
Applied egg-rr41.5%
Taylor expanded in d around inf 25.9%
associate-/r*25.9%
unpow1/225.9%
associate-/r*25.9%
rem-exp-log25.0%
exp-neg25.0%
exp-prod24.6%
distribute-lft-neg-out24.6%
distribute-rgt-neg-in24.6%
metadata-eval24.6%
exp-to-pow25.6%
Simplified25.6%
Final simplification25.6%
herbie shell --seed 2023331
(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)))))