
(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 29 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}
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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))) (t_1 (/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)))
(if (<= d -8.2e-193)
(*
(* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l)))
(- 1.0 (* t_1 (* h (/ (* 0.5 (* M_m D_m)) d)))))
(if (<= d 8e-289)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_0
(* d t_0))
h)
(*
(* (pow (/ d h) (/ 1.0 2.0)) (* (sqrt (/ 1.0 l)) (sqrt d)))
(+ 1.0 (* t_1 (/ (/ (* M_m D_m) (* d 2.0)) (/ -1.0 h)))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_1 = ((M_m * (D_m * 0.5)) / (d * 2.0)) / l;
double tmp;
if (d <= -8.2e-193) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * (1.0 - (t_1 * (h * ((0.5 * (M_m * D_m)) / d))));
} else if (d <= 8e-289) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
} else {
tmp = (pow((d / h), (1.0 / 2.0)) * (sqrt((1.0 / l)) * sqrt(d))) * (1.0 + (t_1 * (((M_m * D_m) / (d * 2.0)) / (-1.0 / h))));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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)) t_1 = Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) tmp = 0.0 if (d <= -8.2e-193) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(t_1 * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d))))); elseif (d <= 8e-289) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h); else tmp = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(1.0 / l)) * sqrt(d))) * Float64(1.0 + Float64(t_1 * Float64(Float64(Float64(M_m * D_m) / Float64(d * 2.0)) / Float64(-1.0 / h))))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$1 = N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]}, If[LessEqual[d, -8.2e-193], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$1 * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8e-289], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t$95$1 * N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / h), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell}\\
\mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - t\_1 \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-289}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \left(\sqrt{\frac{1}{\ell}} \cdot \sqrt{d}\right)\right) \cdot \left(1 + t\_1 \cdot \frac{\frac{M\_m \cdot D\_m}{d \cdot 2}}{\frac{-1}{h}}\right)\\
\end{array}
\end{array}
if d < -8.20000000000000005e-193Initial program 73.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites80.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6480.1
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6480.1
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
metadata-eval80.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6491.4
Applied rewrites91.4%
if -8.20000000000000005e-193 < d < 8.0000000000000001e-289Initial program 31.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites17.7%
Applied rewrites44.9%
Applied rewrites59.8%
if 8.0000000000000001e-289 < d Initial program 70.8%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.4%
lift-/.f64N/A
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
unpow-prod-downN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6485.9
Applied rewrites85.9%
Final simplification84.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
(t_2 (/ (* d t_0) h)))
(if (<= t_1 -2e-180)
(/ (* (- d) t_0) h)
(if (<= t_1 2e-158)
t_2
(if (<= t_1 2e+136)
(sqrt (* (/ d l) (/ d h)))
(if (<= t_1 INFINITY) t_2 (* (- d) (sqrt (/ 1.0 (* h l))))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double t_2 = (d * t_0) / h;
double tmp;
if (t_1 <= -2e-180) {
tmp = (-d * t_0) / h;
} else if (t_1 <= 2e-158) {
tmp = t_2;
} else if (t_1 <= 2e+136) {
tmp = sqrt(((d / l) * (d / h)));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
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 t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double t_2 = (d * t_0) / h;
double tmp;
if (t_1 <= -2e-180) {
tmp = (-d * t_0) / h;
} else if (t_1 <= 2e-158) {
tmp = t_2;
} else if (t_1 <= 2e+136) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) t_2 = (d * t_0) / h tmp = 0 if t_1 <= -2e-180: tmp = (-d * t_0) / h elif t_1 <= 2e-158: tmp = t_2 elif t_1 <= 2e+136: tmp = math.sqrt(((d / l) * (d / h))) elif t_1 <= math.inf: tmp = t_2 else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) 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)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) t_2 = Float64(Float64(d * t_0) / h) tmp = 0.0 if (t_1 <= -2e-180) tmp = Float64(Float64(Float64(-d) * t_0) / h); elseif (t_1 <= 2e-158) tmp = t_2; elseif (t_1 <= 2e+136) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); elseif (t_1 <= Inf) tmp = t_2; else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
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));
t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
t_2 = (d * t_0) / h;
tmp = 0.0;
if (t_1 <= -2e-180)
tmp = (-d * t_0) / h;
elseif (t_1 <= 2e-158)
tmp = t_2;
elseif (t_1 <= 2e+136)
tmp = sqrt(((d / l) * (d / h)));
elseif (t_1 <= Inf)
tmp = t_2;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-180], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 2e-158], t$95$2, If[LessEqual[t$95$1, 2e+136], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
t_2 := \frac{d \cdot t\_0}{h}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-158}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180Initial program 86.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites28.3%
Taylor expanded in l around -inf
Applied rewrites22.4%
if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000013e-158 or 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 63.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites26.3%
Taylor expanded in d around inf
Applied rewrites75.6%
if 2.00000000000000013e-158 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 99.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
Applied rewrites58.4%
Applied rewrites99.1%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification49.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_2 (sqrt (/ h l)))
(t_3
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_3 -2e-180)
(*
t_0
(*
t_1
(fma
(/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
(* (/ h l) -0.5)
1.0)))
(if (<= t_3 2e+136)
(* t_1 t_0)
(if (<= t_3 INFINITY)
(/ (* d t_2) h)
(/
(fma
d
t_2
(* (* D_m (/ (* D_m (* M_m M_m)) d)) (* -0.125 (/ (* h t_2) l))))
h))))))D_m = fabs(D);
M_m = fabs(M);
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 t_2 = sqrt((h / l));
double t_3 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_3 <= -2e-180) {
tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
} else if (t_3 <= 2e+136) {
tmp = t_1 * t_0;
} else if (t_3 <= ((double) INFINITY)) {
tmp = (d * t_2) / h;
} else {
tmp = fma(d, t_2, ((D_m * ((D_m * (M_m * M_m)) / d)) * (-0.125 * ((h * t_2) / l)))) / h;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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)) t_2 = sqrt(Float64(h / l)) t_3 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_3 <= -2e-180) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0))); elseif (t_3 <= 2e+136) tmp = Float64(t_1 * t_0); elseif (t_3 <= Inf) tmp = Float64(Float64(d * t_2) / h); else tmp = Float64(fma(d, t_2, Float64(Float64(D_m * Float64(Float64(D_m * Float64(M_m * M_m)) / d)) * Float64(-0.125 * Float64(Float64(h * t_2) / l)))) / h); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+136], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(d * t$95$2), $MachinePrecision] / h), $MachinePrecision], N[(N[(d * t$95$2 + N[(N[(D$95$m * N[(N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(N[(h * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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}}\\
t_2 := \sqrt{\frac{h}{\ell}}\\
t_3 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{d \cdot t\_2}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(d, t\_2, \left(D\_m \cdot \frac{D\_m \cdot \left(M\_m \cdot M\_m\right)}{d}\right) \cdot \left(-0.125 \cdot \frac{h \cdot t\_2}{\ell}\right)\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180Initial program 86.4%
Applied rewrites66.6%
if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 90.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
Applied rewrites90.3%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites10.7%
Applied rewrites19.1%
Final simplification66.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_2 -2e-180)
(*
t_0
(*
t_1
(fma
(/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
(* (/ h l) -0.5)
1.0)))
(if (<= t_2 2e+136)
(* t_1 t_0)
(if (<= t_2 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= -2e-180) {
tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
} else if (t_2 <= 2e+136) {
tmp = t_1 * t_0;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_2 <= -2e-180) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0))); elseif (t_2 <= 2e+136) tmp = Float64(t_1 * t_0); elseif (t_2 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+136], N[(t$95$1 * t$95$0), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;t\_1 \cdot t\_0\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180Initial program 86.4%
Applied rewrites66.6%
if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 90.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
Applied rewrites90.3%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification65.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_2 -2e-180)
(*
t_0
(*
t_1
(fma
(/ (* M_m (* D_m (* M_m D_m))) (* 4.0 (* d d)))
(* (/ h l) -0.5)
1.0)))
(if (<= t_2 2e+136)
(* t_0 t_1)
(if (<= t_2 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= -2e-180) {
tmp = t_0 * (t_1 * fma(((M_m * (D_m * (M_m * D_m))) / (4.0 * (d * d))), ((h / l) * -0.5), 1.0));
} else if (t_2 <= 2e+136) {
tmp = t_0 * t_1;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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 / l)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_2 <= -2e-180) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0))); elseif (t_2 <= 2e+136) tmp = Float64(t_0 * t_1); elseif (t_2 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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 / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-180], N[(t$95$0 * N[(t$95$1 * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+136], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(\frac{M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right)\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180Initial program 86.4%
Applied rewrites66.6%
if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 90.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
Applied rewrites90.3%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification65.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 -2e-99)
(/
(* t_0 (/ (* (* D_m D_m) (* -0.125 (* h (* M_m M_m)))) (* d (* d l))))
(sqrt (/ l d)))
(if (<= t_1 2e+136)
(* (sqrt (/ d l)) t_0)
(if (<= t_1 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -2e-99) {
tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / sqrt((l / d));
} else if (t_1 <= 2e+136) {
tmp = sqrt((d / l)) * t_0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
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.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -2e-99) {
tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / Math.sqrt((l / d));
} else if (t_1 <= 2e+136) {
tmp = Math.sqrt((d / l)) * t_0;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_1 <= -2e-99: tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / math.sqrt((l / d)) elif t_1 <= 2e+136: tmp = math.sqrt((d / l)) * t_0 elif t_1 <= math.inf: tmp = (d * math.sqrt((h / l))) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= -2e-99) tmp = Float64(Float64(t_0 * Float64(Float64(Float64(D_m * D_m) * Float64(-0.125 * Float64(h * Float64(M_m * M_m)))) / Float64(d * Float64(d * l)))) / sqrt(Float64(l / d))); elseif (t_1 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * t_0); elseif (t_1 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
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 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_1 <= -2e-99)
tmp = (t_0 * (((D_m * D_m) * (-0.125 * (h * (M_m * M_m)))) / (d * (d * l)))) / sqrt((l / d));
elseif (t_1 <= 2e+136)
tmp = sqrt((d / l)) * t_0;
elseif (t_1 <= Inf)
tmp = (d * sqrt((h / l))) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-99], N[(N[(t$95$0 * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(-0.125 * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-99}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot \left(-0.125 \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}}{\sqrt{\frac{\ell}{d}}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-99Initial program 86.1%
Applied rewrites66.9%
Taylor expanded in M around inf
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6457.4
Applied rewrites57.4%
if -2e-99 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 90.8%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6433.1
Applied rewrites33.1%
Applied rewrites87.7%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification62.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_0 0.0)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* (* M_m (* D_m (* M_m D_m))) 0.125) d))
(if (<= t_0 2e+136)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
} else if (t_0 <= 2e+136) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
} else if (t_0 <= 2e+136) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d) elif t_0 <= 2e+136: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_0 <= math.inf: tmp = (d * math.sqrt((h / l))) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(Float64(M_m * Float64(D_m * Float64(M_m * D_m))) * 0.125) / d)); elseif (t_0 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt(((h / (l * l)) / l)) * (((M_m * (D_m * (M_m * D_m))) * 0.125) / d);
elseif (t_0 <= 2e+136)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (t_0 <= Inf)
tmp = (d * sqrt((h / l))) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{\left(M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right) \cdot 0.125}{d}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 82.8%
Applied rewrites36.0%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites28.5%
Applied rewrites30.5%
Applied rewrites40.3%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 97.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites97.1%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification56.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_0 0.0)
(* (* 0.125 (sqrt (/ h (* l (* l l))))) (* D_m (/ (* M_m (* M_m D_m)) d)))
(if (<= t_0 2e+136)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = (0.125 * sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
} else if (t_0 <= 2e+136) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = (0.125 * Math.sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
} else if (t_0 <= 2e+136) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_0 <= 0.0: tmp = (0.125 * math.sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d)) elif t_0 <= 2e+136: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_0 <= math.inf: tmp = (d * math.sqrt((h / l))) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(0.125 * sqrt(Float64(h / Float64(l * Float64(l * l))))) * Float64(D_m * Float64(Float64(M_m * Float64(M_m * D_m)) / d))); elseif (t_0 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = (0.125 * sqrt((h / (l * (l * l))))) * (D_m * ((M_m * (M_m * D_m)) / d));
elseif (t_0 <= 2e+136)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (t_0 <= Inf)
tmp = (d * sqrt((h / l))) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(0.125 * N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(0.125 \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right) \cdot \left(D\_m \cdot \frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 82.8%
Applied rewrites36.0%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites28.5%
Applied rewrites36.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 97.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites97.1%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification54.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_0 0.0)
(* (sqrt (/ h (* l (* l l)))) (* (* D_m (* D_m (* M_m M_m))) (/ 0.125 d)))
(if (<= t_0 2e+136)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
} else if (t_0 <= 2e+136) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
} else if (t_0 <= 2e+136) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d)) elif t_0 <= 2e+136: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_0 <= math.inf: tmp = (d * math.sqrt((h / l))) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * Float64(D_m * Float64(M_m * M_m))) * Float64(0.125 / d))); elseif (t_0 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt((h / (l * (l * l)))) * ((D_m * (D_m * (M_m * M_m))) * (0.125 / d));
elseif (t_0 <= 2e+136)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (t_0 <= Inf)
tmp = (d * sqrt((h / l))) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.125 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right) \cdot \frac{0.125}{d}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 82.8%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
distribute-neg-fracN/A
Applied rewrites34.4%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 97.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites97.1%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification54.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_0 -5e+251)
(*
(sqrt (/ h (* l (* l l))))
(* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
(if (<= t_0 2e+136)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_0 INFINITY)
(/ (* d (sqrt (/ h l))) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= -5e+251) {
tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
} else if (t_0 <= 2e+136) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (d * sqrt((h / l))) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_0 <= -5e+251) {
tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
} else if (t_0 <= 2e+136) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (d * Math.sqrt((h / l))) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_0 <= -5e+251: tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d)) elif t_0 <= 2e+136: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_0 <= math.inf: tmp = (d * math.sqrt((h / l))) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_0 <= -5e+251) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d))); elseif (t_0 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_0 <= Inf) tmp = Float64(Float64(d * sqrt(Float64(h / l))) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_0 <= -5e+251)
tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
elseif (t_0 <= 2e+136)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (t_0 <= Inf)
tmp = (d * sqrt((h / l))) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+251], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+251}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{d \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5.0000000000000005e251Initial program 84.2%
Taylor expanded in d around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites29.6%
if -5.0000000000000005e251 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 91.9%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6428.0
Applied rewrites28.0%
Applied rewrites72.8%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification50.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 -2e-180)
(/ (* (- d) t_0) h)
(if (<= t_1 2e+136)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(if (<= t_1 INFINITY)
(/ (* d t_0) h)
(* (- d) (sqrt (/ 1.0 (* h l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -2e-180) {
tmp = (-d * t_0) / h;
} else if (t_1 <= 2e+136) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (d * t_0) / h;
} else {
tmp = -d * sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = Math.abs(D);
M_m = Math.abs(M);
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 t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -2e-180) {
tmp = (-d * t_0) / h;
} else if (t_1 <= 2e+136) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (d * t_0) / h;
} else {
tmp = -d * Math.sqrt((1.0 / (h * l)));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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)) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_1 <= -2e-180: tmp = (-d * t_0) / h elif t_1 <= 2e+136: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) elif t_1 <= math.inf: tmp = (d * t_0) / h else: tmp = -d * math.sqrt((1.0 / (h * l))) return tmp
D_m = abs(D) M_m = abs(M) 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)) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= -2e-180) tmp = Float64(Float64(Float64(-d) * t_0) / h); elseif (t_1 <= 2e+136) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); elseif (t_1 <= Inf) tmp = Float64(Float64(d * t_0) / h); else tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
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));
t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_1 <= -2e-180)
tmp = (-d * t_0) / h;
elseif (t_1 <= 2e+136)
tmp = sqrt((d / l)) * sqrt((d / h));
elseif (t_1 <= Inf)
tmp = (d * t_0) / h;
else
tmp = -d * sqrt((1.0 / (h * l)));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-180], N[(N[((-d) * t$95$0), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 2e+136], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(d * t$95$0), $MachinePrecision] / h), $MachinePrecision], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\frac{\left(-d\right) \cdot t\_0}{h}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{d \cdot t\_0}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-180Initial program 86.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites28.3%
Taylor expanded in l around -inf
Applied rewrites22.4%
if -2e-180 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 90.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6434.0
Applied rewrites34.0%
Applied rewrites90.3%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 64.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites30.8%
Taylor expanded in d around inf
Applied rewrites80.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6416.9
Applied rewrites16.9%
Final simplification49.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (/ h l)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
(t_3 (sqrt (/ l d))))
(if (<= t_2 (- INFINITY))
(/
(*
t_0
(fma
(/ (* (* M_m D_m) -0.5) (* l (* d 2.0)))
(/ (* h (* M_m (* D_m 0.5))) d)
1.0))
t_3)
(if (<= t_2 5e+198)
(/
(*
t_0
(fma
(* (/ (* M_m D_m) d) (/ (* M_m D_m) (* d 4.0)))
(* (/ h l) -0.5)
1.0))
t_3)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_1
(* d t_1))
h)))))D_m = fabs(D);
M_m = fabs(M);
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((h / l));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double t_3 = sqrt((l / d));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (t_0 * fma((((M_m * D_m) * -0.5) / (l * (d * 2.0))), ((h * (M_m * (D_m * 0.5))) / d), 1.0)) / t_3;
} else if (t_2 <= 5e+198) {
tmp = (t_0 * fma((((M_m * D_m) / d) * ((M_m * D_m) / (d * 4.0))), ((h / l) * -0.5), 1.0)) / t_3;
} else {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_1, (d * t_1)) / h;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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(h / l)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) t_3 = sqrt(Float64(l / d)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(t_0 * fma(Float64(Float64(Float64(M_m * D_m) * -0.5) / Float64(l * Float64(d * 2.0))), Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / d), 1.0)) / t_3); elseif (t_2 <= 5e+198) tmp = Float64(Float64(t_0 * fma(Float64(Float64(Float64(M_m * D_m) / d) * Float64(Float64(M_m * D_m) / Float64(d * 4.0))), Float64(Float64(h / l) * -0.5), 1.0)) / t_3); else tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_1, Float64(d * t_1)) / h); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(t$95$0 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, 5e+198], N[(N[(t$95$0 * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(d * t$95$1), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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{h}{\ell}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
t_3 := \sqrt{\frac{\ell}{d}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{t\_3}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+198}:\\
\;\;\;\;\frac{t\_0 \cdot \mathsf{fma}\left(\frac{M\_m \cdot D\_m}{d} \cdot \frac{M\_m \cdot D\_m}{d \cdot 4}, \frac{h}{\ell} \cdot -0.5, 1\right)}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0Initial program 83.6%
Applied rewrites71.4%
Applied rewrites91.9%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 5.00000000000000049e198Initial program 92.6%
Applied rewrites65.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f6491.7
Applied rewrites91.7%
if 5.00000000000000049e198 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 27.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.7%
Applied rewrites36.4%
Applied rewrites45.2%
Final simplification75.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))
2e+136)
(*
(-
1.0
(*
(/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
(* h (/ (* 0.5 (* M_m D_m)) d))))
(* (sqrt (/ d l)) (sqrt (/ d h))))
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_0
(* d t_0))
h))))D_m = fabs(D);
M_m = fabs(M);
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 (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))) <= 2e+136) {
tmp = (1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)))) * (sqrt((d / l)) * sqrt((d / h)));
} else {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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 (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) <= 2e+136) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d)))) * Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h)))); else tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+136], N[(N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;\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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 2 \cdot 10^{+136}:\\
\;\;\;\;\left(1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2.00000000000000012e136Initial program 88.1%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites92.8%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6492.8
Applied rewrites92.8%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6492.8
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6492.8
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6492.8
Applied rewrites92.8%
lift-/.f64N/A
metadata-eval92.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6492.8
Applied rewrites92.8%
if 2.00000000000000012e136 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 32.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites20.7%
Applied rewrites39.3%
Applied rewrites48.5%
Final simplification76.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_1
(-
1.0
(*
(/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
(* h (/ (* 0.5 (* M_m D_m)) d))))))
(if (<= d -8.2e-193)
(* (* (/ (sqrt (- d)) (sqrt (- h))) (sqrt (/ d l))) t_1)
(if (<= d 8e-289)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_0
(* d t_0))
h)
(* t_1 (* (pow (/ d h) (/ 1.0 2.0)) (/ (sqrt d) (sqrt l))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_1 = 1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
double tmp;
if (d <= -8.2e-193) {
tmp = ((sqrt(-d) / sqrt(-h)) * sqrt((d / l))) * t_1;
} else if (d <= 8e-289) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
} else {
tmp = t_1 * (pow((d / h), (1.0 / 2.0)) * (sqrt(d) / sqrt(l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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)) t_1 = Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d)))) tmp = 0.0 if (d <= -8.2e-193) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * sqrt(Float64(d / l))) * t_1); elseif (d <= 8e-289) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h); else tmp = Float64(t_1 * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * Float64(sqrt(d) / sqrt(l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$1 = N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e-193], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[d, 8e-289], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$1 * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
\mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_1\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-289}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right)\\
\end{array}
\end{array}
if d < -8.20000000000000005e-193Initial program 73.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites80.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6480.1
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6480.1
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
metadata-eval80.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6491.4
Applied rewrites91.4%
if -8.20000000000000005e-193 < d < 8.0000000000000001e-289Initial program 31.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites17.7%
Applied rewrites44.9%
Applied rewrites59.8%
if 8.0000000000000001e-289 < d Initial program 70.8%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.4%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6479.4
Applied rewrites79.4%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6479.4
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6479.4
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6479.4
Applied rewrites79.4%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6485.9
Applied rewrites85.9%
Final simplification84.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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
(*
(/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
(* h (/ (* 0.5 (* M_m D_m)) d)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ h l))))
(if (<= d -6.2e+156)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -6.6e-188)
(* t_0 (* t_1 (sqrt (/ d h))))
(if (<= d 2.5e-237)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_2
(* d t_2))
h)
(* t_0 (* t_1 (/ (sqrt d) (sqrt h)))))))))D_m = fabs(D);
M_m = fabs(M);
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 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((h / l));
double tmp;
if (d <= -6.2e+156) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -6.6e-188) {
tmp = t_0 * (t_1 * sqrt((d / h)));
} else if (d <= 2.5e-237) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_2, (d * t_2)) / h;
} else {
tmp = t_0 * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -6.2e+156) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -6.6e-188) tmp = Float64(t_0 * Float64(t_1 * sqrt(Float64(d / h)))); elseif (d <= 2.5e-237) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_2, Float64(d * t_2)) / h); else tmp = Float64(t_0 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -6.2e+156], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6.6e-188], N[(t$95$0 * N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.5e-237], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(d * t$95$2), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$0 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -6.2 \cdot 10^{+156}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -6.6 \cdot 10^{-188}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \sqrt{\frac{d}{h}}\right)\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -6.2000000000000004e156Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -6.2000000000000004e156 < d < -6.6000000000000005e-188Initial program 79.3%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites87.4%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.4
Applied rewrites87.4%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6487.4
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6487.4
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6487.4
Applied rewrites87.4%
lift-/.f64N/A
metadata-eval87.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6487.4
Applied rewrites87.4%
if -6.6000000000000005e-188 < d < 2.5000000000000001e-237Initial program 36.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.9%
Applied rewrites43.9%
Applied rewrites54.2%
if 2.5000000000000001e-237 < d Initial program 74.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites85.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6485.1
Applied rewrites85.1%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6485.1
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6485.1
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6485.1
Applied rewrites85.1%
lift-/.f64N/A
metadata-eval85.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6492.0
Applied rewrites92.0%
Final simplification81.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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))
(fma
(/ (* (* M_m D_m) -0.5) (* l (* d 2.0)))
(/ (* h (* M_m (* D_m 0.5))) d)
1.0))
(sqrt (/ l d))))
(t_1 (sqrt (/ h l))))
(if (<= d -3.7e+149)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -6.8e-132)
t_0
(if (<= d 4.4e-231)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_1
(* d t_1))
h)
(if (<= d 3.2e+224) t_0 (/ d (* (sqrt l) (sqrt h)))))))))D_m = fabs(D);
M_m = fabs(M);
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)) * fma((((M_m * D_m) * -0.5) / (l * (d * 2.0))), ((h * (M_m * (D_m * 0.5))) / d), 1.0)) / sqrt((l / d));
double t_1 = sqrt((h / l));
double tmp;
if (d <= -3.7e+149) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -6.8e-132) {
tmp = t_0;
} else if (d <= 4.4e-231) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_1, (d * t_1)) / h;
} else if (d <= 3.2e+224) {
tmp = t_0;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(sqrt(Float64(d / h)) * fma(Float64(Float64(Float64(M_m * D_m) * -0.5) / Float64(l * Float64(d * 2.0))), Float64(Float64(h * Float64(M_m * Float64(D_m * 0.5))) / d), 1.0)) / sqrt(Float64(l / d))) t_1 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -3.7e+149) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -6.8e-132) tmp = t_0; elseif (d <= 4.4e-231) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_1, Float64(d * t_1)) / h); elseif (d <= 3.2e+224) tmp = t_0; else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(M$95$m * D$95$m), $MachinePrecision] * -0.5), $MachinePrecision] / N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.7e+149], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6.8e-132], t$95$0, If[LessEqual[d, 4.4e-231], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1 + N[(d * t$95$1), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 3.2e+224], t$95$0, N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(\frac{\left(M\_m \cdot D\_m\right) \cdot -0.5}{\ell \cdot \left(d \cdot 2\right)}, \frac{h \cdot \left(M\_m \cdot \left(D\_m \cdot 0.5\right)\right)}{d}, 1\right)}{\sqrt{\frac{\ell}{d}}}\\
t_1 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -3.7 \cdot 10^{+149}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -6.8 \cdot 10^{-132}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d \leq 4.4 \cdot 10^{-231}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_1, d \cdot t\_1\right)}{h}\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{+224}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.69999999999999978e149Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -3.69999999999999978e149 < d < -6.79999999999999965e-132 or 4.40000000000000018e-231 < d < 3.20000000000000015e224Initial program 79.9%
Applied rewrites69.3%
Applied rewrites84.9%
if -6.79999999999999965e-132 < d < 4.40000000000000018e-231Initial program 40.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites21.6%
Applied rewrites46.3%
Applied rewrites54.4%
if 3.20000000000000015e224 < d Initial program 61.7%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6467.0
Applied rewrites67.0%
Applied rewrites67.0%
Applied rewrites86.2%
Final simplification76.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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)))
(t_1 (sqrt (/ d l)))
(t_2
(-
1.0
(*
(/ (/ (* M_m (* D_m 0.5)) (* d 2.0)) l)
(* h (/ (* 0.5 (* M_m D_m)) d))))))
(if (<= d -8.2e-193)
(* (* (/ (sqrt (- d)) (sqrt (- h))) t_1) t_2)
(if (<= d 2.5e-237)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_0
(* d t_0))
h)
(* t_2 (* t_1 (/ (sqrt d) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
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 t_1 = sqrt((d / l));
double t_2 = 1.0 - ((((M_m * (D_m * 0.5)) / (d * 2.0)) / l) * (h * ((0.5 * (M_m * D_m)) / d)));
double tmp;
if (d <= -8.2e-193) {
tmp = ((sqrt(-d) / sqrt(-h)) * t_1) * t_2;
} else if (d <= 2.5e-237) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
} else {
tmp = t_2 * (t_1 * (sqrt(d) / sqrt(h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) 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)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(1.0 - Float64(Float64(Float64(Float64(M_m * Float64(D_m * 0.5)) / Float64(d * 2.0)) / l) * Float64(h * Float64(Float64(0.5 * Float64(M_m * D_m)) / d)))) tmp = 0.0 if (d <= -8.2e-193) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))) * t_1) * t_2); elseif (d <= 2.5e-237) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h); else tmp = Float64(t_2 * Float64(t_1 * Float64(sqrt(d) / sqrt(h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - N[(N[(N[(N[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(h * N[(N[(0.5 * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.2e-193], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 2.5e-237], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := 1 - \frac{\frac{M\_m \cdot \left(D\_m \cdot 0.5\right)}{d \cdot 2}}{\ell} \cdot \left(h \cdot \frac{0.5 \cdot \left(M\_m \cdot D\_m\right)}{d}\right)\\
\mathbf{if}\;d \leq -8.2 \cdot 10^{-193}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-h}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-237}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \frac{\sqrt{d}}{\sqrt{h}}\right)\\
\end{array}
\end{array}
if d < -8.20000000000000005e-193Initial program 73.5%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites80.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6480.1
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6480.1
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
metadata-eval80.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6491.4
Applied rewrites91.4%
if -8.20000000000000005e-193 < d < 2.5000000000000001e-237Initial program 36.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.9%
Applied rewrites43.9%
Applied rewrites54.2%
if 2.5000000000000001e-237 < d Initial program 74.4%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites85.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6485.1
Applied rewrites85.1%
lift-/.f64N/A
div-invN/A
lift-/.f64N/A
remove-double-divN/A
lower-*.f6485.1
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
div-invN/A
metadata-evalN/A
associate-*r*N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f6485.1
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f6485.1
Applied rewrites85.1%
lift-/.f64N/A
metadata-eval85.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6492.0
Applied rewrites92.0%
Final simplification84.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* M_m (* D_m 0.5)))
(t_2
(/
(* t_0 (- 1.0 (/ (* t_1 (* h t_1)) (* d (* l (* d 2.0))))))
(sqrt (/ l d))))
(t_3 (sqrt (/ h l))))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -7.3e-131)
t_2
(if (<= d 6.6e-161)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_3
(* d t_3))
h)
(if (<= d 4.8e+130)
t_2
(*
(* (sqrt (/ d l)) t_0)
(-
1.0
(*
(* (/ D_m d) (* (* M_m M_m) 0.25))
(* (/ D_m d) (* 0.5 (/ h l))))))))))))D_m = fabs(D);
M_m = fabs(M);
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 = M_m * (D_m * 0.5);
double t_2 = (t_0 * (1.0 - ((t_1 * (h * t_1)) / (d * (l * (d * 2.0)))))) / sqrt((l / d));
double t_3 = sqrt((h / l));
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -7.3e-131) {
tmp = t_2;
} else if (d <= 6.6e-161) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_3, (d * t_3)) / h;
} else if (d <= 4.8e+130) {
tmp = t_2;
} else {
tmp = (sqrt((d / l)) * t_0) * (1.0 - (((D_m / d) * ((M_m * M_m) * 0.25)) * ((D_m / d) * (0.5 * (h / l)))));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(M_m * Float64(D_m * 0.5)) t_2 = Float64(Float64(t_0 * Float64(1.0 - Float64(Float64(t_1 * Float64(h * t_1)) / Float64(d * Float64(l * Float64(d * 2.0)))))) / sqrt(Float64(l / d))) t_3 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -7.3e-131) tmp = t_2; elseif (d <= 6.6e-161) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_3, Float64(d * t_3)) / h); elseif (d <= 4.8e+130) tmp = t_2; else tmp = Float64(Float64(sqrt(Float64(d / l)) * t_0) * Float64(1.0 - Float64(Float64(Float64(D_m / d) * Float64(Float64(M_m * M_m) * 0.25)) * Float64(Float64(D_m / d) * Float64(0.5 * Float64(h / l)))))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * N[(1.0 - N[(N[(t$95$1 * N[(h * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], t$95$2, If[LessEqual[d, 6.6e-161], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$3 + N[(d * t$95$3), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 4.8e+130], t$95$2, N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 - N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\
t_2 := \frac{t\_0 \cdot \left(1 - \frac{t\_1 \cdot \left(h \cdot t\_1\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\
t_3 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_3, d \cdot t\_3\right)}{h}\\
\mathbf{elif}\;d \leq 4.8 \cdot 10^{+130}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot t\_0\right) \cdot \left(1 - \left(\frac{D\_m}{d} \cdot \left(\left(M\_m \cdot M\_m\right) \cdot 0.25\right)\right) \cdot \left(\frac{D\_m}{d} \cdot \left(0.5 \cdot \frac{h}{\ell}\right)\right)\right)\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -7.3000000000000001e-131 or 6.5999999999999997e-161 < d < 4.80000000000000048e130Initial program 82.0%
Applied rewrites75.8%
Applied rewrites85.3%
if -7.3000000000000001e-131 < d < 6.5999999999999997e-161Initial program 38.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.7%
Applied rewrites44.0%
Applied rewrites51.1%
if 4.80000000000000048e130 < d Initial program 79.0%
Applied rewrites72.8%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6472.8
Applied rewrites72.8%
lift-/.f64N/A
metadata-eval72.8
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6472.8
Applied rewrites72.8%
Final simplification73.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* M_m (* D_m 0.5)))
(t_1
(/
(*
(sqrt (/ d h))
(- 1.0 (/ (* t_0 (* h t_0)) (* d (* l (* d 2.0))))))
(sqrt (/ l d))))
(t_2 (sqrt (/ h l))))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -7.3e-131)
t_1
(if (<= d 6.6e-161)
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_2
(* d t_2))
h)
(if (<= d 2.1e+191) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 = M_m * (D_m * 0.5);
double t_1 = (sqrt((d / h)) * (1.0 - ((t_0 * (h * t_0)) / (d * (l * (d * 2.0)))))) / sqrt((l / d));
double t_2 = sqrt((h / l));
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -7.3e-131) {
tmp = t_1;
} else if (d <= 6.6e-161) {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_2, (d * t_2)) / h;
} else if (d <= 2.1e+191) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(M_m * Float64(D_m * 0.5)) t_1 = Float64(Float64(sqrt(Float64(d / h)) * Float64(1.0 - Float64(Float64(t_0 * Float64(h * t_0)) / Float64(d * Float64(l * Float64(d * 2.0)))))) / sqrt(Float64(l / d))) t_2 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -7.3e-131) tmp = t_1; elseif (d <= 6.6e-161) tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_2, Float64(d * t_2)) / h); elseif (d <= 2.1e+191) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(M$95$m * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 - N[(N[(t$95$0 * N[(h * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(d * N[(l * N[(d * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(l / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], t$95$1, If[LessEqual[d, 6.6e-161], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$2 + N[(d * t$95$2), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 2.1e+191], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := M\_m \cdot \left(D\_m \cdot 0.5\right)\\
t_1 := \frac{\sqrt{\frac{d}{h}} \cdot \left(1 - \frac{t\_0 \cdot \left(h \cdot t\_0\right)}{d \cdot \left(\ell \cdot \left(d \cdot 2\right)\right)}\right)}{\sqrt{\frac{\ell}{d}}}\\
t_2 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{-161}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_2, d \cdot t\_2\right)}{h}\\
\mathbf{elif}\;d \leq 2.1 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -7.3000000000000001e-131 or 6.5999999999999997e-161 < d < 2.1000000000000001e191Initial program 83.5%
Applied rewrites74.8%
Applied rewrites85.0%
if -7.3000000000000001e-131 < d < 6.5999999999999997e-161Initial program 38.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.7%
Applied rewrites44.0%
Applied rewrites51.1%
if 2.1000000000000001e191 < d Initial program 68.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6466.9
Applied rewrites66.9%
Applied rewrites80.5%
Final simplification74.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* d 4.0)))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (* D_m (* M_m D_m)))
(t_4 (* M_m t_3)))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -5.7e-133)
(* t_1 (* t_2 (fma 0.5 (/ (* t_3 (* h M_m)) (* t_0 (- l))) 1.0)))
(if (<= d 9.2e-294)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* t_4 0.125) d))
(if (<= d 1.8e-189)
(/
(fma
(* (/ t_4 d) (* h (sqrt (/ h (* l (* l l))))))
-0.125
(* d (sqrt (/ h l))))
h)
(if (<= d 3e+108)
(* t_2 (* t_1 (+ 1.0 (/ (* t_4 (* h -0.5)) (* l t_0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))D_m = fabs(D);
M_m = fabs(M);
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 * (d * 4.0);
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = D_m * (M_m * D_m);
double t_4 = M_m * t_3;
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -5.7e-133) {
tmp = t_1 * (t_2 * fma(0.5, ((t_3 * (h * M_m)) / (t_0 * -l)), 1.0));
} else if (d <= 9.2e-294) {
tmp = sqrt(((h / (l * l)) / l)) * ((t_4 * 0.125) / d);
} else if (d <= 1.8e-189) {
tmp = fma(((t_4 / d) * (h * sqrt((h / (l * (l * l)))))), -0.125, (d * sqrt((h / l)))) / h;
} else if (d <= 3e+108) {
tmp = t_2 * (t_1 * (1.0 + ((t_4 * (h * -0.5)) / (l * t_0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * Float64(d * 4.0)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(D_m * Float64(M_m * D_m)) t_4 = Float64(M_m * t_3) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -5.7e-133) tmp = Float64(t_1 * Float64(t_2 * fma(0.5, Float64(Float64(t_3 * Float64(h * M_m)) / Float64(t_0 * Float64(-l))), 1.0))); elseif (d <= 9.2e-294) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_4 * 0.125) / d)); elseif (d <= 1.8e-189) tmp = Float64(fma(Float64(Float64(t_4 / d) * Float64(h * sqrt(Float64(h / Float64(l * Float64(l * l)))))), -0.125, Float64(d * sqrt(Float64(h / l)))) / h); elseif (d <= 3e+108) tmp = Float64(t_2 * Float64(t_1 * Float64(1.0 + Float64(Float64(t_4 * Float64(h * -0.5)) / Float64(l * t_0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(d * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M$95$m * t$95$3), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], N[(t$95$1 * N[(t$95$2 * N[(0.5 * N[(N[(t$95$3 * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-294], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$4 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.8e-189], N[(N[(N[(N[(t$95$4 / d), $MachinePrecision] * N[(h * N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.125 + N[(d * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 3e+108], N[(t$95$2 * N[(t$95$1 * N[(1.0 + N[(N[(t$95$4 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(d \cdot 4\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\
t_4 := M\_m \cdot t\_3\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-294}:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\
\mathbf{elif}\;d \leq 1.8 \cdot 10^{-189}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{t\_4}{d} \cdot \left(h \cdot \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\right), -0.125, d \cdot \sqrt{\frac{h}{\ell}}\right)}{h}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -5.6999999999999997e-133Initial program 82.3%
Applied rewrites57.3%
Applied rewrites78.8%
if -5.6999999999999997e-133 < d < 9.20000000000000064e-294Initial program 37.8%
Applied rewrites2.4%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites30.7%
Applied rewrites30.8%
Applied rewrites47.1%
if 9.20000000000000064e-294 < d < 1.80000000000000008e-189Initial program 41.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites24.6%
Applied rewrites38.2%
if 1.80000000000000008e-189 < d < 2.99999999999999984e108Initial program 77.4%
Applied rewrites69.0%
Applied rewrites73.5%
if 2.99999999999999984e108 < d Initial program 78.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites74.0%
Final simplification67.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* d 4.0)))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (* D_m (* M_m D_m)))
(t_4 (* M_m t_3)))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -5.7e-133)
(* t_1 (* t_2 (fma 0.5 (/ (* t_3 (* h M_m)) (* t_0 (- l))) 1.0)))
(if (<= d 9.2e-302)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* t_4 0.125) d))
(if (<= d 1.15e-231)
(*
(sqrt (/ h (* l (* l l))))
(* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
(if (<= d 3e+108)
(* t_2 (* t_1 (+ 1.0 (/ (* t_4 (* h -0.5)) (* l t_0)))))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))D_m = fabs(D);
M_m = fabs(M);
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 * (d * 4.0);
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = D_m * (M_m * D_m);
double t_4 = M_m * t_3;
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -5.7e-133) {
tmp = t_1 * (t_2 * fma(0.5, ((t_3 * (h * M_m)) / (t_0 * -l)), 1.0));
} else if (d <= 9.2e-302) {
tmp = sqrt(((h / (l * l)) / l)) * ((t_4 * 0.125) / d);
} else if (d <= 1.15e-231) {
tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
} else if (d <= 3e+108) {
tmp = t_2 * (t_1 * (1.0 + ((t_4 * (h * -0.5)) / (l * t_0))));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d * Float64(d * 4.0)) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(D_m * Float64(M_m * D_m)) t_4 = Float64(M_m * t_3) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -5.7e-133) tmp = Float64(t_1 * Float64(t_2 * fma(0.5, Float64(Float64(t_3 * Float64(h * M_m)) / Float64(t_0 * Float64(-l))), 1.0))); elseif (d <= 9.2e-302) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_4 * 0.125) / d)); elseif (d <= 1.15e-231) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d))); elseif (d <= 3e+108) tmp = Float64(t_2 * Float64(t_1 * Float64(1.0 + Float64(Float64(t_4 * Float64(h * -0.5)) / Float64(l * t_0))))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(d * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(M$95$m * t$95$3), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], N[(t$95$1 * N[(t$95$2 * N[(0.5 * N[(N[(t$95$3 * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-302], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$4 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-231], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+108], N[(t$95$2 * N[(t$95$1 * N[(1.0 + N[(N[(t$95$4 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := d \cdot \left(d \cdot 4\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := D\_m \cdot \left(M\_m \cdot D\_m\right)\\
t_4 := M\_m \cdot t\_3\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \mathsf{fma}\left(0.5, \frac{t\_3 \cdot \left(h \cdot M\_m\right)}{t\_0 \cdot \left(-\ell\right)}, 1\right)\right)\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_4 \cdot 0.125}{d}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
\;\;\;\;t\_2 \cdot \left(t\_1 \cdot \left(1 + \frac{t\_4 \cdot \left(h \cdot -0.5\right)}{\ell \cdot t\_0}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -5.6999999999999997e-133Initial program 82.3%
Applied rewrites57.3%
Applied rewrites78.8%
if -5.6999999999999997e-133 < d < 9.20000000000000007e-302Initial program 38.7%
Applied rewrites2.4%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites31.3%
Applied rewrites31.5%
Applied rewrites48.1%
if 9.20000000000000007e-302 < d < 1.15e-231Initial program 43.2%
Taylor expanded in d around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites43.9%
if 1.15e-231 < d < 2.99999999999999984e108Initial program 74.1%
Applied rewrites66.1%
Applied rewrites68.8%
if 2.99999999999999984e108 < d Initial program 78.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites74.0%
Final simplification67.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* M_m (* D_m (* M_m D_m))))
(t_1
(*
(sqrt (/ d l))
(*
(sqrt (/ d h))
(+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0)))))))))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -5.7e-133)
t_1
(if (<= d 9.2e-302)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
(if (<= d 1.15e-231)
(*
(sqrt (/ h (* l (* l l))))
(* (* D_m D_m) (/ (* -0.125 (* M_m M_m)) d)))
(if (<= d 3e+108) t_1 (* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))))D_m = fabs(D);
M_m = fabs(M);
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 = M_m * (D_m * (M_m * D_m));
double t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -5.7e-133) {
tmp = t_1;
} else if (d <= 9.2e-302) {
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
} else if (d <= 1.15e-231) {
tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
} else if (d <= 3e+108) {
tmp = t_1;
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = m_m * (d_m * (m_m * d_m))
t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0d0 + ((t_0 * (h * (-0.5d0))) / (l * (d * (d * 4.0d0))))))
if (d <= (-1.66d+146)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= (-5.7d-133)) then
tmp = t_1
else if (d <= 9.2d-302) then
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125d0) / d)
else if (d <= 1.15d-231) then
tmp = sqrt((h / (l * (l * l)))) * ((d_m * d_m) * (((-0.125d0) * (m_m * m_m)) / d))
else if (d <= 3d+108) then
tmp = t_1
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
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 = M_m * (D_m * (M_m * D_m));
double t_1 = Math.sqrt((d / l)) * (Math.sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
double tmp;
if (d <= -1.66e+146) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= -5.7e-133) {
tmp = t_1;
} else if (d <= 9.2e-302) {
tmp = Math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
} else if (d <= 1.15e-231) {
tmp = Math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
} else if (d <= 3e+108) {
tmp = t_1;
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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 = M_m * (D_m * (M_m * D_m)) t_1 = math.sqrt((d / l)) * (math.sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) tmp = 0 if d <= -1.66e+146: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= -5.7e-133: tmp = t_1 elif d <= 9.2e-302: tmp = math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d) elif d <= 1.15e-231: tmp = math.sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d)) elif d <= 3e+108: tmp = t_1 else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m))) t_1 = Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(d / h)) * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0))))))) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -5.7e-133) tmp = t_1; elseif (d <= 9.2e-302) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d)); elseif (d <= 1.15e-231) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(D_m * D_m) * Float64(Float64(-0.125 * Float64(M_m * M_m)) / d))); elseif (d <= 3e+108) tmp = t_1; else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = M_m * (D_m * (M_m * D_m));
t_1 = sqrt((d / l)) * (sqrt((d / h)) * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0))))));
tmp = 0.0;
if (d <= -1.66e+146)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= -5.7e-133)
tmp = t_1;
elseif (d <= 9.2e-302)
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
elseif (d <= 1.15e-231)
tmp = sqrt((h / (l * (l * l)))) * ((D_m * D_m) * ((-0.125 * (M_m * M_m)) / d));
elseif (d <= 3e+108)
tmp = t_1;
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5.7e-133], t$95$1, If[LessEqual[d, 9.2e-302], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-231], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+108], t$95$1, N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \left(\sqrt{\frac{d}{h}} \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)\right)\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5.7 \cdot 10^{-133}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-302}:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-231}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot \frac{-0.125 \cdot \left(M\_m \cdot M\_m\right)}{d}\right)\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -5.6999999999999997e-133 or 1.15e-231 < d < 2.99999999999999984e108Initial program 78.2%
Applied rewrites71.4%
Applied rewrites73.8%
if -5.6999999999999997e-133 < d < 9.20000000000000007e-302Initial program 38.7%
Applied rewrites2.4%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites31.3%
Applied rewrites31.5%
Applied rewrites48.1%
if 9.20000000000000007e-302 < d < 1.15e-231Initial program 43.2%
Taylor expanded in d around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites43.9%
if 2.99999999999999984e108 < d Initial program 78.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6460.3
Applied rewrites60.3%
Applied rewrites74.0%
Final simplification67.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ h l))))
(if (<= d -1.66e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -7.3e-131)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(fma
0.5
(/ (* (* D_m (* M_m D_m)) (* h M_m)) (* (* d (* d 4.0)) (- l)))
1.0)))
(/
(fma
(* (* D_m (* (/ (* M_m (* M_m D_m)) d) -0.125)) (/ h l))
t_0
(* d t_0))
h)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((h / l));
double tmp;
if (d <= -1.66e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -7.3e-131) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(0.5, (((D_m * (M_m * D_m)) * (h * M_m)) / ((d * (d * 4.0)) * -l)), 1.0));
} else {
tmp = fma(((D_m * (((M_m * (M_m * D_m)) / d) * -0.125)) * (h / l)), t_0, (d * t_0)) / h;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -1.66e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -7.3e-131) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(0.5, Float64(Float64(Float64(D_m * Float64(M_m * D_m)) * Float64(h * M_m)) / Float64(Float64(d * Float64(d * 4.0)) * Float64(-l))), 1.0))); else tmp = Float64(fma(Float64(Float64(D_m * Float64(Float64(Float64(M_m * Float64(M_m * D_m)) / d) * -0.125)) * Float64(h / l)), t_0, Float64(d * t_0)) / h); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.66e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.3e-131], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(0.5 * N[(N[(N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision] * (-l)), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(D$95$m * N[(N[(N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + N[(d * t$95$0), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -1.66 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -7.3 \cdot 10^{-131}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(0.5, \frac{\left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right) \cdot \left(h \cdot M\_m\right)}{\left(d \cdot \left(d \cdot 4\right)\right) \cdot \left(-\ell\right)}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(D\_m \cdot \left(\frac{M\_m \cdot \left(M\_m \cdot D\_m\right)}{d} \cdot -0.125\right)\right) \cdot \frac{h}{\ell}, t\_0, d \cdot t\_0\right)}{h}\\
\end{array}
\end{array}
if d < -1.6600000000000001e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.6600000000000001e146 < d < -7.3000000000000001e-131Initial program 82.3%
Applied rewrites57.3%
Applied rewrites78.8%
if -7.3000000000000001e-131 < d Initial program 61.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites24.2%
Applied rewrites53.3%
Applied rewrites62.2%
Final simplification68.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* M_m (* D_m (* M_m D_m)))))
(if (<= d -1.65e+146)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d -2.15e-156)
(*
(fma (/ t_0 (* 4.0 (* d d))) (* (/ h l) -0.5) 1.0)
(sqrt (/ (* d d) (* h l))))
(if (<= d 3.5e-246)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
(if (<= d 3e+113)
(/
(* d (+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0))))))
(sqrt (* h l)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l)))))))))D_m = fabs(D);
M_m = fabs(M);
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 = M_m * (D_m * (M_m * D_m));
double tmp;
if (d <= -1.65e+146) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= -2.15e-156) {
tmp = fma((t_0 / (4.0 * (d * d))), ((h / l) * -0.5), 1.0) * sqrt(((d * d) / (h * l)));
} else if (d <= 3.5e-246) {
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
} else if (d <= 3e+113) {
tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m))) tmp = 0.0 if (d <= -1.65e+146) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= -2.15e-156) tmp = Float64(fma(Float64(t_0 / Float64(4.0 * Float64(d * d))), Float64(Float64(h / l) * -0.5), 1.0) * sqrt(Float64(Float64(d * d) / Float64(h * l)))); elseif (d <= 3.5e-246) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d)); elseif (d <= 3e+113) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0)))))) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.65e+146], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.15e-156], N[(N[(N[(t$95$0 / N[(4.0 * N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d * d), $MachinePrecision] / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e-246], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+113], N[(N[(d * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
\mathbf{if}\;d \leq -1.65 \cdot 10^{+146}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -2.15 \cdot 10^{-156}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t\_0}{4 \cdot \left(d \cdot d\right)}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \sqrt{\frac{d \cdot d}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\
\;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.65000000000000008e146Initial program 61.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.65000000000000008e146 < d < -2.14999999999999989e-156Initial program 81.3%
Applied rewrites57.6%
if -2.14999999999999989e-156 < d < 3.5000000000000002e-246Initial program 37.7%
Applied rewrites0.0%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites28.4%
Applied rewrites28.5%
Applied rewrites41.5%
if 3.5000000000000002e-246 < d < 3e113Initial program 73.6%
Applied rewrites64.7%
Applied rewrites64.6%
if 3e113 < d Initial program 77.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6459.2
Applied rewrites59.2%
Applied rewrites73.2%
Final simplification60.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
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 (* M_m (* D_m (* M_m D_m)))))
(if (<= d -1.9e+45)
(* (- d) (sqrt (/ 1.0 (* h l))))
(if (<= d 3.5e-246)
(* (sqrt (/ (/ h (* l l)) l)) (/ (* t_0 0.125) d))
(if (<= d 3e+113)
(/
(* d (+ 1.0 (/ (* t_0 (* h -0.5)) (* l (* d (* d 4.0))))))
(sqrt (* h l)))
(* d (/ (sqrt (/ 1.0 h)) (sqrt l))))))))D_m = fabs(D);
M_m = fabs(M);
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 = M_m * (D_m * (M_m * D_m));
double tmp;
if (d <= -1.9e+45) {
tmp = -d * sqrt((1.0 / (h * l)));
} else if (d <= 3.5e-246) {
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
} else if (d <= 3e+113) {
tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
} else {
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = m_m * (d_m * (m_m * d_m))
if (d <= (-1.9d+45)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else if (d <= 3.5d-246) then
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125d0) / d)
else if (d <= 3d+113) then
tmp = (d * (1.0d0 + ((t_0 * (h * (-0.5d0))) / (l * (d * (d * 4.0d0)))))) / sqrt((h * l))
else
tmp = d * (sqrt((1.0d0 / h)) / sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
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 = M_m * (D_m * (M_m * D_m));
double tmp;
if (d <= -1.9e+45) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else if (d <= 3.5e-246) {
tmp = Math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
} else if (d <= 3e+113) {
tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / Math.sqrt((h * l));
} else {
tmp = d * (Math.sqrt((1.0 / h)) / Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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 = M_m * (D_m * (M_m * D_m)) tmp = 0 if d <= -1.9e+45: tmp = -d * math.sqrt((1.0 / (h * l))) elif d <= 3.5e-246: tmp = math.sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d) elif d <= 3e+113: tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / math.sqrt((h * l)) else: tmp = d * (math.sqrt((1.0 / h)) / math.sqrt(l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(M_m * Float64(D_m * Float64(M_m * D_m))) tmp = 0.0 if (d <= -1.9e+45) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); elseif (d <= 3.5e-246) tmp = Float64(sqrt(Float64(Float64(h / Float64(l * l)) / l)) * Float64(Float64(t_0 * 0.125) / d)); elseif (d <= 3e+113) tmp = Float64(Float64(d * Float64(1.0 + Float64(Float64(t_0 * Float64(h * -0.5)) / Float64(l * Float64(d * Float64(d * 4.0)))))) / sqrt(Float64(h * l))); else tmp = Float64(d * Float64(sqrt(Float64(1.0 / h)) / sqrt(l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = M_m * (D_m * (M_m * D_m));
tmp = 0.0;
if (d <= -1.9e+45)
tmp = -d * sqrt((1.0 / (h * l)));
elseif (d <= 3.5e-246)
tmp = sqrt(((h / (l * l)) / l)) * ((t_0 * 0.125) / d);
elseif (d <= 3e+113)
tmp = (d * (1.0 + ((t_0 * (h * -0.5)) / (l * (d * (d * 4.0)))))) / sqrt((h * l));
else
tmp = d * (sqrt((1.0 / h)) / sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $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[(M$95$m * N[(D$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.9e+45], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.5e-246], N[(N[Sqrt[N[(N[(h / N[(l * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * 0.125), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3e+113], N[(N[(d * N[(1.0 + N[(N[(t$95$0 * N[(h * -0.5), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d * N[(N[Sqrt[N[(1.0 / h), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := M\_m \cdot \left(D\_m \cdot \left(M\_m \cdot D\_m\right)\right)\\
\mathbf{if}\;d \leq -1.9 \cdot 10^{+45}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;d \leq 3.5 \cdot 10^{-246}:\\
\;\;\;\;\sqrt{\frac{\frac{h}{\ell \cdot \ell}}{\ell}} \cdot \frac{t\_0 \cdot 0.125}{d}\\
\mathbf{elif}\;d \leq 3 \cdot 10^{+113}:\\
\;\;\;\;\frac{d \cdot \left(1 + \frac{t\_0 \cdot \left(h \cdot -0.5\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}\right)}{\sqrt{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;d \cdot \frac{\sqrt{\frac{1}{h}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.9000000000000001e45Initial program 70.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6468.0
Applied rewrites68.0%
if -1.9000000000000001e45 < d < 3.5000000000000002e-246Initial program 56.4%
Applied rewrites26.5%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
distribute-lft-neg-inN/A
associate-/l*N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
Applied rewrites30.5%
Applied rewrites31.6%
Applied rewrites41.9%
if 3.5000000000000002e-246 < d < 3e113Initial program 73.6%
Applied rewrites64.7%
Applied rewrites64.6%
if 3e113 < d Initial program 77.5%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6459.2
Applied rewrites59.2%
Applied rewrites73.2%
Final simplification57.8%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) 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.5e-262) (* (- d) (sqrt (/ 1.0 (* h l)))) (/ d (* (sqrt l) (sqrt h)))))
D_m = fabs(D);
M_m = fabs(M);
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.5e-262) {
tmp = -d * sqrt((1.0 / (h * l)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
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.5d-262) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
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.5e-262) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [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.5e-262: tmp = -d * math.sqrt((1.0 / (h * l))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) 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.5e-262) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
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.5e-262)
tmp = -d * sqrt((1.0 / (h * l)));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $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.5e-262], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\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.5 \cdot 10^{-262}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 5.5000000000000004e-262Initial program 65.0%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6438.7
Applied rewrites38.7%
if 5.5000000000000004e-262 < l Initial program 69.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6438.4
Applied rewrites38.4%
Applied rewrites38.6%
Applied rewrites47.5%
Final simplification42.7%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -1.95e-193) (* (- d) (sqrt (/ 1.0 (* h l)))) (/ d (sqrt (* h l)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.95e-193) {
tmp = -d * sqrt((1.0 / (h * l)));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-1.95d-193)) then
tmp = -d * sqrt((1.0d0 / (h * l)))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.95e-193) {
tmp = -d * Math.sqrt((1.0 / (h * l)));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -1.95e-193: tmp = -d * math.sqrt((1.0 / (h * l))) else: tmp = d / math.sqrt((h * l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.95e-193) tmp = Float64(Float64(-d) * sqrt(Float64(1.0 / Float64(h * l)))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -1.95e-193)
tmp = -d * sqrt((1.0 / (h * l)));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.95e-193], N[((-d) * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.95 \cdot 10^{-193}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -1.9499999999999999e-193Initial program 73.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6447.0
Applied rewrites47.0%
if -1.9499999999999999e-193 < d Initial program 62.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6432.5
Applied rewrites32.5%
Applied rewrites32.6%
Final simplification38.7%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= d -4.5e-155) (sqrt (* d (/ d (* h l)))) (/ d (sqrt (* h l)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.5e-155) {
tmp = sqrt((d * (d / (h * l))));
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-4.5d-155)) then
tmp = sqrt((d * (d / (h * l))))
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -4.5e-155) {
tmp = Math.sqrt((d * (d / (h * l))));
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -4.5e-155: tmp = math.sqrt((d * (d / (h * l)))) else: tmp = d / math.sqrt((h * l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -4.5e-155) tmp = sqrt(Float64(d * Float64(d / Float64(h * l)))); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -4.5e-155)
tmp = sqrt((d * (d / (h * l))));
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -4.5e-155], N[Sqrt[N[(d * N[(d / N[(h * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -4.5 \cdot 10^{-155}:\\
\;\;\;\;\sqrt{d \cdot \frac{d}{h \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if d < -4.5000000000000004e-155Initial program 74.4%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f645.0
Applied rewrites5.0%
Applied rewrites28.7%
Applied rewrites33.5%
if -4.5000000000000004e-155 < d Initial program 62.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6431.6
Applied rewrites31.6%
Applied rewrites31.8%
Final simplification32.4%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) 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))))
D_m = fabs(D);
M_m = fabs(M);
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));
}
D_m = abs(d)
M_m = abs(m)
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
D_m = Math.abs(D);
M_m = Math.abs(M);
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));
}
D_m = math.fabs(D) M_m = math.fabs(M) [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))
D_m = abs(D) M_m = abs(M) 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
D_m = abs(D);
M_m = abs(M);
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
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $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}
D_m = \left|D\right|
\\
M_m = \left|M\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 66.8%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower-*.f6421.2
Applied rewrites21.2%
Applied rewrites21.3%
herbie shell --seed 2024237
(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)))))