
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 30 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
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))) (t_1 (* (sqrt l) (sqrt h))) (t_2 (sqrt (- d))))
(if (<= d -9.5e-211)
(*
(sqrt (/ d h))
(* (/ t_2 (sqrt (- l))) (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0)))
(if (<= d -7.8e-308)
(*
(/ t_2 (sqrt (- h)))
(* (sqrt (/ d l)) (fma (/ (pow t_0 2.0) l) (* h -0.125) 1.0)))
(if (<= d 2.2e-200)
(*
d
(/
(fma
(* (/ h l) -0.5)
(pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0)
1.0)
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double t_2 = sqrt(-d);
double tmp;
if (d <= -9.5e-211) {
tmp = sqrt((d / h)) * ((t_2 / sqrt(-l)) * fma((t_0 * (t_0 / l)), (h * -0.125), 1.0));
} else if (d <= -7.8e-308) {
tmp = (t_2 / sqrt(-h)) * (sqrt((d / l)) * fma((pow(t_0, 2.0) / l), (h * -0.125), 1.0));
} else if (d <= 2.2e-200) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -9.5e-211) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_2 / sqrt(Float64(-l))) * fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0))); elseif (d <= -7.8e-308) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(sqrt(Float64(d / l)) * fma(Float64((t_0 ^ 2.0) / l), Float64(h * -0.125), 1.0))); elseif (d <= 2.2e-200) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -9.5e-211], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.8e-308], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.2e-200], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;d \leq -9.5 \cdot 10^{-211}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right)\right)\\
\mathbf{elif}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{{t\_0}^{2}}{\ell}, h \cdot -0.125, 1\right)\right)\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{-200}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -9.50000000000000008e-211Initial program 73.3%
Simplified73.3%
Taylor expanded in M around 0 45.8%
+-commutative45.8%
associate-*r/45.8%
associate-*r*47.5%
associate-*r*47.5%
associate-*l/48.1%
associate-*r/48.1%
*-commutative48.1%
associate-*l*48.1%
fma-define48.1%
Simplified76.9%
associate-*r/76.9%
pow276.9%
associate-/l*77.8%
associate-*r/77.8%
associate-*r/78.6%
Applied egg-rr78.6%
frac-2neg78.6%
sqrt-div87.7%
Applied egg-rr87.7%
if -9.50000000000000008e-211 < d < -7.7999999999999999e-308Initial program 43.7%
Simplified37.5%
Taylor expanded in M around 0 12.5%
+-commutative12.5%
associate-*r/12.5%
associate-*r*12.5%
associate-*r*12.5%
associate-*l/12.5%
associate-*r/12.5%
*-commutative12.5%
associate-*l*12.5%
fma-define12.5%
Simplified37.8%
frac-2neg37.8%
sqrt-div75.6%
Applied egg-rr75.6%
if -7.7999999999999999e-308 < d < 2.20000000000000013e-200Initial program 36.9%
Simplified36.9%
Applied egg-rr44.5%
unpow144.5%
associate-*l/66.5%
associate-/l*66.5%
+-commutative66.5%
associate-*r*66.5%
fma-define66.5%
*-commutative66.5%
associate-*r/66.5%
*-commutative66.5%
Simplified66.5%
div-inv66.6%
Applied egg-rr66.6%
if 2.20000000000000013e-200 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification86.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d)))
(t_1 (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0))
(t_2 (* (sqrt l) (sqrt h)))
(t_3 (sqrt (- d))))
(if (<= d -1.15e-210)
(* (sqrt (/ d h)) (* (/ t_3 (sqrt (- l))) t_1))
(if (<= d -7.8e-308)
(* (/ t_3 (sqrt (- h))) (* t_1 (sqrt (/ d l))))
(if (<= d 6.5e-199)
(*
d
(/
(fma
(* (/ h l) -0.5)
(pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0)
1.0)
t_2))
(*
(/ d t_2)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = fma((t_0 * (t_0 / l)), (h * -0.125), 1.0);
double t_2 = sqrt(l) * sqrt(h);
double t_3 = sqrt(-d);
double tmp;
if (d <= -1.15e-210) {
tmp = sqrt((d / h)) * ((t_3 / sqrt(-l)) * t_1);
} else if (d <= -7.8e-308) {
tmp = (t_3 / sqrt(-h)) * (t_1 * sqrt((d / l)));
} else if (d <= 6.5e-199) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_2);
} else {
tmp = (d / t_2) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0) t_2 = Float64(sqrt(l) * sqrt(h)) t_3 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -1.15e-210) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_3 / sqrt(Float64(-l))) * t_1)); elseif (d <= -7.8e-308) tmp = Float64(Float64(t_3 / sqrt(Float64(-h))) * Float64(t_1 * sqrt(Float64(d / l)))); elseif (d <= 6.5e-199) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_2)); else tmp = Float64(Float64(d / t_2) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -1.15e-210], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$3 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.8e-308], N[(N[(t$95$3 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.5e-199], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$2), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right)\\
t_2 := \sqrt{\ell} \cdot \sqrt{h}\\
t_3 := \sqrt{-d}\\
\mathbf{if}\;d \leq -1.15 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_3}{\sqrt{-\ell}} \cdot t\_1\right)\\
\mathbf{elif}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{t\_3}{\sqrt{-h}} \cdot \left(t\_1 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq 6.5 \cdot 10^{-199}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_2} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -1.15e-210Initial program 73.3%
Simplified73.3%
Taylor expanded in M around 0 45.8%
+-commutative45.8%
associate-*r/45.8%
associate-*r*47.5%
associate-*r*47.5%
associate-*l/48.1%
associate-*r/48.1%
*-commutative48.1%
associate-*l*48.1%
fma-define48.1%
Simplified76.9%
associate-*r/76.9%
pow276.9%
associate-/l*77.8%
associate-*r/77.8%
associate-*r/78.6%
Applied egg-rr78.6%
frac-2neg78.6%
sqrt-div87.7%
Applied egg-rr87.7%
if -1.15e-210 < d < -7.7999999999999999e-308Initial program 43.7%
Simplified37.5%
Taylor expanded in M around 0 12.5%
+-commutative12.5%
associate-*r/12.5%
associate-*r*12.5%
associate-*r*12.5%
associate-*l/12.5%
associate-*r/12.5%
*-commutative12.5%
associate-*l*12.5%
fma-define12.5%
Simplified37.8%
associate-*r/37.8%
pow237.8%
associate-/l*37.8%
associate-*r/37.8%
associate-*r/37.8%
Applied egg-rr37.8%
frac-2neg37.8%
sqrt-div75.6%
Applied egg-rr75.6%
if -7.7999999999999999e-308 < d < 6.50000000000000017e-199Initial program 36.9%
Simplified36.9%
Applied egg-rr44.5%
unpow144.5%
associate-*l/66.5%
associate-/l*66.5%
+-commutative66.5%
associate-*r*66.5%
fma-define66.5%
*-commutative66.5%
associate-*r/66.5%
*-commutative66.5%
Simplified66.5%
div-inv66.6%
Applied egg-rr66.6%
if 6.50000000000000017e-199 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification86.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))) (t_1 (* (sqrt l) (sqrt h))) (t_2 (sqrt (- d))))
(if (<= d -7.5e-211)
(*
(sqrt (/ d h))
(* (/ t_2 (sqrt (- l))) (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0)))
(if (<= d -7.8e-308)
(*
(sqrt (/ d l))
(*
(/ t_2 (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(if (<= d 5.8e-198)
(*
d
(/
(fma
(* (/ h l) -0.5)
(pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0)
1.0)
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double t_2 = sqrt(-d);
double tmp;
if (d <= -7.5e-211) {
tmp = sqrt((d / h)) * ((t_2 / sqrt(-l)) * fma((t_0 * (t_0 / l)), (h * -0.125), 1.0));
} else if (d <= -7.8e-308) {
tmp = sqrt((d / l)) * ((t_2 / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else if (d <= 5.8e-198) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -7.5e-211) tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(t_2 / sqrt(Float64(-l))) * fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0))); elseif (d <= -7.8e-308) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); elseif (d <= 5.8e-198) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -7.5e-211], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.8e-308], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e-198], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-211}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right)\right)\\
\mathbf{elif}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_2}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.5000000000000003e-211Initial program 73.3%
Simplified73.3%
Taylor expanded in M around 0 45.8%
+-commutative45.8%
associate-*r/45.8%
associate-*r*47.5%
associate-*r*47.5%
associate-*l/48.1%
associate-*r/48.1%
*-commutative48.1%
associate-*l*48.1%
fma-define48.1%
Simplified76.9%
associate-*r/76.9%
pow276.9%
associate-/l*77.8%
associate-*r/77.8%
associate-*r/78.6%
Applied egg-rr78.6%
frac-2neg78.6%
sqrt-div87.7%
Applied egg-rr87.7%
if -7.5000000000000003e-211 < d < -7.7999999999999999e-308Initial program 43.7%
Simplified43.7%
frac-2neg37.8%
sqrt-div75.6%
Applied egg-rr75.6%
if -7.7999999999999999e-308 < d < 5.80000000000000001e-198Initial program 36.9%
Simplified36.9%
Applied egg-rr44.5%
unpow144.5%
associate-*l/66.5%
associate-/l*66.5%
+-commutative66.5%
associate-*r*66.5%
fma-define66.5%
*-commutative66.5%
associate-*r/66.5%
*-commutative66.5%
Simplified66.5%
div-inv66.6%
Applied egg-rr66.6%
if 5.80000000000000001e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification86.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0)))))
(t_1 (* (sqrt l) (sqrt h)))
(t_2 (sqrt (- d))))
(if (<= d -1.4e-209)
(* (/ t_2 (sqrt (- l))) (* (sqrt (/ d h)) t_0))
(if (<= d -7.8e-308)
(* (sqrt (/ d l)) (* (/ t_2 (sqrt (- h))) t_0))
(if (<= d 4e-198)
(*
d
(/
(fma
(* (/ h l) -0.5)
(pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0)
1.0)
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 = 1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)));
double t_1 = sqrt(l) * sqrt(h);
double t_2 = sqrt(-d);
double tmp;
if (d <= -1.4e-209) {
tmp = (t_2 / sqrt(-l)) * (sqrt((d / h)) * t_0);
} else if (d <= -7.8e-308) {
tmp = sqrt((d / l)) * ((t_2 / sqrt(-h)) * t_0);
} else if (d <= 4e-198) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / 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(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))) t_1 = Float64(sqrt(l) * sqrt(h)) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -1.4e-209) tmp = Float64(Float64(t_2 / sqrt(Float64(-l))) * Float64(sqrt(Float64(d / h)) * t_0)); elseif (d <= -7.8e-308) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(t_2 / sqrt(Float64(-h))) * t_0)); elseif (d <= 4e-198) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -1.4e-209], N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.8e-308], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4e-198], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := 1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;d \leq -1.4 \cdot 10^{-209}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot t\_0\right)\\
\mathbf{elif}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{t\_2}{\sqrt{-h}} \cdot t\_0\right)\\
\mathbf{elif}\;d \leq 4 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -1.40000000000000006e-209Initial program 73.3%
Simplified73.3%
frac-2neg78.6%
sqrt-div87.7%
Applied egg-rr81.6%
if -1.40000000000000006e-209 < d < -7.7999999999999999e-308Initial program 43.7%
Simplified43.7%
frac-2neg37.8%
sqrt-div75.6%
Applied egg-rr75.6%
if -7.7999999999999999e-308 < d < 3.9999999999999996e-198Initial program 36.9%
Simplified36.9%
Applied egg-rr44.5%
unpow144.5%
associate-*l/66.5%
associate-/l*66.5%
+-commutative66.5%
associate-*r*66.5%
fma-define66.5%
*-commutative66.5%
associate-*r/66.5%
*-commutative66.5%
Simplified66.5%
div-inv66.6%
Applied egg-rr66.6%
if 3.9999999999999996e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification84.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -7.5e-157)
(*
(sqrt (/ d h))
(* (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0) (sqrt (/ d l))))
(if (<= d -2e-310)
(*
-0.125
(pow
(* (pow (* h (pow l -3.0)) 0.25) (* D_m (/ M_m (sqrt (- d)))))
2.0))
(if (<= d 1.6e-198)
(*
d
(/
(fma
(* (/ h l) -0.5)
(pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0)
1.0)
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -7.5e-157) {
tmp = sqrt((d / h)) * (fma((t_0 * (t_0 / l)), (h * -0.125), 1.0) * sqrt((d / l)));
} else if (d <= -2e-310) {
tmp = -0.125 * pow((pow((h * pow(l, -3.0)), 0.25) * (D_m * (M_m / sqrt(-d)))), 2.0);
} else if (d <= 1.6e-198) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.5e-157) tmp = Float64(sqrt(Float64(d / h)) * Float64(fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0) * sqrt(Float64(d / l)))); elseif (d <= -2e-310) tmp = Float64(-0.125 * (Float64((Float64(h * (l ^ -3.0)) ^ 0.25) * Float64(D_m * Float64(M_m / sqrt(Float64(-d))))) ^ 2.0)); elseif (d <= 1.6e-198) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.5e-157], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(-0.125 * N[Power[N[(N[Power[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision] * N[(D$95$m * N[(M$95$m / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.6e-198], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-157}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.125 \cdot {\left({\left(h \cdot {\ell}^{-3}\right)}^{0.25} \cdot \left(D\_m \cdot \frac{M\_m}{\sqrt{-d}}\right)\right)}^{2}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.500000000000001e-157Initial program 77.5%
Simplified77.5%
Taylor expanded in M around 0 46.6%
+-commutative46.6%
associate-*r/46.6%
associate-*r*48.5%
associate-*r*48.5%
associate-*l/49.3%
associate-*r/49.3%
*-commutative49.3%
associate-*l*49.3%
fma-define49.3%
Simplified81.6%
associate-*r/81.5%
pow281.5%
associate-/l*82.5%
associate-*r/82.5%
associate-*r/83.5%
Applied egg-rr83.5%
if -7.500000000000001e-157 < d < -1.999999999999994e-310Initial program 41.1%
Simplified37.7%
Taylor expanded in h around -inf 0.0%
associate-/l*0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt54.3%
associate-/l*54.3%
mul-1-neg54.3%
Simplified54.3%
add-sqr-sqrt54.2%
pow254.2%
Applied egg-rr57.9%
*-commutative57.9%
associate-*l*60.8%
Simplified60.8%
if -1.999999999999994e-310 < d < 1.59999999999999997e-198Initial program 38.4%
Simplified38.4%
Applied egg-rr46.3%
unpow146.3%
associate-*l/69.2%
associate-/l*69.2%
+-commutative69.2%
associate-*r*69.2%
fma-define69.2%
*-commutative69.2%
associate-*r/69.2%
*-commutative69.2%
Simplified69.2%
div-inv69.3%
Applied egg-rr69.3%
if 1.59999999999999997e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
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 l) (sqrt h))))
(if (<= d -7.8e-308)
(*
(sqrt (/ d l))
(*
(/ (sqrt (- d)) (sqrt (- h)))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(if (<= d 5.8e-198)
(*
d
(/
(fma (* (/ h l) -0.5) (pow (* (* D_m M_m) (/ 1.0 (* d 2.0))) 2.0) 1.0)
t_0))
(*
(/ d t_0)
(+ 1.0 (* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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(l) * sqrt(h);
double tmp;
if (d <= -7.8e-308) {
tmp = sqrt((d / l)) * ((sqrt(-d) / sqrt(-h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else if (d <= 5.8e-198) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) * (1.0 / (d * 2.0))), 2.0), 1.0) / t_0);
} else {
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.8e-308) tmp = Float64(sqrt(Float64(d / l)) * Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); elseif (d <= 5.8e-198) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) * Float64(1.0 / Float64(d * 2.0))) ^ 2.0), 1.0) / t_0)); else tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.8e-308], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e-198], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] * N[(1.0 / N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.8 \cdot 10^{-308}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 5.8 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\left(D\_m \cdot M\_m\right) \cdot \frac{1}{d \cdot 2}\right)}^{2}, 1\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.7999999999999999e-308Initial program 69.6%
Simplified69.6%
frac-2neg72.1%
sqrt-div80.5%
Applied egg-rr77.3%
if -7.7999999999999999e-308 < d < 5.80000000000000001e-198Initial program 36.9%
Simplified36.9%
Applied egg-rr44.5%
unpow144.5%
associate-*l/66.5%
associate-/l*66.5%
+-commutative66.5%
associate-*r*66.5%
fma-define66.5%
*-commutative66.5%
associate-*r/66.5%
*-commutative66.5%
Simplified66.5%
div-inv66.6%
Applied egg-rr66.6%
if 5.80000000000000001e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification82.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -7e-155)
(*
(sqrt (/ d h))
(* (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0) (sqrt (/ d l))))
(if (<= d -2e-310)
(*
-0.125
(pow
(* (pow (* h (pow l -3.0)) 0.25) (* D_m (/ M_m (sqrt (- d)))))
2.0))
(if (<= d 2.05e-199)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -7e-155) {
tmp = sqrt((d / h)) * (fma((t_0 * (t_0 / l)), (h * -0.125), 1.0) * sqrt((d / l)));
} else if (d <= -2e-310) {
tmp = -0.125 * pow((pow((h * pow(l, -3.0)), 0.25) * (D_m * (M_m / sqrt(-d)))), 2.0);
} else if (d <= 2.05e-199) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7e-155) tmp = Float64(sqrt(Float64(d / h)) * Float64(fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0) * sqrt(Float64(d / l)))); elseif (d <= -2e-310) tmp = Float64(-0.125 * (Float64((Float64(h * (l ^ -3.0)) ^ 0.25) * Float64(D_m * Float64(M_m / sqrt(Float64(-d))))) ^ 2.0)); elseif (d <= 2.05e-199) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7e-155], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(-0.125 * N[Power[N[(N[Power[N[(h * N[Power[l, -3.0], $MachinePrecision]), $MachinePrecision], 0.25], $MachinePrecision] * N[(D$95$m * N[(M$95$m / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.05e-199], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7 \cdot 10^{-155}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.125 \cdot {\left({\left(h \cdot {\ell}^{-3}\right)}^{0.25} \cdot \left(D\_m \cdot \frac{M\_m}{\sqrt{-d}}\right)\right)}^{2}\\
\mathbf{elif}\;d \leq 2.05 \cdot 10^{-199}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.00000000000000031e-155Initial program 77.5%
Simplified77.5%
Taylor expanded in M around 0 46.6%
+-commutative46.6%
associate-*r/46.6%
associate-*r*48.5%
associate-*r*48.5%
associate-*l/49.3%
associate-*r/49.3%
*-commutative49.3%
associate-*l*49.3%
fma-define49.3%
Simplified81.6%
associate-*r/81.5%
pow281.5%
associate-/l*82.5%
associate-*r/82.5%
associate-*r/83.5%
Applied egg-rr83.5%
if -7.00000000000000031e-155 < d < -1.999999999999994e-310Initial program 41.1%
Simplified37.7%
Taylor expanded in h around -inf 0.0%
associate-/l*0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt54.3%
associate-/l*54.3%
mul-1-neg54.3%
Simplified54.3%
add-sqr-sqrt54.2%
pow254.2%
Applied egg-rr57.9%
*-commutative57.9%
associate-*l*60.8%
Simplified60.8%
if -1.999999999999994e-310 < d < 2.05000000000000011e-199Initial program 38.4%
Simplified38.4%
Applied egg-rr46.3%
unpow146.3%
associate-*l/69.2%
associate-/l*69.2%
+-commutative69.2%
associate-*r*69.2%
fma-define69.2%
*-commutative69.2%
associate-*r/69.2%
*-commutative69.2%
Simplified69.2%
fma-undefine69.2%
associate-/l*65.4%
*-commutative65.4%
associate-/l/65.4%
associate-*l*65.4%
div-inv65.4%
metadata-eval65.4%
Applied egg-rr65.4%
if 2.05000000000000011e-199 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification82.8%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -7.6e-159)
(*
(sqrt (/ d h))
(* (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0) (sqrt (/ d l))))
(if (<= d -2e-310)
(*
-0.125
(* (pow D_m 2.0) (* (/ (pow M_m 2.0) d) (- (sqrt (/ h (pow l 3.0)))))))
(if (<= d 2e-200)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -7.6e-159) {
tmp = sqrt((d / h)) * (fma((t_0 * (t_0 / l)), (h * -0.125), 1.0) * sqrt((d / l)));
} else if (d <= -2e-310) {
tmp = -0.125 * (pow(D_m, 2.0) * ((pow(M_m, 2.0) / d) * -sqrt((h / pow(l, 3.0)))));
} else if (d <= 2e-200) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.6e-159) tmp = Float64(sqrt(Float64(d / h)) * Float64(fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0) * sqrt(Float64(d / l)))); elseif (d <= -2e-310) tmp = Float64(-0.125 * Float64((D_m ^ 2.0) * Float64(Float64((M_m ^ 2.0) / d) * Float64(-sqrt(Float64(h / (l ^ 3.0))))))); elseif (d <= 2e-200) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.6e-159], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2e-310], N[(-0.125 * N[(N[Power[D$95$m, 2.0], $MachinePrecision] * N[(N[(N[Power[M$95$m, 2.0], $MachinePrecision] / d), $MachinePrecision] * (-N[Sqrt[N[(h / N[Power[l, 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2e-200], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.6 \cdot 10^{-159}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq -2 \cdot 10^{-310}:\\
\;\;\;\;-0.125 \cdot \left({D\_m}^{2} \cdot \left(\frac{{M\_m}^{2}}{d} \cdot \left(-\sqrt{\frac{h}{{\ell}^{3}}}\right)\right)\right)\\
\mathbf{elif}\;d \leq 2 \cdot 10^{-200}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.6000000000000002e-159Initial program 77.5%
Simplified77.5%
Taylor expanded in M around 0 46.6%
+-commutative46.6%
associate-*r/46.6%
associate-*r*48.5%
associate-*r*48.5%
associate-*l/49.3%
associate-*r/49.3%
*-commutative49.3%
associate-*l*49.3%
fma-define49.3%
Simplified81.6%
associate-*r/81.5%
pow281.5%
associate-/l*82.5%
associate-*r/82.5%
associate-*r/83.5%
Applied egg-rr83.5%
if -7.6000000000000002e-159 < d < -1.999999999999994e-310Initial program 41.1%
Simplified37.7%
Taylor expanded in h around -inf 0.0%
associate-/l*0.0%
associate-*l*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt54.3%
associate-/l*54.3%
mul-1-neg54.3%
Simplified54.3%
if -1.999999999999994e-310 < d < 2e-200Initial program 38.4%
Simplified38.4%
Applied egg-rr46.3%
unpow146.3%
associate-*l/69.2%
associate-/l*69.2%
+-commutative69.2%
associate-*r*69.2%
fma-define69.2%
*-commutative69.2%
associate-*r/69.2%
*-commutative69.2%
Simplified69.2%
fma-undefine69.2%
associate-/l*65.4%
*-commutative65.4%
associate-/l/65.4%
associate-*l*65.4%
div-inv65.4%
metadata-eval65.4%
Applied egg-rr65.4%
if 2e-200 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification82.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (/ M_m d)) 2.0)) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -8.2e+203)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= d -1.65e-137)
(* (fma (/ t_0 l) (* h -0.125) 1.0) (sqrt (/ (* d (/ d h)) l)))
(if (<= d -7.5e-278)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (* -0.125 (* t_0 (/ h l)))))
(if (<= d 1.15e-198)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_1))
(*
(/ d t_1)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) l))))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m / d)), 2.0);
double t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -8.2e+203) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (d <= -1.65e-137) {
tmp = fma((t_0 / l), (h * -0.125), 1.0) * sqrt(((d * (d / h)) / l));
} else if (d <= -7.5e-278) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (-0.125 * (t_0 * (h / l))));
} else if (d <= 1.15e-198) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -8.2e+203) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (d <= -1.65e-137) tmp = Float64(fma(Float64(t_0 / l), Float64(h * -0.125), 1.0) * sqrt(Float64(Float64(d * Float64(d / h)) / l))); elseif (d <= -7.5e-278) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(-0.125 * Float64(t_0 * Float64(h / l))))); elseif (d <= 1.15e-198) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e+203], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.65e-137], N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-278], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-198], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -8.2 \cdot 10^{+203}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -1.65 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d \cdot \frac{d}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -8.20000000000000033e203Initial program 69.0%
Simplified69.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt80.6%
neg-mul-180.6%
Simplified80.6%
if -8.20000000000000033e203 < d < -1.6500000000000001e-137Initial program 79.6%
Simplified79.6%
Taylor expanded in M around 0 51.1%
+-commutative51.1%
associate-*r/51.1%
associate-*r*52.3%
associate-*r*52.3%
associate-*l/52.3%
associate-*r/52.3%
*-commutative52.3%
associate-*l*52.3%
fma-define52.3%
Simplified82.3%
associate-*r/82.2%
pow282.2%
associate-/l*83.5%
associate-*r/83.5%
associate-*r/84.7%
Applied egg-rr84.7%
pow184.7%
associate-*r*84.7%
pow1/284.7%
pow1/284.7%
pow-prod-down76.7%
associate-*r/75.4%
pow275.4%
associate-*r/75.4%
*-commutative75.4%
Applied egg-rr75.4%
unpow175.4%
unpow1/275.4%
associate-*r/78.2%
associate-/l*78.2%
*-commutative78.2%
Simplified78.2%
if -1.6500000000000001e-137 < d < -7.49999999999999946e-278Initial program 49.4%
Simplified45.6%
Taylor expanded in M around inf 30.2%
associate-*r*30.2%
times-frac30.2%
*-commutative30.2%
associate-/l*30.3%
unpow230.3%
unpow230.3%
unpow230.3%
times-frac38.2%
swap-sqr42.0%
unpow242.0%
associate-*r/45.8%
*-commutative45.8%
associate-/l*45.8%
Simplified45.8%
if -7.49999999999999946e-278 < d < 1.15000000000000007e-198Initial program 33.1%
Simplified33.1%
Applied egg-rr39.9%
unpow139.9%
associate-*l/59.6%
associate-/l*59.7%
+-commutative59.7%
associate-*r*59.7%
fma-define59.7%
*-commutative59.7%
associate-*r/59.7%
*-commutative59.7%
Simplified59.7%
fma-undefine59.7%
associate-/l*56.4%
*-commutative56.4%
associate-/l/56.4%
associate-*l*56.4%
div-inv56.4%
metadata-eval56.4%
Applied egg-rr56.4%
if 1.15000000000000007e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification78.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (sqrt l) (sqrt h))))
(if (<= d -7.6e+258)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= d -7.5e-278)
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (/ (/ M_m 2.0) d)) 2.0))))))
(if (<= d 2.4e-199)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_0))
(*
(/ d t_0)
(+
1.0
(* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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(l) * sqrt(h);
double tmp;
if (d <= -7.6e+258) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (d <= -7.5e-278) {
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else if (d <= 2.4e-199) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0);
} else {
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(l) * sqrt(h)
if (d <= (-7.6d+258)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (d <= (-7.5d-278)) then
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / 2.0d0) / d)) ** 2.0d0)))))
else if (d <= 2.4d-199) then
tmp = d * ((1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / d) * 0.5d0)) ** 2.0d0)))) / t_0)
else
tmp = (d / t_0) * (1.0d0 + (h * (((-0.5d0) * (((2.0d0 * (d / d_m)) / m_m) ** (-2.0d0))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(l) * Math.sqrt(h);
double tmp;
if (d <= -7.6e+258) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (d <= -7.5e-278) {
tmp = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / 2.0) / d)), 2.0)))));
} else if (d <= 2.4e-199) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0);
} else {
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * Math.pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(l) * math.sqrt(h) tmp = 0 if d <= -7.6e+258: tmp = -d * math.sqrt(((1.0 / h) / l)) elif d <= -7.5e-278: tmp = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / 2.0) / d)), 2.0))))) elif d <= 2.4e-199: tmp = d * ((1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0) else: tmp = (d / t_0) * (1.0 + (h * ((-0.5 * math.pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.6e+258) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (d <= -7.5e-278) tmp = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / 2.0) / d)) ^ 2.0)))))); elseif (d <= 2.4e-199) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_0)); else tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(l) * sqrt(h);
tmp = 0.0;
if (d <= -7.6e+258)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (d <= -7.5e-278)
tmp = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / 2.0) / d)) ^ 2.0)))));
elseif (d <= 2.4e-199)
tmp = d * ((1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / d) * 0.5)) ^ 2.0)))) / t_0);
else
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * (((2.0 * (d / D_m)) / M_m) ^ -2.0)) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.6e+258], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-278], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / 2.0), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-199], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.6 \cdot 10^{+258}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{2}}{d}\right)}^{2}\right)\right)\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-199}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.60000000000000018e258Initial program 45.7%
Simplified45.7%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt100.0%
neg-mul-1100.0%
Simplified100.0%
if -7.60000000000000018e258 < d < -7.49999999999999946e-278Initial program 73.2%
Simplified73.2%
if -7.49999999999999946e-278 < d < 2.39999999999999996e-199Initial program 33.1%
Simplified33.1%
Applied egg-rr39.9%
unpow139.9%
associate-*l/59.6%
associate-/l*59.7%
+-commutative59.7%
associate-*r*59.7%
fma-define59.7%
*-commutative59.7%
associate-*r/59.7%
*-commutative59.7%
Simplified59.7%
fma-undefine59.7%
associate-/l*56.4%
*-commutative56.4%
associate-/l/56.4%
associate-*l*56.4%
div-inv56.4%
metadata-eval56.4%
Applied egg-rr56.4%
if 2.39999999999999996e-199 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification80.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (pow (* D_m (/ M_m d)) 2.0)))
(if (<= d -3.8e+206)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= d -9.5e-138)
(* (fma (/ t_0 l) (* h -0.125) 1.0) (sqrt (/ (* d (/ d h)) l)))
(if (<= d -7.5e-278)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (* -0.125 (* t_0 (/ h l)))))
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
(* (sqrt l) (sqrt h)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m / d)), 2.0);
double tmp;
if (d <= -3.8e+206) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (d <= -9.5e-138) {
tmp = fma((t_0 / l), (h * -0.125), 1.0) * sqrt(((d * (d / h)) / l));
} else if (d <= -7.5e-278) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (-0.125 * (t_0 * (h / l))));
} else {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / (sqrt(l) * sqrt(h)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -3.8e+206) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (d <= -9.5e-138) tmp = Float64(fma(Float64(t_0 / l), Float64(h * -0.125), 1.0) * sqrt(Float64(Float64(d * Float64(d / h)) / l))); elseif (d <= -7.5e-278) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(-0.125 * Float64(t_0 * Float64(h / l))))); else tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / Float64(sqrt(l) * sqrt(h)))); end return tmp end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -3.8e+206], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -9.5e-138], N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.5e-278], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{+206}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -9.5 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d \cdot \frac{d}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -7.5 \cdot 10^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.7999999999999999e206Initial program 69.0%
Simplified69.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt80.6%
neg-mul-180.6%
Simplified80.6%
if -3.7999999999999999e206 < d < -9.49999999999999997e-138Initial program 79.6%
Simplified79.6%
Taylor expanded in M around 0 51.1%
+-commutative51.1%
associate-*r/51.1%
associate-*r*52.3%
associate-*r*52.3%
associate-*l/52.3%
associate-*r/52.3%
*-commutative52.3%
associate-*l*52.3%
fma-define52.3%
Simplified82.3%
associate-*r/82.2%
pow282.2%
associate-/l*83.5%
associate-*r/83.5%
associate-*r/84.7%
Applied egg-rr84.7%
pow184.7%
associate-*r*84.7%
pow1/284.7%
pow1/284.7%
pow-prod-down76.7%
associate-*r/75.4%
pow275.4%
associate-*r/75.4%
*-commutative75.4%
Applied egg-rr75.4%
unpow175.4%
unpow1/275.4%
associate-*r/78.2%
associate-/l*78.2%
*-commutative78.2%
Simplified78.2%
if -9.49999999999999997e-138 < d < -7.49999999999999946e-278Initial program 49.4%
Simplified45.6%
Taylor expanded in M around inf 30.2%
associate-*r*30.2%
times-frac30.2%
*-commutative30.2%
associate-/l*30.3%
unpow230.3%
unpow230.3%
unpow230.3%
times-frac38.2%
swap-sqr42.0%
unpow242.0%
associate-*r/45.8%
*-commutative45.8%
associate-/l*45.8%
Simplified45.8%
if -7.49999999999999946e-278 < d Initial program 70.4%
Simplified69.6%
Applied egg-rr76.4%
unpow176.4%
associate-*l/79.4%
associate-/l*80.7%
+-commutative80.7%
associate-*r*80.7%
fma-define80.7%
*-commutative80.7%
associate-*r/81.5%
*-commutative81.5%
Simplified81.5%
fma-undefine81.5%
associate-/l*80.8%
*-commutative80.8%
associate-/l/80.8%
associate-*l*80.8%
div-inv80.8%
metadata-eval80.8%
Applied egg-rr80.8%
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
(let* ((t_0 (pow (* D_m (/ M_m d)) 2.0)))
(if (<= d -3.6e+206)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= d -2.6e-137)
(* (fma (/ t_0 l) (* h -0.125) 1.0) (sqrt (/ (* d (/ d h)) l)))
(if (<= d 2.7e-286)
(* (sqrt (/ d h)) (* (sqrt (/ d l)) (* -0.125 (* t_0 (/ h l)))))
(*
(/ d (* (sqrt l) (sqrt h)))
(+ 1.0 (* t_0 (/ (* h -0.125) l)))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((D_m * (M_m / d)), 2.0);
double tmp;
if (d <= -3.6e+206) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (d <= -2.6e-137) {
tmp = fma((t_0 / l), (h * -0.125), 1.0) * sqrt(((d * (d / h)) / l));
} else if (d <= 2.7e-286) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * (-0.125 * (t_0 * (h / l))));
} else {
tmp = (d / (sqrt(l) * sqrt(h))) * (1.0 + (t_0 * ((h * -0.125) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) ^ 2.0 tmp = 0.0 if (d <= -3.6e+206) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (d <= -2.6e-137) tmp = Float64(fma(Float64(t_0 / l), Float64(h * -0.125), 1.0) * sqrt(Float64(Float64(d * Float64(d / h)) / l))); elseif (d <= 2.7e-286) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * Float64(-0.125 * Float64(t_0 * Float64(h / l))))); else tmp = Float64(Float64(d / Float64(sqrt(l) * sqrt(h))) * Float64(1.0 + Float64(t_0 * Float64(Float64(h * -0.125) / 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[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[d, -3.6e+206], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.6e-137], N[(N[(N[(t$95$0 / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.7e-286], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(-0.125 * N[(t$95$0 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t$95$0 * N[(N[(h * -0.125), $MachinePrecision] / 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 := {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{+206}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;d \leq -2.6 \cdot 10^{-137}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d \cdot \frac{d}{h}}{\ell}}\\
\mathbf{elif}\;d \leq 2.7 \cdot 10^{-286}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \left(-0.125 \cdot \left(t\_0 \cdot \frac{h}{\ell}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}} \cdot \left(1 + t\_0 \cdot \frac{h \cdot -0.125}{\ell}\right)\\
\end{array}
\end{array}
if d < -3.60000000000000028e206Initial program 69.0%
Simplified69.0%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt80.6%
neg-mul-180.6%
Simplified80.6%
if -3.60000000000000028e206 < d < -2.6e-137Initial program 79.6%
Simplified79.6%
Taylor expanded in M around 0 51.1%
+-commutative51.1%
associate-*r/51.1%
associate-*r*52.3%
associate-*r*52.3%
associate-*l/52.3%
associate-*r/52.3%
*-commutative52.3%
associate-*l*52.3%
fma-define52.3%
Simplified82.3%
associate-*r/82.2%
pow282.2%
associate-/l*83.5%
associate-*r/83.5%
associate-*r/84.7%
Applied egg-rr84.7%
pow184.7%
associate-*r*84.7%
pow1/284.7%
pow1/284.7%
pow-prod-down76.7%
associate-*r/75.4%
pow275.4%
associate-*r/75.4%
*-commutative75.4%
Applied egg-rr75.4%
unpow175.4%
unpow1/275.4%
associate-*r/78.2%
associate-/l*78.2%
*-commutative78.2%
Simplified78.2%
if -2.6e-137 < d < 2.7000000000000002e-286Initial program 40.4%
Simplified37.3%
Taylor expanded in M around inf 24.0%
associate-*r*24.0%
times-frac24.0%
*-commutative24.0%
associate-/l*24.1%
unpow224.1%
unpow224.1%
unpow224.1%
times-frac30.3%
swap-sqr34.5%
unpow234.5%
associate-*r/37.5%
*-commutative37.5%
associate-/l*37.5%
Simplified37.5%
if 2.7000000000000002e-286 < d Initial program 74.1%
Simplified73.3%
Applied egg-rr80.4%
unpow180.4%
associate-*r*80.4%
*-commutative80.4%
associate-*r/81.3%
*-commutative81.3%
associate-*r/81.3%
associate-*r*81.3%
associate-*r*81.3%
associate-/r*81.3%
Simplified81.3%
associate-/l/81.3%
*-commutative81.3%
associate-/l*81.3%
associate-/r*81.3%
Applied egg-rr81.3%
associate-*l*81.3%
clear-num81.3%
associate-*l/81.3%
*-un-lft-identity81.3%
div-inv81.3%
metadata-eval81.3%
unpow-prod-down81.3%
associate-*r/81.3%
metadata-eval81.3%
Applied egg-rr81.3%
associate-/r/86.1%
associate-*l/85.4%
*-commutative85.4%
associate-*r*85.4%
*-commutative85.4%
associate-*l*85.4%
associate-/l*81.3%
*-commutative81.3%
associate-*r*81.3%
metadata-eval81.3%
Simplified81.3%
Final simplification74.5%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -4.4e+117)
(/ (- d) t_0)
(if (<= l 2.65e-163)
(*
(fma (/ (pow (* D_m (/ M_m d)) 2.0) l) (* h -0.125) 1.0)
(sqrt (/ (* d (/ d h)) l)))
(if (<= l 1.7e+160)
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* D_m M_m) (* d 2.0)) 2.0) 1.0)
t_0))
(* (pow h -0.5) (/ d (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((h * l));
double tmp;
if (l <= -4.4e+117) {
tmp = -d / t_0;
} else if (l <= 2.65e-163) {
tmp = fma((pow((D_m * (M_m / d)), 2.0) / l), (h * -0.125), 1.0) * sqrt(((d * (d / h)) / l));
} else if (l <= 1.7e+160) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) / (d * 2.0)), 2.0), 1.0) / t_0);
} else {
tmp = pow(h, -0.5) * (d / 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(h * l)) tmp = 0.0 if (l <= -4.4e+117) tmp = Float64(Float64(-d) / t_0); elseif (l <= 2.65e-163) tmp = Float64(fma(Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) / l), Float64(h * -0.125), 1.0) * sqrt(Float64(Float64(d * Float64(d / h)) / l))); elseif (l <= 1.7e+160) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / t_0)); else tmp = Float64((h ^ -0.5) * Float64(d / 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[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -4.4e+117], N[((-d) / t$95$0), $MachinePrecision], If[LessEqual[l, 2.65e-163], N[(N[(N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * N[(d / h), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.7e+160], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -4.4 \cdot 10^{+117}:\\
\;\;\;\;\frac{-d}{t\_0}\\
\mathbf{elif}\;\ell \leq 2.65 \cdot 10^{-163}:\\
\;\;\;\;\mathsf{fma}\left(\frac{{\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d \cdot \frac{d}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.7 \cdot 10^{+160}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}, 1\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.40000000000000028e117Initial program 46.1%
Simplified46.1%
associate-*r/49.1%
frac-times49.1%
associate-/l*49.1%
*-commutative49.1%
Applied egg-rr49.1%
*-commutative49.1%
associate-/l*49.1%
associate-*r/49.1%
*-commutative49.1%
Simplified49.1%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt50.7%
mul-1-neg50.7%
remove-double-neg50.7%
unpow1/250.7%
rem-exp-log47.1%
exp-neg47.1%
exp-prod47.1%
distribute-lft-neg-out47.1%
exp-neg47.1%
exp-to-pow50.7%
unpow1/250.7%
Simplified50.7%
if -4.40000000000000028e117 < l < 2.65000000000000008e-163Initial program 77.5%
Simplified75.9%
Taylor expanded in M around 0 48.1%
+-commutative48.1%
associate-*r/48.1%
associate-*r*48.8%
associate-*r*48.8%
associate-*l/49.4%
associate-*r/49.4%
*-commutative49.4%
associate-*l*49.4%
fma-define49.4%
Simplified80.8%
associate-*r/80.8%
pow280.8%
associate-/l*80.8%
associate-*r/80.8%
associate-*r/80.8%
Applied egg-rr80.8%
pow180.8%
associate-*r*80.8%
pow1/280.8%
pow1/280.8%
pow-prod-down73.9%
associate-*r/73.9%
pow273.9%
associate-*r/73.9%
*-commutative73.9%
Applied egg-rr73.9%
unpow173.9%
unpow1/273.9%
associate-*r/71.5%
associate-/l*71.5%
*-commutative71.5%
Simplified71.5%
if 2.65000000000000008e-163 < l < 1.70000000000000015e160Initial program 74.4%
Simplified74.4%
Applied egg-rr84.0%
unpow184.0%
associate-*l/87.3%
associate-/l*89.8%
+-commutative89.8%
associate-*r*89.8%
fma-define89.8%
*-commutative89.8%
associate-*r/89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in l around 0 83.1%
if 1.70000000000000015e160 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification71.4%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -7.4e-184)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(* d (sqrt (log (exp (/ 1.0 (* h l))))))
(if (<= l 1.16e+162)
(*
d
(/
(fma (* (/ h l) -0.5) (pow (/ (* D_m M_m) (* d 2.0)) 2.0) 1.0)
(sqrt (* h l))))
(* (pow h -0.5) (/ d (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 <= -7.4e-184) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else if (l <= 1.16e+162) {
tmp = d * (fma(((h / l) * -0.5), pow(((D_m * M_m) / (d * 2.0)), 2.0), 1.0) / sqrt((h * l)));
} else {
tmp = pow(h, -0.5) * (d / 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 <= -7.4e-184) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); elseif (l <= 1.16e+162) tmp = Float64(d * Float64(fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0), 1.0) / sqrt(Float64(h * l)))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -7.4e-184], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.16e+162], N[(d * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -7.4 \cdot 10^{-184}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{elif}\;\ell \leq 1.16 \cdot 10^{+162}:\\
\;\;\;\;d \cdot \frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{D\_m \cdot M\_m}{d \cdot 2}\right)}^{2}, 1\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -7.3999999999999997e-184Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -7.3999999999999997e-184 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
Taylor expanded in d around inf 19.3%
add-log-exp55.0%
Applied egg-rr55.0%
if -5.00000000000023e-311 < l < 1.16000000000000006e162Initial program 75.1%
Simplified74.1%
Applied egg-rr81.5%
unpow181.5%
associate-*l/83.7%
associate-/l*85.4%
+-commutative85.4%
associate-*r*85.4%
fma-define85.4%
*-commutative85.4%
associate-*r/86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in l around 0 79.2%
if 1.16000000000000006e162 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
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
(let* ((t_0 (* D_m (/ M_m d))) (t_1 (* (sqrt l) (sqrt h))))
(if (<= d -7.5e-278)
(*
(sqrt (/ d h))
(* (fma (* t_0 (/ t_0 l)) (* h -0.125) 1.0) (sqrt (/ d l))))
(if (<= d 2.6e-198)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_1))
(*
(/ d t_1)
(+ 1.0 (* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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 t_1 = sqrt(l) * sqrt(h);
double tmp;
if (d <= -7.5e-278) {
tmp = sqrt((d / h)) * (fma((t_0 * (t_0 / l)), (h * -0.125), 1.0) * sqrt((d / l)));
} else if (d <= 2.6e-198) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_1);
} else {
tmp = (d / t_1) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.5e-278) tmp = Float64(sqrt(Float64(d / h)) * Float64(fma(Float64(t_0 * Float64(t_0 / l)), Float64(h * -0.125), 1.0) * sqrt(Float64(d / l)))); elseif (d <= 2.6e-198) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_1)); else tmp = Float64(Float64(d / t_1) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.5e-278], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t$95$0 * N[(t$95$0 / l), $MachinePrecision]), $MachinePrecision] * N[(h * -0.125), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-198], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$1), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-278}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\mathsf{fma}\left(t\_0 \cdot \frac{t\_0}{\ell}, h \cdot -0.125, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-198}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_1} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.49999999999999946e-278Initial program 71.3%
Simplified70.5%
Taylor expanded in M around 0 42.6%
+-commutative42.6%
associate-*r/42.6%
associate-*r*44.2%
associate-*r*44.2%
associate-*l/44.8%
associate-*r/44.8%
*-commutative44.8%
associate-*l*44.8%
fma-define44.8%
Simplified73.8%
associate-*r/73.8%
pow273.8%
associate-/l*74.6%
associate-*r/74.6%
associate-*r/75.3%
Applied egg-rr75.3%
if -7.49999999999999946e-278 < d < 2.60000000000000007e-198Initial program 33.1%
Simplified33.1%
Applied egg-rr39.9%
unpow139.9%
associate-*l/59.6%
associate-/l*59.7%
+-commutative59.7%
associate-*r*59.7%
fma-define59.7%
*-commutative59.7%
associate-*r/59.7%
*-commutative59.7%
Simplified59.7%
fma-undefine59.7%
associate-/l*56.4%
*-commutative56.4%
associate-/l/56.4%
associate-*l*56.4%
div-inv56.4%
metadata-eval56.4%
Applied egg-rr56.4%
if 2.60000000000000007e-198 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification80.1%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (sqrt l) (sqrt h))))
(if (<= d -7.5e-278)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(- 1.0 (* 0.5 (* h (/ (pow (/ (* D_m M_m) (* d 2.0)) 2.0) l)))))
(if (<= d 2.6e-199)
(*
d
(/
(+ 1.0 (* (/ h l) (* -0.5 (pow (* D_m (* (/ M_m d) 0.5)) 2.0))))
t_0))
(*
(/ d t_0)
(+ 1.0 (* h (/ (* -0.5 (pow (/ (* 2.0 (/ d D_m)) M_m) -2.0)) 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(l) * sqrt(h);
double tmp;
if (d <= -7.5e-278) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * (pow(((D_m * M_m) / (d * 2.0)), 2.0) / l))));
} else if (d <= 2.6e-199) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0);
} else {
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(l) * sqrt(h)
if (d <= (-7.5d-278)) then
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0d0 - (0.5d0 * (h * ((((d_m * m_m) / (d * 2.0d0)) ** 2.0d0) / l))))
else if (d <= 2.6d-199) then
tmp = d * ((1.0d0 + ((h / l) * ((-0.5d0) * ((d_m * ((m_m / d) * 0.5d0)) ** 2.0d0)))) / t_0)
else
tmp = (d / t_0) * (1.0d0 + (h * (((-0.5d0) * (((2.0d0 * (d / d_m)) / m_m) ** (-2.0d0))) / l)))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(l) * Math.sqrt(h);
double tmp;
if (d <= -7.5e-278) {
tmp = (Math.sqrt((d / h)) * Math.sqrt((d / l))) * (1.0 - (0.5 * (h * (Math.pow(((D_m * M_m) / (d * 2.0)), 2.0) / l))));
} else if (d <= 2.6e-199) {
tmp = d * ((1.0 + ((h / l) * (-0.5 * Math.pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0);
} else {
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * Math.pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l)));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(l) * math.sqrt(h) tmp = 0 if d <= -7.5e-278: tmp = (math.sqrt((d / h)) * math.sqrt((d / l))) * (1.0 - (0.5 * (h * (math.pow(((D_m * M_m) / (d * 2.0)), 2.0) / l)))) elif d <= 2.6e-199: tmp = d * ((1.0 + ((h / l) * (-0.5 * math.pow((D_m * ((M_m / d) * 0.5)), 2.0)))) / t_0) else: tmp = (d / t_0) * (1.0 + (h * ((-0.5 * math.pow(((2.0 * (d / D_m)) / M_m), -2.0)) / l))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(sqrt(l) * sqrt(h)) tmp = 0.0 if (d <= -7.5e-278) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(0.5 * Float64(h * Float64((Float64(Float64(D_m * M_m) / Float64(d * 2.0)) ^ 2.0) / l))))); elseif (d <= 2.6e-199) tmp = Float64(d * Float64(Float64(1.0 + Float64(Float64(h / l) * Float64(-0.5 * (Float64(D_m * Float64(Float64(M_m / d) * 0.5)) ^ 2.0)))) / t_0)); else tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(h * Float64(Float64(-0.5 * (Float64(Float64(2.0 * Float64(d / D_m)) / M_m) ^ -2.0)) / l)))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(l) * sqrt(h);
tmp = 0.0;
if (d <= -7.5e-278)
tmp = (sqrt((d / h)) * sqrt((d / l))) * (1.0 - (0.5 * (h * ((((D_m * M_m) / (d * 2.0)) ^ 2.0) / l))));
elseif (d <= 2.6e-199)
tmp = d * ((1.0 + ((h / l) * (-0.5 * ((D_m * ((M_m / d) * 0.5)) ^ 2.0)))) / t_0);
else
tmp = (d / t_0) * (1.0 + (h * ((-0.5 * (((2.0 * (d / D_m)) / M_m) ^ -2.0)) / l)));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -7.5e-278], 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 * M$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.6e-199], N[(d * N[(N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(h * N[(N[(-0.5 * N[Power[N[(N[(2.0 * N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / 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{\ell} \cdot \sqrt{h}\\
\mathbf{if}\;d \leq -7.5 \cdot 10^{-278}:\\
\;\;\;\;\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 \cdot M\_m}{d \cdot 2}\right)}^{2}}{\ell}\right)\right)\\
\mathbf{elif}\;d \leq 2.6 \cdot 10^{-199}:\\
\;\;\;\;d \cdot \frac{1 + \frac{h}{\ell} \cdot \left(-0.5 \cdot {\left(D\_m \cdot \left(\frac{M\_m}{d} \cdot 0.5\right)\right)}^{2}\right)}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + h \cdot \frac{-0.5 \cdot {\left(\frac{2 \cdot \frac{d}{D\_m}}{M\_m}\right)}^{-2}}{\ell}\right)\\
\end{array}
\end{array}
if d < -7.49999999999999946e-278Initial program 71.3%
Simplified70.5%
associate-*r/73.7%
frac-times74.5%
associate-/l*73.7%
*-commutative73.7%
Applied egg-rr73.7%
*-commutative73.7%
associate-/l*73.7%
associate-*r/73.8%
*-commutative73.8%
Simplified73.8%
if -7.49999999999999946e-278 < d < 2.6000000000000001e-199Initial program 33.1%
Simplified33.1%
Applied egg-rr39.9%
unpow139.9%
associate-*l/59.6%
associate-/l*59.7%
+-commutative59.7%
associate-*r*59.7%
fma-define59.7%
*-commutative59.7%
associate-*r/59.7%
*-commutative59.7%
Simplified59.7%
fma-undefine59.7%
associate-/l*56.4%
*-commutative56.4%
associate-/l/56.4%
associate-*l*56.4%
div-inv56.4%
metadata-eval56.4%
Applied egg-rr56.4%
if 2.6000000000000001e-199 < d Initial program 81.1%
Simplified80.1%
Applied egg-rr86.9%
unpow186.9%
associate-*r*86.9%
*-commutative86.9%
associate-*r/87.9%
*-commutative87.9%
associate-*r/87.9%
associate-*r*87.9%
associate-*r*87.9%
associate-/r*87.9%
Simplified87.9%
expm1-log1p-u57.1%
log1p-define57.1%
+-commutative57.1%
associate-/l/57.1%
*-commutative57.1%
associate-/l*57.1%
fma-undefine57.1%
expm1-undefine57.1%
Applied egg-rr87.9%
fma-undefine87.9%
associate-*r*87.9%
associate--l+87.9%
metadata-eval87.9%
+-rgt-identity87.9%
associate-*l/93.0%
associate-/l*93.9%
Simplified92.9%
Final simplification79.3%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h))) (t_1 (sqrt (/ d l))))
(if (<= M_m 1.35e-44)
(* t_0 t_1)
(* t_0 (* t_1 (* -0.125 (* (pow (* D_m (/ M_m d)) 2.0) (/ h l))))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double tmp;
if (M_m <= 1.35e-44) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * (t_1 * (-0.125 * (pow((D_m * (M_m / d)), 2.0) * (h / l))));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = sqrt((d / h))
t_1 = sqrt((d / l))
if (m_m <= 1.35d-44) then
tmp = t_0 * t_1
else
tmp = t_0 * (t_1 * ((-0.125d0) * (((d_m * (m_m / d)) ** 2.0d0) * (h / l))))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / h));
double t_1 = Math.sqrt((d / l));
double tmp;
if (M_m <= 1.35e-44) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * (t_1 * (-0.125 * (Math.pow((D_m * (M_m / d)), 2.0) * (h / l))));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / h)) t_1 = math.sqrt((d / l)) tmp = 0 if M_m <= 1.35e-44: tmp = t_0 * t_1 else: tmp = t_0 * (t_1 * (-0.125 * (math.pow((D_m * (M_m / d)), 2.0) * (h / l)))) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (M_m <= 1.35e-44) tmp = Float64(t_0 * t_1); else tmp = Float64(t_0 * Float64(t_1 * Float64(-0.125 * Float64((Float64(D_m * Float64(M_m / d)) ^ 2.0) * Float64(h / l))))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / h));
t_1 = sqrt((d / l));
tmp = 0.0;
if (M_m <= 1.35e-44)
tmp = t_0 * t_1;
else
tmp = t_0 * (t_1 * (-0.125 * (((D_m * (M_m / d)) ^ 2.0) * (h / l))));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M$95$m, 1.35e-44], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(-0.125 * N[(N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\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 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;M\_m \leq 1.35 \cdot 10^{-44}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(-0.125 \cdot \left({\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2} \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if M < 1.35e-44Initial program 68.4%
Simplified67.3%
Taylor expanded in M around 0 48.2%
if 1.35e-44 < M Initial program 76.5%
Simplified76.6%
Taylor expanded in M around inf 30.9%
associate-*r*32.3%
times-frac36.4%
*-commutative36.4%
associate-/l*36.4%
unpow236.4%
unpow236.4%
unpow236.4%
times-frac48.2%
swap-sqr53.4%
unpow253.4%
associate-*r/53.4%
*-commutative53.4%
associate-/l*53.3%
Simplified53.3%
Final simplification49.7%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -1e-184)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(* d (sqrt (log (exp (/ 1.0 (* h l))))))
(if (<= l 5.2e+164)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (/ (/ (* D_m M_m) d) 2.0) 2.0))))
(* (pow h -0.5) (/ d (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 <= -1e-184) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
} else if (l <= 5.2e+164) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = pow(h, -0.5) * (d / 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 <= (-1d-184)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= (-5d-311)) then
tmp = d * sqrt(log(exp((1.0d0 / (h * l)))))
else if (l <= 5.2d+164) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((((d_m * m_m) / d) / 2.0d0) ** 2.0d0)))
else
tmp = (h ** (-0.5d0)) * (d / 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 <= -1e-184) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d * Math.sqrt(Math.log(Math.exp((1.0 / (h * l)))));
} else if (l <= 5.2e+164) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = Math.pow(h, -0.5) * (d / 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 <= -1e-184: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= -5e-311: tmp = d * math.sqrt(math.log(math.exp((1.0 / (h * l))))) elif l <= 5.2e+164: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((((D_m * M_m) / d) / 2.0), 2.0))) else: tmp = math.pow(h, -0.5) * (d / 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 <= -1e-184) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = Float64(d * sqrt(log(exp(Float64(1.0 / Float64(h * l)))))); elseif (l <= 5.2e+164) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(Float64(D_m * M_m) / d) / 2.0) ^ 2.0)))); else tmp = Float64((h ^ -0.5) * Float64(d / 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 <= -1e-184)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= -5e-311)
tmp = d * sqrt(log(exp((1.0 / (h * l)))));
elseif (l <= 5.2e+164)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((((D_m * M_m) / d) / 2.0) ^ 2.0)));
else
tmp = (h ^ -0.5) * (d / 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, -1e-184], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d * N[Sqrt[N[Log[N[Exp[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.2e+164], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-184}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;d \cdot \sqrt{\log \left(e^{\frac{1}{h \cdot \ell}}\right)}\\
\mathbf{elif}\;\ell \leq 5.2 \cdot 10^{+164}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{\frac{D\_m \cdot M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -1.0000000000000001e-184Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -1.0000000000000001e-184 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
Taylor expanded in d around inf 19.3%
add-log-exp55.0%
Applied egg-rr55.0%
if -5.00000000000023e-311 < l < 5.1999999999999998e164Initial program 75.1%
Simplified74.1%
Applied egg-rr81.5%
unpow181.5%
associate-*r*81.5%
*-commutative81.5%
associate-*r/82.5%
*-commutative82.5%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
associate-/l/82.5%
*-commutative82.5%
associate-/l*82.5%
associate-/r*82.5%
Applied egg-rr82.5%
Taylor expanded in l around 0 77.1%
if 5.1999999999999998e164 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification61.9%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (* h l))))
(if (<= l -2.35e-183)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(/ d (log (exp t_0)))
(if (<= l 1.9e+161)
(*
(/ d t_0)
(+ 1.0 (* (* (/ h l) -0.5) (pow (/ (/ (* D_m M_m) d) 2.0) 2.0))))
(* (pow h -0.5) (/ d (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((h * l));
double tmp;
if (l <= -2.35e-183) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d / log(exp(t_0));
} else if (l <= 1.9e+161) {
tmp = (d / t_0) * (1.0 + (((h / l) * -0.5) * pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h * l))
if (l <= (-2.35d-183)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= (-5d-311)) then
tmp = d / log(exp(t_0))
else if (l <= 1.9d+161) then
tmp = (d / t_0) * (1.0d0 + (((h / l) * (-0.5d0)) * ((((d_m * m_m) / d) / 2.0d0) ** 2.0d0)))
else
tmp = (h ** (-0.5d0)) * (d / sqrt(l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((h * l));
double tmp;
if (l <= -2.35e-183) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d / Math.log(Math.exp(t_0));
} else if (l <= 1.9e+161) {
tmp = (d / t_0) * (1.0 + (((h / l) * -0.5) * Math.pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = Math.pow(h, -0.5) * (d / Math.sqrt(l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((h * l)) tmp = 0 if l <= -2.35e-183: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= -5e-311: tmp = d / math.log(math.exp(t_0)) elif l <= 1.9e+161: tmp = (d / t_0) * (1.0 + (((h / l) * -0.5) * math.pow((((D_m * M_m) / d) / 2.0), 2.0))) else: tmp = math.pow(h, -0.5) * (d / 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 = sqrt(Float64(h * l)) tmp = 0.0 if (l <= -2.35e-183) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = Float64(d / log(exp(t_0))); elseif (l <= 1.9e+161) tmp = Float64(Float64(d / t_0) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(Float64(D_m * M_m) / d) / 2.0) ^ 2.0)))); else tmp = Float64((h ^ -0.5) * Float64(d / sqrt(l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((h * l));
tmp = 0.0;
if (l <= -2.35e-183)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= -5e-311)
tmp = d / log(exp(t_0));
elseif (l <= 1.9e+161)
tmp = (d / t_0) * (1.0 + (((h / l) * -0.5) * ((((D_m * M_m) / d) / 2.0) ^ 2.0)));
else
tmp = (h ^ -0.5) * (d / 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[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -2.35e-183], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d / N[Log[N[Exp[t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.9e+161], N[(N[(d / t$95$0), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{h \cdot \ell}\\
\mathbf{if}\;\ell \leq -2.35 \cdot 10^{-183}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{d}{\log \left(e^{t\_0}\right)}\\
\mathbf{elif}\;\ell \leq 1.9 \cdot 10^{+161}:\\
\;\;\;\;\frac{d}{t\_0} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{\frac{D\_m \cdot M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.35e-183Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -2.35e-183 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
associate-*r/83.7%
frac-times83.9%
associate-/l*83.7%
*-commutative83.7%
Applied egg-rr83.7%
*-commutative83.7%
associate-/l*83.7%
associate-*r/83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in d around inf 19.3%
unpow1/219.3%
rem-exp-log19.3%
exp-neg19.3%
exp-prod19.3%
distribute-lft-neg-out19.3%
exp-neg19.3%
exp-to-pow19.3%
unpow1/219.3%
associate-/l*19.3%
*-rgt-identity19.3%
Simplified19.3%
add-log-exp51.1%
*-commutative51.1%
Applied egg-rr51.1%
if -5.00000000000023e-311 < l < 1.9000000000000001e161Initial program 75.1%
Simplified74.1%
Applied egg-rr81.5%
unpow181.5%
associate-*r*81.5%
*-commutative81.5%
associate-*r/82.5%
*-commutative82.5%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
associate-/l/82.5%
*-commutative82.5%
associate-/l*82.5%
associate-/r*82.5%
Applied egg-rr82.5%
Taylor expanded in l around 0 77.1%
if 1.9000000000000001e161 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification61.6%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l)))))
(if (<= l -9.6e-186)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(log1p (expm1 t_0))
(if (<= l 3.1e+166)
(*
t_0
(+ 1.0 (* (* (/ h l) -0.5) (pow (/ (/ (* D_m M_m) d) 2.0) 2.0))))
(* (pow h -0.5) (/ d (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 / sqrt((h * l));
double tmp;
if (l <= -9.6e-186) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = log1p(expm1(t_0));
} else if (l <= 3.1e+166) {
tmp = t_0 * (1.0 + (((h / l) * -0.5) * pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = pow(h, -0.5) * (d / sqrt(l));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / Math.sqrt((h * l));
double tmp;
if (l <= -9.6e-186) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = Math.log1p(Math.expm1(t_0));
} else if (l <= 3.1e+166) {
tmp = t_0 * (1.0 + (((h / l) * -0.5) * Math.pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = Math.pow(h, -0.5) * (d / 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 / math.sqrt((h * l)) tmp = 0 if l <= -9.6e-186: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= -5e-311: tmp = math.log1p(math.expm1(t_0)) elif l <= 3.1e+166: tmp = t_0 * (1.0 + (((h / l) * -0.5) * math.pow((((D_m * M_m) / d) / 2.0), 2.0))) else: tmp = math.pow(h, -0.5) * (d / math.sqrt(l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (l <= -9.6e-186) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = log1p(expm1(t_0)); elseif (l <= 3.1e+166) tmp = Float64(t_0 * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(Float64(D_m * M_m) / d) / 2.0) ^ 2.0)))); else tmp = Float64((h ^ -0.5) * Float64(d / 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[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -9.6e-186], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[Log[1 + N[(Exp[t$95$0] - 1), $MachinePrecision]], $MachinePrecision], If[LessEqual[l, 3.1e+166], N[(t$95$0 * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;\ell \leq -9.6 \cdot 10^{-186}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(t\_0\right)\right)\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{+166}:\\
\;\;\;\;t\_0 \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{\frac{D\_m \cdot M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.60000000000000012e-186Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -9.60000000000000012e-186 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
Taylor expanded in d around inf 19.3%
sqrt-div19.3%
metadata-eval19.3%
*-commutative19.3%
sqrt-unprod0.0%
div-inv0.0%
log1p-expm1-u0.0%
sqrt-unprod46.9%
*-commutative46.9%
Applied egg-rr46.9%
if -5.00000000000023e-311 < l < 3.09999999999999983e166Initial program 75.1%
Simplified74.1%
Applied egg-rr81.5%
unpow181.5%
associate-*r*81.5%
*-commutative81.5%
associate-*r/82.5%
*-commutative82.5%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
associate-/l/82.5%
*-commutative82.5%
associate-/l*82.5%
associate-/r*82.5%
Applied egg-rr82.5%
Taylor expanded in l around 0 77.1%
if 3.09999999999999983e166 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification61.2%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -2.35e-185)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(* d (pow (pow (* h l) 2.0) -0.25))
(if (<= l 1.16e+162)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (/ (/ (* D_m M_m) d) 2.0) 2.0))))
(* (pow h -0.5) (/ d (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-185) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else if (l <= 1.16e+162) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = pow(h, -0.5) * (d / 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-185)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= (-5d-311)) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else if (l <= 1.16d+162) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((((d_m * m_m) / d) / 2.0d0) ** 2.0d0)))
else
tmp = (h ** (-0.5d0)) * (d / 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-185) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else if (l <= 1.16e+162) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((((D_m * M_m) / d) / 2.0), 2.0)));
} else {
tmp = Math.pow(h, -0.5) * (d / 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-185: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= -5e-311: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) elif l <= 1.16e+162: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((((D_m * M_m) / d) / 2.0), 2.0))) else: tmp = math.pow(h, -0.5) * (d / 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-185) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); elseif (l <= 1.16e+162) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(Float64(Float64(D_m * M_m) / d) / 2.0) ^ 2.0)))); else tmp = Float64((h ^ -0.5) * Float64(d / 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-185)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= -5e-311)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
elseif (l <= 1.16e+162)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((((D_m * M_m) / d) / 2.0) ^ 2.0)));
else
tmp = (h ^ -0.5) * (d / 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-185], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.16e+162], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.35 \cdot 10^{-185}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{elif}\;\ell \leq 1.16 \cdot 10^{+162}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(\frac{\frac{D\_m \cdot M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -2.3500000000000001e-185Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -2.3500000000000001e-185 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
Taylor expanded in d around inf 19.3%
add-log-exp55.0%
Applied egg-rr55.0%
rem-log-exp19.3%
inv-pow19.3%
sqrt-pow119.3%
metadata-eval19.3%
add-sqr-sqrt19.3%
sqrt-pow119.3%
sqrt-pow119.3%
pow-prod-down38.9%
pow238.9%
metadata-eval38.9%
Applied egg-rr38.9%
if -5.00000000000023e-311 < l < 1.16000000000000006e162Initial program 75.1%
Simplified74.1%
Applied egg-rr81.5%
unpow181.5%
associate-*r*81.5%
*-commutative81.5%
associate-*r/82.5%
*-commutative82.5%
associate-*r/82.5%
associate-*r*82.5%
associate-*r*82.5%
associate-/r*82.5%
Simplified82.5%
associate-/l/82.5%
*-commutative82.5%
associate-/l*82.5%
associate-/r*82.5%
Applied egg-rr82.5%
Taylor expanded in l around 0 77.1%
if 1.16000000000000006e162 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification60.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 -4.2e-184)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 6.9e-307)
(* d (pow (pow (* h l) 2.0) -0.25))
(if (<= l 3.1e+161)
(*
(/ d (sqrt (* h l)))
(+ 1.0 (* (* (/ h l) -0.5) (pow (* D_m (/ (/ M_m d) 2.0)) 2.0))))
(* (pow h -0.5) (/ d (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 <= -4.2e-184) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 6.9e-307) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else if (l <= 3.1e+161) {
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = pow(h, -0.5) * (d / 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 <= (-4.2d-184)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 6.9d-307) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else if (l <= 3.1d+161) then
tmp = (d / sqrt((h * l))) * (1.0d0 + (((h / l) * (-0.5d0)) * ((d_m * ((m_m / d) / 2.0d0)) ** 2.0d0)))
else
tmp = (h ** (-0.5d0)) * (d / 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 <= -4.2e-184) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 6.9e-307) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else if (l <= 3.1e+161) {
tmp = (d / Math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * Math.pow((D_m * ((M_m / d) / 2.0)), 2.0)));
} else {
tmp = Math.pow(h, -0.5) * (d / 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 <= -4.2e-184: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 6.9e-307: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) elif l <= 3.1e+161: tmp = (d / math.sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * math.pow((D_m * ((M_m / d) / 2.0)), 2.0))) else: tmp = math.pow(h, -0.5) * (d / 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 <= -4.2e-184) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 6.9e-307) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); elseif (l <= 3.1e+161) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * Float64(1.0 + Float64(Float64(Float64(h / l) * -0.5) * (Float64(D_m * Float64(Float64(M_m / d) / 2.0)) ^ 2.0)))); else tmp = Float64((h ^ -0.5) * Float64(d / 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 <= -4.2e-184)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 6.9e-307)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
elseif (l <= 3.1e+161)
tmp = (d / sqrt((h * l))) * (1.0 + (((h / l) * -0.5) * ((D_m * ((M_m / d) / 2.0)) ^ 2.0)));
else
tmp = (h ^ -0.5) * (d / 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, -4.2e-184], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.9e-307], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.1e+161], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(D$95$m * N[(N[(M$95$m / d), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[h, -0.5], $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.2 \cdot 10^{-184}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 6.9 \cdot 10^{-307}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{elif}\;\ell \leq 3.1 \cdot 10^{+161}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \left(1 + \left(\frac{h}{\ell} \cdot -0.5\right) \cdot {\left(D\_m \cdot \frac{\frac{M\_m}{d}}{2}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;{h}^{-0.5} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.1999999999999998e-184Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -4.1999999999999998e-184 < l < 6.8999999999999997e-307Initial program 72.8%
Simplified68.7%
Taylor expanded in d around inf 18.5%
add-log-exp52.8%
Applied egg-rr52.8%
rem-log-exp18.5%
inv-pow18.5%
sqrt-pow118.5%
metadata-eval18.5%
add-sqr-sqrt18.5%
sqrt-pow118.5%
sqrt-pow118.5%
pow-prod-down37.3%
pow237.3%
metadata-eval37.3%
Applied egg-rr37.3%
if 6.8999999999999997e-307 < l < 3.10000000000000007e161Initial program 74.8%
Simplified74.8%
Applied egg-rr82.3%
unpow182.3%
associate-*r*82.3%
*-commutative82.3%
associate-*r/82.3%
*-commutative82.3%
associate-*r/82.3%
associate-*r*82.3%
associate-*r*82.3%
associate-/r*82.3%
Simplified82.3%
Taylor expanded in l around 0 76.8%
if 3.10000000000000007e161 < l Initial program 61.5%
Simplified61.5%
Taylor expanded in d around inf 38.8%
sqrt-div38.8%
metadata-eval38.8%
*-commutative38.8%
sqrt-unprod67.3%
div-inv67.5%
add-cube-cbrt66.6%
pow366.6%
sqrt-unprod38.5%
*-commutative38.5%
Applied egg-rr38.5%
rem-cube-cbrt38.7%
sqrt-prod67.5%
associate-/l/67.4%
clear-num66.4%
Applied egg-rr66.4%
*-un-lft-identity66.4%
associate-/r/67.5%
pow1/267.5%
pow-flip67.6%
metadata-eval67.6%
Applied egg-rr67.6%
*-lft-identity67.6%
Simplified67.6%
Final simplification60.0%
M_m = (fabs.f64 M)
D_m = (fabs.f64 D)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= l -5.8e-185)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l 1.3e-286)
(* d (pow (pow (* h l) 2.0) -0.25))
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.8e-185) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= 1.3e-286) {
tmp = d * pow(pow((h * l), 2.0), -0.25);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-5.8d-185)) then
tmp = -d * sqrt(((1.0d0 / h) / l))
else if (l <= 1.3d-286) then
tmp = d * (((h * l) ** 2.0d0) ** (-0.25d0))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -5.8e-185) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= 1.3e-286) {
tmp = d * Math.pow(Math.pow((h * l), 2.0), -0.25);
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -5.8e-185: tmp = -d * math.sqrt(((1.0 / h) / l)) elif l <= 1.3e-286: tmp = d * math.pow(math.pow((h * l), 2.0), -0.25) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -5.8e-185) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= 1.3e-286) tmp = Float64(d * ((Float64(h * l) ^ 2.0) ^ -0.25)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -5.8e-185)
tmp = -d * sqrt(((1.0 / h) / l));
elseif (l <= 1.3e-286)
tmp = d * (((h * l) ^ 2.0) ^ -0.25);
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -5.8e-185], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3e-286], N[(d * N[Power[N[Power[N[(h * l), $MachinePrecision], 2.0], $MachinePrecision], -0.25], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.8 \cdot 10^{-185}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-286}:\\
\;\;\;\;d \cdot {\left({\left(h \cdot \ell\right)}^{2}\right)}^{-0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -5.79999999999999989e-185Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -5.79999999999999989e-185 < l < 1.3e-286Initial program 77.1%
Simplified74.0%
Taylor expanded in d around inf 25.4%
add-log-exp47.8%
Applied egg-rr47.8%
rem-log-exp25.4%
inv-pow25.4%
sqrt-pow125.4%
metadata-eval25.4%
add-sqr-sqrt25.4%
sqrt-pow125.4%
sqrt-pow125.4%
pow-prod-down39.2%
pow239.2%
metadata-eval39.2%
Applied egg-rr39.2%
if 1.3e-286 < l Initial program 71.1%
Simplified71.1%
Taylor expanded in d around inf 46.1%
sqrt-div46.1%
metadata-eval46.1%
*-commutative46.1%
sqrt-unprod54.9%
div-inv54.9%
associate-/r*52.8%
Applied egg-rr52.8%
associate-/l/54.9%
*-commutative54.9%
Simplified54.9%
Final simplification49.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 (<= l -2.9e-185)
(* (- d) (sqrt (/ (/ 1.0 h) l)))
(if (<= l -5e-311)
(/ d (cbrt (pow (* h l) 1.5)))
(/ d (* (sqrt l) (sqrt h))))))M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.9e-185) {
tmp = -d * sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d / cbrt(pow((h * l), 1.5));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.9e-185) {
tmp = -d * Math.sqrt(((1.0 / h) / l));
} else if (l <= -5e-311) {
tmp = d / Math.cbrt(Math.pow((h * l), 1.5));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.9e-185) tmp = Float64(Float64(-d) * sqrt(Float64(Float64(1.0 / h) / l))); elseif (l <= -5e-311) tmp = Float64(d / cbrt((Float64(h * l) ^ 1.5))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.9e-185], N[((-d) * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -5e-311], N[(d / N[Power[N[Power[N[(h * l), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{-185}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\frac{d}{\sqrt[3]{{\left(h \cdot \ell\right)}^{1.5}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.89999999999999995e-185Initial program 68.5%
Simplified67.6%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt47.5%
neg-mul-147.5%
Simplified47.5%
if -2.89999999999999995e-185 < l < -5.00000000000023e-311Initial program 71.7%
Simplified71.6%
associate-*r/83.7%
frac-times83.9%
associate-/l*83.7%
*-commutative83.7%
Applied egg-rr83.7%
*-commutative83.7%
associate-/l*83.7%
associate-*r/83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in d around inf 19.3%
unpow1/219.3%
rem-exp-log19.3%
exp-neg19.3%
exp-prod19.3%
distribute-lft-neg-out19.3%
exp-neg19.3%
exp-to-pow19.3%
unpow1/219.3%
associate-/l*19.3%
*-rgt-identity19.3%
Simplified19.3%
add-cbrt-cube34.9%
pow1/334.9%
add-sqr-sqrt34.9%
pow134.9%
pow1/234.9%
pow-prod-up34.9%
*-commutative34.9%
metadata-eval34.9%
Applied egg-rr34.9%
unpow1/334.9%
Simplified34.9%
if -5.00000000000023e-311 < l Initial program 72.6%
Simplified71.8%
Taylor expanded in d around inf 45.6%
sqrt-div45.6%
metadata-eval45.6%
*-commutative45.6%
sqrt-unprod53.7%
div-inv53.7%
associate-/r*51.8%
Applied egg-rr51.8%
associate-/l/53.7%
*-commutative53.7%
Simplified53.7%
Final simplification49.4%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d 9.8e-245) (/ (- d) (sqrt (* h l))) (/ d (* (sqrt l) (sqrt h)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 9.8e-245) {
tmp = -d / sqrt((h * l));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 9.8d-245) then
tmp = -d / sqrt((h * l))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 9.8e-245) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 9.8e-245: tmp = -d / math.sqrt((h * l)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 9.8e-245) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 9.8e-245)
tmp = -d / sqrt((h * l));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 9.8e-245], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 9.8 \cdot 10^{-245}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < 9.7999999999999996e-245Initial program 64.4%
Simplified63.6%
associate-*r/66.5%
frac-times67.2%
associate-/l*66.5%
*-commutative66.5%
Applied egg-rr66.5%
*-commutative66.5%
associate-/l*66.5%
associate-*r/66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt38.3%
mul-1-neg38.3%
remove-double-neg38.3%
unpow1/238.3%
rem-exp-log36.2%
exp-neg36.3%
exp-prod36.8%
distribute-lft-neg-out36.8%
exp-neg36.8%
exp-to-pow38.8%
unpow1/238.8%
Simplified38.9%
if 9.7999999999999996e-245 < d Initial program 78.9%
Simplified78.0%
Taylor expanded in d around inf 49.8%
sqrt-div49.8%
metadata-eval49.8%
*-commutative49.8%
sqrt-unprod58.8%
div-inv58.8%
associate-/r*56.7%
Applied egg-rr56.7%
associate-/l/58.8%
*-commutative58.8%
Simplified58.8%
M_m = (fabs.f64 M) D_m = (fabs.f64 D) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (/ (/ 1.0 h) l)))) (if (<= l -1.9e-237) (* (- d) t_0) (* d t_0))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(((1.0 / h) / l));
double tmp;
if (l <= -1.9e-237) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((1.0d0 / h) / l))
if (l <= (-1.9d-237)) then
tmp = -d * t_0
else
tmp = d * t_0
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(((1.0 / h) / l));
double tmp;
if (l <= -1.9e-237) {
tmp = -d * t_0;
} else {
tmp = d * t_0;
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(((1.0 / h) / l)) tmp = 0 if l <= -1.9e-237: tmp = -d * t_0 else: tmp = d * t_0 return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(Float64(1.0 / h) / l)) tmp = 0.0 if (l <= -1.9e-237) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(d * t_0); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((1.0 / h) / l));
tmp = 0.0;
if (l <= -1.9e-237)
tmp = -d * t_0;
else
tmp = d * t_0;
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision]
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.9e-237], N[((-d) * t$95$0), $MachinePrecision], N[(d * t$95$0), $MachinePrecision]]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\mathbf{if}\;\ell \leq -1.9 \cdot 10^{-237}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;d \cdot t\_0\\
\end{array}
\end{array}
if l < -1.90000000000000012e-237Initial program 69.3%
Simplified68.4%
Taylor expanded in l around -inf 0.0%
*-commutative0.0%
associate-/r*0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.8%
neg-mul-144.8%
Simplified44.8%
if -1.90000000000000012e-237 < l Initial program 72.1%
Simplified71.4%
Taylor expanded in d around inf 43.8%
associate-/r*44.1%
Simplified44.1%
Final simplification44.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 -2.4e-237) (/ (- d) (sqrt (* h l))) (* d (sqrt (/ (/ 1.0 h) l)))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.4e-237) {
tmp = -d / sqrt((h * l));
} else {
tmp = d * sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.4d-237)) then
tmp = -d / sqrt((h * l))
else
tmp = d * sqrt(((1.0d0 / h) / l))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.4e-237) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d * Math.sqrt(((1.0 / h) / l));
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -2.4e-237: tmp = -d / math.sqrt((h * l)) else: tmp = d * math.sqrt(((1.0 / h) / l)) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.4e-237) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * sqrt(Float64(Float64(1.0 / h) / l))); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -2.4e-237)
tmp = -d / sqrt((h * l));
else
tmp = d * sqrt(((1.0 / h) / l));
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.4e-237], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Sqrt[N[(N[(1.0 / h), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{-237}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \sqrt{\frac{\frac{1}{h}}{\ell}}\\
\end{array}
\end{array}
if l < -2.4e-237Initial program 69.3%
Simplified68.4%
associate-*r/70.2%
frac-times71.1%
associate-/l*70.2%
*-commutative70.2%
Applied egg-rr70.2%
*-commutative70.2%
associate-/l*70.2%
associate-*r/70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.7%
mul-1-neg44.7%
remove-double-neg44.7%
unpow1/244.7%
rem-exp-log42.2%
exp-neg42.2%
exp-prod42.2%
distribute-lft-neg-out42.2%
exp-neg42.2%
exp-to-pow44.7%
unpow1/244.7%
Simplified44.8%
if -2.4e-237 < l Initial program 72.1%
Simplified71.4%
Taylor expanded in d around inf 43.8%
associate-/r*44.1%
Simplified44.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.3e-237) (/ (- d) (sqrt (* h l))) (* d (pow (* h l) -0.5))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.3e-237) {
tmp = -d / sqrt((h * l));
} else {
tmp = d * pow((h * l), -0.5);
}
return tmp;
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.3d-237)) then
tmp = -d / sqrt((h * l))
else
tmp = d * ((h * l) ** (-0.5d0))
end if
code = tmp
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.3e-237) {
tmp = -d / Math.sqrt((h * l));
} else {
tmp = d * Math.pow((h * l), -0.5);
}
return tmp;
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -2.3e-237: tmp = -d / math.sqrt((h * l)) else: tmp = d * math.pow((h * l), -0.5) return tmp
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.3e-237) tmp = Float64(Float64(-d) / sqrt(Float64(h * l))); else tmp = Float64(d * (Float64(h * l) ^ -0.5)); end return tmp end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -2.3e-237)
tmp = -d / sqrt((h * l));
else
tmp = d * ((h * l) ^ -0.5);
end
tmp_2 = tmp;
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.3e-237], N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[Power[N[(h * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.3 \cdot 10^{-237}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot {\left(h \cdot \ell\right)}^{-0.5}\\
\end{array}
\end{array}
if l < -2.30000000000000011e-237Initial program 69.3%
Simplified68.4%
associate-*r/70.2%
frac-times71.1%
associate-/l*70.2%
*-commutative70.2%
Applied egg-rr70.2%
*-commutative70.2%
associate-/l*70.2%
associate-*r/70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in l around -inf 0.0%
remove-double-neg0.0%
associate-*l*0.0%
*-commutative0.0%
distribute-rgt-neg-in0.0%
*-commutative0.0%
unpow20.0%
rem-square-sqrt44.7%
mul-1-neg44.7%
remove-double-neg44.7%
unpow1/244.7%
rem-exp-log42.2%
exp-neg42.2%
exp-prod42.2%
distribute-lft-neg-out42.2%
exp-neg42.2%
exp-to-pow44.7%
unpow1/244.7%
Simplified44.8%
if -2.30000000000000011e-237 < l Initial program 72.1%
Simplified71.4%
Applied egg-rr70.5%
unpow170.5%
associate-*l/73.2%
associate-/l*74.4%
+-commutative74.4%
associate-*r*74.4%
fma-define74.4%
*-commutative74.4%
associate-*r/75.2%
*-commutative75.2%
Simplified75.2%
Taylor expanded in h around 0 43.8%
unpow-143.8%
metadata-eval43.8%
pow-sqr43.8%
rem-sqrt-square43.8%
rem-square-sqrt43.7%
fabs-sqr43.7%
rem-square-sqrt43.8%
Simplified43.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 (* 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 70.8%
Simplified70.0%
Applied egg-rr38.8%
unpow138.8%
associate-*l/40.3%
associate-/l*41.0%
+-commutative41.0%
associate-*r*41.0%
fma-define41.0%
*-commutative41.0%
associate-*r/41.4%
*-commutative41.4%
Simplified41.4%
Taylor expanded in h around 0 26.8%
unpow-126.8%
metadata-eval26.8%
pow-sqr26.8%
rem-sqrt-square26.8%
rem-square-sqrt26.8%
fabs-sqr26.8%
rem-square-sqrt26.8%
Simplified26.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 (/ d (sqrt (* h l))))
M_m = fabs(M);
D_m = fabs(D);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((h * l));
}
M_m = abs(m)
D_m = abs(d)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((h * l))
end function
M_m = Math.abs(M);
D_m = Math.abs(D);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((h * l));
}
M_m = math.fabs(M) D_m = math.fabs(D) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((h * l))
M_m = abs(M) D_m = abs(D) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(h * l))) end
M_m = abs(M);
D_m = abs(D);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((h * l));
end
M_m = N[Abs[M], $MachinePrecision] D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
M_m = \left|M\right|
\\
D_m = \left|D\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 70.8%
Simplified70.0%
associate-*r/72.5%
frac-times73.3%
associate-/l*72.5%
*-commutative72.5%
Applied egg-rr72.5%
*-commutative72.5%
associate-/l*72.9%
associate-*r/73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in d around inf 26.8%
unpow1/226.8%
rem-exp-log25.7%
exp-neg25.7%
exp-prod25.7%
distribute-lft-neg-out25.7%
exp-neg25.8%
exp-to-pow26.8%
unpow1/226.8%
associate-/l*26.8%
*-rgt-identity26.8%
Simplified26.8%
herbie shell --seed 2024090
(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)))))