
(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 25 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)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= l -3.5e-184)
(/
(*
(*
(/ t_0 (sqrt (- l)))
(fma (* (/ h l) -0.5) (pow (* (/ d D_m) (/ 2.0 M)) -2.0) 1.0))
t_0)
(sqrt (- h)))
(if (<= l 6.5e-251)
(*
(-
1.0
(* (/ (* (* (* 0.25 D_m) M) h) d) (/ (* (* (/ 0.5 d) D_m) M) l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
(/
(*
(*
(fma
(/ (- D_m) l)
(* (* (* (/ M d) h) D_m) (* (* (/ 0.5 d) M) 0.25))
1.0)
(sqrt d))
(sqrt d))
(* (sqrt l) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (l <= -3.5e-184) {
tmp = (((t_0 / sqrt(-l)) * fma(((h / l) * -0.5), pow(((d / D_m) * (2.0 / M)), -2.0), 1.0)) * t_0) / sqrt(-h);
} else if (l <= 6.5e-251) {
tmp = (1.0 - (((((0.25 * D_m) * M) * h) / d) * ((((0.5 / d) * D_m) * M) / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
} else {
tmp = ((fma((-D_m / l), ((((M / d) * h) * D_m) * (((0.5 / d) * M) * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -3.5e-184) tmp = Float64(Float64(Float64(Float64(t_0 / sqrt(Float64(-l))) * fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(d / D_m) * Float64(2.0 / M)) ^ -2.0), 1.0)) * t_0) / sqrt(Float64(-h))); elseif (l <= 6.5e-251) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.25 * D_m) * M) * h) / d) * Float64(Float64(Float64(Float64(0.5 / d) * D_m) * M) / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(-D_m) / l), Float64(Float64(Float64(Float64(M / d) * h) * D_m) * Float64(Float64(Float64(0.5 / d) * M) * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -3.5e-184], N[(N[(N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(d / D$95$m), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.5e-251], N[(N[(1.0 - N[(N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * M), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(0.5 / d), $MachinePrecision] * D$95$m), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[((-D$95$m) / l), $MachinePrecision] * N[(N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-184}:\\
\;\;\;\;\frac{\left(\frac{t\_0}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{d}{D\_m} \cdot \frac{2}{M}\right)}^{-2}, 1\right)\right) \cdot t\_0}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 6.5 \cdot 10^{-251}:\\
\;\;\;\;\left(1 - \frac{\left(\left(0.25 \cdot D\_m\right) \cdot M\right) \cdot h}{d} \cdot \frac{\left(\frac{0.5}{d} \cdot D\_m\right) \cdot M}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{-D\_m}{\ell}, \left(\left(\frac{M}{d} \cdot h\right) \cdot D\_m\right) \cdot \left(\left(\frac{0.5}{d} \cdot M\right) \cdot 0.25\right), 1\right) \cdot \sqrt{d}\right) \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.49999999999999981e-184Initial program 60.5%
Applied rewrites73.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6482.8
Applied rewrites82.8%
if -3.49999999999999981e-184 < l < 6.5000000000000002e-251Initial program 78.7%
Applied rewrites89.4%
lift-/.f64N/A
div-invN/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6492.2
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval92.2
Applied rewrites92.2%
if 6.5000000000000002e-251 < l Initial program 66.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.1%
Applied rewrites67.8%
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.0
Applied rewrites67.0%
Applied rewrites85.4%
Final simplification85.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* h l)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_2 (sqrt (/ d l)))
(t_3 (sqrt (/ d h))))
(if (<= t_1 -5e-161)
(*
(*
(fma
(/ (* (* 0.5 M) D_m) (* (- l) d))
(* (* (/ M d) h) (* 0.25 D_m))
1.0)
t_2)
t_3)
(if (<= t_1 0.0) t_0 (if (<= t_1 1e+248) (* t_2 t_3) t_0)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = fabs((d / sqrt((h * l))));
double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_2 = sqrt((d / l));
double t_3 = sqrt((d / h));
double tmp;
if (t_1 <= -5e-161) {
tmp = (fma((((0.5 * M) * D_m) / (-l * d)), (((M / d) * h) * (0.25 * D_m)), 1.0) * t_2) * t_3;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 1e+248) {
tmp = t_2 * t_3;
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = abs(Float64(d / sqrt(Float64(h * l)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_2 = sqrt(Float64(d / l)) t_3 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= -5e-161) tmp = Float64(Float64(fma(Float64(Float64(Float64(0.5 * M) * D_m) / Float64(Float64(-l) * d)), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D_m)), 1.0) * t_2) * t_3); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 1e+248) tmp = Float64(t_2 * t_3); else tmp = t_0; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -5e-161], N[(N[(N[(N[(N[(N[(0.5 * M), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-l) * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 1e+248], N[(t$95$2 * t$95$3), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{-161}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(0.5 \cdot M\right) \cdot D\_m}{\left(-\ell\right) \cdot d}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\_m\right), 1\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;t\_2 \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -4.9999999999999999e-161Initial program 81.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.3%
Applied rewrites82.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-/.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6477.5
Applied rewrites77.5%
if -4.9999999999999999e-161 < (*.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.0 or 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.7
Applied rewrites28.7%
Applied rewrites57.2%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification75.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (/ d (sqrt (* h l)))))
(if (<= t_0 -1e+102)
(* (* (* (/ (/ D_m d) d) (* (* -0.125 (/ (* (* M M) h) l)) D_m)) t_2) t_1)
(if (<= t_0 0.0)
(*
(fma
(/ (* (* (* D_m M) 0.5) (* (* (/ 0.5 d) M) D_m)) d)
(* (/ h l) -0.5)
1.0)
t_3)
(if (<= t_0 1e+248) (* t_2 t_1) (fabs t_3))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = d / sqrt((h * l));
double tmp;
if (t_0 <= -1e+102) {
tmp = ((((D_m / d) / d) * ((-0.125 * (((M * M) * h) / l)) * D_m)) * t_2) * t_1;
} else if (t_0 <= 0.0) {
tmp = fma(((((D_m * M) * 0.5) * (((0.5 / d) * M) * D_m)) / d), ((h / l) * -0.5), 1.0) * t_3;
} else if (t_0 <= 1e+248) {
tmp = t_2 * t_1;
} else {
tmp = fabs(t_3);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= -1e+102) tmp = Float64(Float64(Float64(Float64(Float64(D_m / d) / d) * Float64(Float64(-0.125 * Float64(Float64(Float64(M * M) * h) / l)) * D_m)) * t_2) * t_1); elseif (t_0 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M) * 0.5) * Float64(Float64(Float64(0.5 / d) * M) * D_m)) / d), Float64(Float64(h / l) * -0.5), 1.0) * t_3); elseif (t_0 <= 1e+248) tmp = Float64(t_2 * t_1); else tmp = abs(t_3); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $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 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+102], N[(N[(N[(N[(N[(D$95$m / d), $MachinePrecision] / d), $MachinePrecision] * N[(N[(-0.125 * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(N[(D$95$m * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$0, 1e+248], N[(t$95$2 * t$95$1), $MachinePrecision], N[Abs[t$95$3], $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+102}:\\
\;\;\;\;\left(\left(\frac{\frac{D\_m}{d}}{d} \cdot \left(\left(-0.125 \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot D\_m\right)\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\right) \cdot 0.5\right) \cdot \left(\left(\frac{0.5}{d} \cdot M\right) \cdot D\_m\right)}{d}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot t\_3\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|t\_3\right|\\
\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)))) < -9.99999999999999977e101Initial program 79.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.7%
Taylor expanded in d around 0
lower-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.3
Applied rewrites55.3%
Applied rewrites63.1%
Taylor expanded in d around 0
associate-*r/N/A
associate-/l/N/A
*-commutativeN/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
unpow2N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites66.6%
if -9.99999999999999977e101 < (*.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 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites44.7%
Applied rewrites43.6%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
clear-numN/A
unpow2N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites44.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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification68.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (sqrt (/ d h)))
(t_2 (sqrt (/ d l)))
(t_3 (/ d (sqrt (* h l)))))
(if (<= t_0 (- INFINITY))
(* (* (/ (* (* (* (/ (* (* D_m D_m) h) l) -0.125) M) M) (* d d)) t_2) t_1)
(if (<= t_0 0.0)
(*
(fma
(/ (* (* (* D_m M) 0.5) (* (* (/ 0.5 d) M) D_m)) d)
(* (/ h l) -0.5)
1.0)
t_3)
(if (<= t_0 1e+248) (* t_2 t_1) (fabs t_3))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = sqrt((d / h));
double t_2 = sqrt((d / l));
double t_3 = d / sqrt((h * l));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((((((D_m * D_m) * h) / l) * -0.125) * M) * M) / (d * d)) * t_2) * t_1;
} else if (t_0 <= 0.0) {
tmp = fma(((((D_m * M) * 0.5) * (((0.5 / d) * M) * D_m)) / d), ((h / l) * -0.5), 1.0) * t_3;
} else if (t_0 <= 1e+248) {
tmp = t_2 * t_1;
} else {
tmp = fabs(t_3);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = sqrt(Float64(d / h)) t_2 = sqrt(Float64(d / l)) t_3 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) * h) / l) * -0.125) * M) * M) / Float64(d * d)) * t_2) * t_1); elseif (t_0 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M) * 0.5) * Float64(Float64(Float64(0.5 / d) * M) * D_m)) / d), Float64(Float64(h / l) * -0.5), 1.0) * t_3); elseif (t_0 <= 1e+248) tmp = Float64(t_2 * t_1); else tmp = abs(t_3); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $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 / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision] * M), $MachinePrecision] * M), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(N[(D$95$m * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$0, 1e+248], N[(t$95$2 * t$95$1), $MachinePrecision], N[Abs[t$95$3], $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\frac{\left(\left(\frac{\left(D\_m \cdot D\_m\right) \cdot h}{\ell} \cdot -0.125\right) \cdot M\right) \cdot M}{d \cdot d} \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\right) \cdot 0.5\right) \cdot \left(\left(\frac{0.5}{d} \cdot M\right) \cdot D\_m\right)}{d}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot t\_3\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left|t\_3\right|\\
\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 76.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.4%
Taylor expanded in d around 0
lower-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6461.3
Applied rewrites61.3%
Taylor expanded in d around 0
Applied rewrites67.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)))) < 0.0Initial program 66.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites59.2%
Applied rewrites46.1%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
clear-numN/A
unpow2N/A
associate-/r*N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites46.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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification68.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ d (sqrt (* h l))))
(t_2 (fabs t_1)))
(if (<= t_0 -2e-73)
(*
(fma
(/ (* (* (* D_m M) 0.5) (* D_m M)) (* (* d 2.0) d))
(* (/ h l) -0.5)
1.0)
t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = d / sqrt((h * l));
double t_2 = fabs(t_1);
double tmp;
if (t_0 <= -2e-73) {
tmp = fma(((((D_m * M) * 0.5) * (D_m * M)) / ((d * 2.0) * d)), ((h / l) * -0.5), 1.0) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(d / sqrt(Float64(h * l))) t_2 = abs(t_1) tmp = 0.0 if (t_0 <= -2e-73) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M) * 0.5) * Float64(D_m * M)) / Float64(Float64(d * 2.0) * d)), Float64(Float64(h / l) * -0.5), 1.0) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = t_2; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[t$95$0, -2e-73], N[(N[(N[(N[(N[(N[(D$95$m * M), $MachinePrecision] * 0.5), $MachinePrecision] * N[(D$95$m * M), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-73}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\right) \cdot 0.5\right) \cdot \left(D\_m \cdot M\right)}{\left(d \cdot 2\right) \cdot d}, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -1.99999999999999999e-73Initial program 80.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.9%
Applied rewrites38.9%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
unpow-prod-downN/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
clear-numN/A
unpow2N/A
associate-/r*N/A
frac-timesN/A
lower-/.f64N/A
Applied rewrites31.9%
if -1.99999999999999999e-73 < (*.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.0 or 1.00000000000000005e248 < (*.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 25.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.1
Applied rewrites28.1%
Applied rewrites56.0%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification57.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ d (sqrt (* h l))))
(t_2 (fabs t_1)))
(if (<= t_0 -2e-73)
(*
(/ (fma (* (* (/ (* (* D_m D_m) h) l) -0.125) M) M (* d d)) (* d d))
t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = d / sqrt((h * l));
double t_2 = fabs(t_1);
double tmp;
if (t_0 <= -2e-73) {
tmp = (fma((((((D_m * D_m) * h) / l) * -0.125) * M), M, (d * d)) / (d * d)) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(d / sqrt(Float64(h * l))) t_2 = abs(t_1) tmp = 0.0 if (t_0 <= -2e-73) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(D_m * D_m) * h) / l) * -0.125) * M), M, Float64(d * d)) / Float64(d * d)) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = t_2; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[t$95$0, -2e-73], N[(N[(N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * -0.125), $MachinePrecision] * M), $MachinePrecision] * M + N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-73}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{\left(D\_m \cdot D\_m\right) \cdot h}{\ell} \cdot -0.125\right) \cdot M, M, d \cdot d\right)}{d \cdot d} \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -1.99999999999999999e-73Initial program 80.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.9%
Applied rewrites38.9%
Taylor expanded in d around 0
lower-/.f64N/A
Applied rewrites26.6%
if -1.99999999999999999e-73 < (*.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.0 or 1.00000000000000005e248 < (*.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 25.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.1
Applied rewrites28.1%
Applied rewrites56.0%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification55.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ d (sqrt (* h l))))
(t_2 (fabs t_1)))
(if (<= t_0 -1e+127)
(* (* (* (/ (/ (* D_m D_m) d) d) -0.125) (/ (* (* M M) h) l)) t_1)
(if (<= t_0 0.0)
t_2
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = d / sqrt((h * l));
double t_2 = fabs(t_1);
double tmp;
if (t_0 <= -1e+127) {
tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
t_1 = d / sqrt((h * l))
t_2 = abs(t_1)
if (t_0 <= (-1d+127)) then
tmp = (((((d_m * d_m) / d) / d) * (-0.125d0)) * (((m * m) * h) / l)) * t_1
else if (t_0 <= 0.0d0) then
tmp = t_2
else if (t_0 <= 1d+248) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = t_2
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double t_1 = d / Math.sqrt((h * l));
double t_2 = Math.abs(t_1);
double tmp;
if (t_0 <= -1e+127) {
tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
} else if (t_0 <= 0.0) {
tmp = t_2;
} else if (t_0 <= 1e+248) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = t_2;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) t_1 = d / math.sqrt((h * l)) t_2 = math.fabs(t_1) tmp = 0 if t_0 <= -1e+127: tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1 elif t_0 <= 0.0: tmp = t_2 elif t_0 <= 1e+248: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = t_2 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(d / sqrt(Float64(h * l))) t_2 = abs(t_1) tmp = 0.0 if (t_0 <= -1e+127) tmp = Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) / d) / d) * -0.125) * Float64(Float64(Float64(M * M) * h) / l)) * t_1); elseif (t_0 <= 0.0) tmp = t_2; elseif (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = t_2; end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
t_1 = d / sqrt((h * l));
t_2 = abs(t_1);
tmp = 0.0;
if (t_0 <= -1e+127)
tmp = (((((D_m * D_m) / d) / d) * -0.125) * (((M * M) * h) / l)) * t_1;
elseif (t_0 <= 0.0)
tmp = t_2;
elseif (t_0 <= 1e+248)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = t_2;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Abs[t$95$1], $MachinePrecision]}, If[LessEqual[t$95$0, -1e+127], N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], t$95$2, If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+127}:\\
\;\;\;\;\left(\left(\frac{\frac{D\_m \cdot D\_m}{d}}{d} \cdot -0.125\right) \cdot \frac{\left(M \cdot M\right) \cdot h}{\ell}\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -9.99999999999999955e126Initial program 79.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.3%
Applied rewrites40.5%
Taylor expanded in d around 0
times-fracN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.9
Applied rewrites27.9%
if -9.99999999999999955e126 < (*.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.0 or 1.00000000000000005e248 < (*.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 31.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.1
Applied rewrites26.1%
Applied rewrites51.2%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification54.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2 (fabs (/ d (sqrt (* h l)))))
(t_3
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_3 -5e-161)
(* (- t_0) t_1)
(if (<= t_3 0.0) t_2 (if (<= t_3 1e+248) (* t_0 t_1) t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = fabs((d / sqrt((h * l))));
double t_3 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_3 <= -5e-161) {
tmp = -t_0 * t_1;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 1e+248) {
tmp = t_0 * t_1;
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
t_2 = abs((d / sqrt((h * l))))
t_3 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
if (t_3 <= (-5d-161)) then
tmp = -t_0 * t_1
else if (t_3 <= 0.0d0) then
tmp = t_2
else if (t_3 <= 1d+248) then
tmp = t_0 * t_1
else
tmp = t_2
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.abs((d / Math.sqrt((h * l))));
double t_3 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_3 <= -5e-161) {
tmp = -t_0 * t_1;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 1e+248) {
tmp = t_0 * t_1;
} else {
tmp = t_2;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) t_2 = math.fabs((d / math.sqrt((h * l)))) t_3 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) tmp = 0 if t_3 <= -5e-161: tmp = -t_0 * t_1 elif t_3 <= 0.0: tmp = t_2 elif t_3 <= 1e+248: tmp = t_0 * t_1 else: tmp = t_2 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = abs(Float64(d / sqrt(Float64(h * l)))) t_3 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_3 <= -5e-161) tmp = Float64(Float64(-t_0) * t_1); elseif (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 1e+248) tmp = Float64(t_0 * t_1); else tmp = t_2; end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
t_2 = abs((d / sqrt((h * l))));
t_3 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
tmp = 0.0;
if (t_3 <= -5e-161)
tmp = -t_0 * t_1;
elseif (t_3 <= 0.0)
tmp = t_2;
elseif (t_3 <= 1e+248)
tmp = t_0 * t_1;
else
tmp = t_2;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, 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[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e-161], N[((-t$95$0) * t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 1e+248], N[(t$95$0 * t$95$1), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
t_3 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{-161}:\\
\;\;\;\;\left(-t\_0\right) \cdot t\_1\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+248}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\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)))) < -4.9999999999999999e-161Initial program 81.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f6415.8
Applied rewrites15.8%
if -4.9999999999999999e-161 < (*.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.0 or 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.7
Applied rewrites28.7%
Applied rewrites57.2%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification51.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* h l)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_1 -2e-73)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= t_1 0.0)
t_0
(if (<= t_1 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) t_0)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = fabs((d / sqrt((h * l))));
double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_1 <= -2e-73) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((h * l))))
t_1 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
if (t_1 <= (-2d-73)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (t_1 <= 0.0d0) then
tmp = t_0
else if (t_1 <= 1d+248) then
tmp = sqrt((d / l)) * sqrt((d / h))
else
tmp = t_0
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.abs((d / Math.sqrt((h * l))));
double t_1 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_1 <= -2e-73) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (t_1 <= 0.0) {
tmp = t_0;
} else if (t_1 <= 1e+248) {
tmp = Math.sqrt((d / l)) * Math.sqrt((d / h));
} else {
tmp = t_0;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.fabs((d / math.sqrt((h * l)))) t_1 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) tmp = 0 if t_1 <= -2e-73: tmp = math.sqrt((1.0 / (h * l))) * -d elif t_1 <= 0.0: tmp = t_0 elif t_1 <= 1e+248: tmp = math.sqrt((d / l)) * math.sqrt((d / h)) else: tmp = t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = abs(Float64(d / sqrt(Float64(h * l)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -2e-73) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (t_1 <= 0.0) tmp = t_0; elseif (t_1 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = t_0; end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = abs((d / sqrt((h * l))));
t_1 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
tmp = 0.0;
if (t_1 <= -2e-73)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (t_1 <= 0.0)
tmp = t_0;
elseif (t_1 <= 1e+248)
tmp = sqrt((d / l)) * sqrt((d / h));
else
tmp = t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-73], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 0.0], t$95$0, If[LessEqual[t$95$1, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -1.99999999999999999e-73Initial program 80.8%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.5
Applied rewrites9.5%
if -1.99999999999999999e-73 < (*.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.0 or 1.00000000000000005e248 < (*.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 25.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.1
Applied rewrites28.1%
Applied rewrites56.0%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification48.8%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* h l)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_1 -2e-73)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= t_1 2e-150)
t_0
(if (<= t_1 1e+96) (sqrt (* (/ d l) (/ d h))) t_0)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = fabs((d / sqrt((h * l))));
double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_1 <= -2e-73) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (t_1 <= 2e-150) {
tmp = t_0;
} else if (t_1 <= 1e+96) {
tmp = sqrt(((d / l) * (d / h)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((h * l))))
t_1 = (1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
if (t_1 <= (-2d-73)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (t_1 <= 2d-150) then
tmp = t_0
else if (t_1 <= 1d+96) then
tmp = sqrt(((d / l) * (d / h)))
else
tmp = t_0
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = Math.abs((d / Math.sqrt((h * l))));
double t_1 = (1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_1 <= -2e-73) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (t_1 <= 2e-150) {
tmp = t_0;
} else if (t_1 <= 1e+96) {
tmp = Math.sqrt(((d / l) * (d / h)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = math.fabs((d / math.sqrt((h * l)))) t_1 = (1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0))) tmp = 0 if t_1 <= -2e-73: tmp = math.sqrt((1.0 / (h * l))) * -d elif t_1 <= 2e-150: tmp = t_0 elif t_1 <= 1e+96: tmp = math.sqrt(((d / l) * (d / h))) else: tmp = t_0 return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = abs(Float64(d / sqrt(Float64(h * l)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -2e-73) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (t_1 <= 2e-150) tmp = t_0; elseif (t_1 <= 1e+96) tmp = sqrt(Float64(Float64(d / l) * Float64(d / h))); else tmp = t_0; end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = abs((d / sqrt((h * l))));
t_1 = (1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
tmp = 0.0;
if (t_1 <= -2e-73)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (t_1 <= 2e-150)
tmp = t_0;
elseif (t_1 <= 1e+96)
tmp = sqrt(((d / l) * (d / h)));
else
tmp = t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-73], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 2e-150], t$95$0, If[LessEqual[t$95$1, 1e+96], N[Sqrt[N[(N[(d / l), $MachinePrecision] * N[(d / h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-73}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-150}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+96}:\\
\;\;\;\;\sqrt{\frac{d}{\ell} \cdot \frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\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)))) < -1.99999999999999999e-73Initial program 80.8%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.5
Applied rewrites9.5%
if -1.99999999999999999e-73 < (*.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.00000000000000001e-150 or 1.00000000000000005e96 < (*.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 39.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6428.7
Applied rewrites28.7%
Applied rewrites61.0%
if 2.00000000000000001e-150 < (*.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)))) < 1.00000000000000005e96Initial program 99.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites38.7%
Applied rewrites95.4%
Final simplification47.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* (/ 0.5 d) M) D_m))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_2 (/ d (sqrt (* h l)))))
(if (<= t_1 0.0)
(* t_2 (fma (* t_0 (* (/ h l) -0.5)) t_0 1.0))
(if (<= t_1 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) (fabs t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = ((0.5 / d) * M) * D_m;
double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_2 = d / sqrt((h * l));
double tmp;
if (t_1 <= 0.0) {
tmp = t_2 * fma((t_0 * ((h / l) * -0.5)), t_0, 1.0);
} else if (t_1 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = fabs(t_2);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(Float64(0.5 / d) * M) * D_m) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_2 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(t_2 * fma(Float64(t_0 * Float64(Float64(h / l) * -0.5)), t_0, 1.0)); elseif (t_1 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = abs(t_2); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(t$95$2 * N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[t$95$2], $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{0.5}{d} \cdot M\right) \cdot D\_m\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_2 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), t\_0, 1\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2\right|\\
\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 73.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.6%
Applied rewrites40.5%
Applied rewrites43.2%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification60.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ d (sqrt (* h l)))))
(if (<= t_0 0.0)
(*
t_1
(fma
(* (* (* (* (/ M d) h) D_m) 0.25) (* (/ 0.5 d) M))
(/ (- D_m) l)
1.0))
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) (fabs t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = d / sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1 * fma((((((M / d) * h) * D_m) * 0.25) * ((0.5 / d) * M)), (-D_m / l), 1.0);
} else if (t_0 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = fabs(t_1);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(t_1 * fma(Float64(Float64(Float64(Float64(Float64(M / d) * h) * D_m) * 0.25) * Float64(Float64(0.5 / d) * M)), Float64(Float64(-D_m) / l), 1.0)); elseif (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = abs(t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$1 * N[(N[(N[(N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\left(\left(\left(\frac{M}{d} \cdot h\right) \cdot D\_m\right) \cdot 0.25\right) \cdot \left(\frac{0.5}{d} \cdot M\right), \frac{-D\_m}{\ell}, 1\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right|\\
\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 73.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.6%
Applied rewrites74.5%
Applied rewrites42.9%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification60.3%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) M))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_2 (/ d (sqrt (* h l)))))
(if (<= t_1 0.0)
(* (fma (* (* t_0 0.25) t_0) (* (/ h l) -0.5) 1.0) t_2)
(if (<= t_1 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) (fabs t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (D_m / d) * M;
double t_1 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_2 = d / sqrt((h * l));
double tmp;
if (t_1 <= 0.0) {
tmp = fma(((t_0 * 0.25) * t_0), ((h / l) * -0.5), 1.0) * t_2;
} else if (t_1 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = fabs(t_2);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(D_m / d) * M) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_2 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(fma(Float64(Float64(t_0 * 0.25) * t_0), Float64(Float64(h / l) * -0.5), 1.0) * t_2); elseif (t_1 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = abs(t_2); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(N[(t$95$0 * 0.25), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[t$95$2], $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot M\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_2 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\left(t\_0 \cdot 0.25\right) \cdot t\_0, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|t\_2\right|\\
\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 73.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.6%
Applied rewrites40.5%
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
metadata-evalN/A
pow2N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites40.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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification59.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ d (sqrt (* h l)))))
(if (<= t_0 0.0)
(* (/ (fma (* (/ (* D_m D_m) d) -0.125) (/ (* (* M M) h) d) l) l) t_1)
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) (fabs t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = d / sqrt((h * l));
double tmp;
if (t_0 <= 0.0) {
tmp = (fma((((D_m * D_m) / d) * -0.125), (((M * M) * h) / d), l) / l) * t_1;
} else if (t_0 <= 1e+248) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = fabs(t_1);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(fma(Float64(Float64(Float64(D_m * D_m) / d) * -0.125), Float64(Float64(Float64(M * M) * h) / d), l) / l) * t_1); elseif (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = abs(t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision] / d), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[t$95$1], $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{D\_m \cdot D\_m}{d} \cdot -0.125, \frac{\left(M \cdot M\right) \cdot h}{d}, \ell\right)}{\ell} \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|t\_1\right|\\
\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 73.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.6%
Applied rewrites40.5%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
unpow2N/A
times-fracN/A
associate-*r/N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6433.2
Applied rewrites33.2%
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)))) < 1.00000000000000005e248Initial program 98.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
Taylor expanded in d around inf
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification55.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+248)
(*
(*
(fma (/ (/ (* (* 0.5 M) D_m) d) (- l)) (* (* (/ M d) h) (* 0.25 D_m)) 1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* h l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+248) {
tmp = (fma(((((0.5 * M) * D_m) / d) / -l), (((M / d) * h) * (0.25 * D_m)), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+248) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(0.5 * M) * D_m) / d) / Float64(-l)), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D_m)), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+248], N[(N[(N[(N[(N[(N[(N[(0.5 * M), $MachinePrecision] * D$95$m), $MachinePrecision] / d), $MachinePrecision] / (-l)), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+248}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\frac{\left(0.5 \cdot M\right) \cdot D\_m}{d}}{-\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\_m\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\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)))) < 1.00000000000000005e248Initial program 82.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.9%
Applied rewrites82.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-*l/N/A
*-commutativeN/A
metadata-evalN/A
div-invN/A
lower-/.f64N/A
lower-*.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6482.1
Applied rewrites82.1%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification74.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+248)
(*
(*
(fma (/ (* (* (/ 0.5 d) M) D_m) (- l)) (* (* (/ M d) h) (* 0.25 D_m)) 1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* h l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+248) {
tmp = (fma(((((0.5 / d) * M) * D_m) / -l), (((M / d) * h) * (0.25 * D_m)), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+248) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(0.5 / d) * M) * D_m) / Float64(-l)), Float64(Float64(Float64(M / d) * h) * Float64(0.25 * D_m)), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+248], N[(N[(N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D$95$m), $MachinePrecision] / (-l)), $MachinePrecision] * N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+248}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(\frac{0.5}{d} \cdot M\right) \cdot D\_m}{-\ell}, \left(\frac{M}{d} \cdot h\right) \cdot \left(0.25 \cdot D\_m\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\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)))) < 1.00000000000000005e248Initial program 82.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.9%
Applied rewrites82.1%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification74.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+248)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(fma
(* (* (/ (- M) d) (* 0.25 D_m)) (/ (* (* (/ 0.5 d) M) D_m) l))
h
1.0)))
(fabs (/ d (sqrt (* h l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+248) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma((((-M / d) * (0.25 * D_m)) * ((((0.5 / d) * M) * D_m) / l)), h, 1.0));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+248) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(Float64(Float64(-M) / d) * Float64(0.25 * D_m)) * Float64(Float64(Float64(Float64(0.5 / d) * M) * D_m) / l)), h, 1.0))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+248], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[((-M) / d), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\left(\frac{-M}{d} \cdot \left(0.25 \cdot D\_m\right)\right) \cdot \frac{\left(\frac{0.5}{d} \cdot M\right) \cdot D\_m}{\ell}, h, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\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)))) < 1.00000000000000005e248Initial program 82.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.9%
Applied rewrites83.0%
if 1.00000000000000005e248 < (*.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 23.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification74.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+96)
(*
(*
(fma (* (* (* (* (/ M d) h) D_m) 0.25) (* (/ 0.5 d) M)) (/ (- D_m) l) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(fabs (/ d (sqrt (* h l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+96) {
tmp = (fma((((((M / d) * h) * D_m) * 0.25) * ((0.5 / d) * M)), (-D_m / l), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+96) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(Float64(M / d) * h) * D_m) * 0.25) * Float64(Float64(0.5 / d) * M)), Float64(Float64(-D_m) / l), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+96], N[(N[(N[(N[(N[(N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+96}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\left(\left(\frac{M}{d} \cdot h\right) \cdot D\_m\right) \cdot 0.25\right) \cdot \left(\frac{0.5}{d} \cdot M\right), \frac{-D\_m}{\ell}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\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)))) < 1.00000000000000005e96Initial program 81.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.7%
Applied rewrites80.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites80.4%
if 1.00000000000000005e96 < (*.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 33.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.3
Applied rewrites22.3%
Applied rewrites59.7%
Final simplification73.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
-2e-73)
(* (sqrt (/ 1.0 (* h l))) (- d))
(fabs (/ d (sqrt (* h l))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= -2e-73) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else {
tmp = fabs((d / sqrt((h * l))));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (((1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))) <= (-2d-73)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else
tmp = abs((d / sqrt((h * l))))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)))) <= -2e-73) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else {
tmp = Math.abs((d / Math.sqrt((h * l))));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if ((1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))) <= -2e-73: tmp = math.sqrt((1.0 / (h * l))) * -d else: tmp = math.fabs((d / math.sqrt((h * l)))) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= -2e-73) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); else tmp = abs(Float64(d / sqrt(Float64(h * l)))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (((1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)))) <= -2e-73)
tmp = sqrt((1.0 / (h * l))) * -d;
else
tmp = abs((d / sqrt((h * l))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-73], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -2 \cdot 10^{-73}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{h \cdot \ell}}\right|\\
\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)))) < -1.99999999999999999e-73Initial program 80.8%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.5
Applied rewrites9.5%
if -1.99999999999999999e-73 < (*.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 56.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.4
Applied rewrites31.4%
Applied rewrites61.7%
Final simplification42.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l)))))
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M) (* d 2.0)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
-1e-41)
t_0
(fabs t_0))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = d / sqrt((h * l));
double tmp;
if (((1.0 - ((pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= -1e-41) {
tmp = t_0;
} else {
tmp = fabs(t_0);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((h * l))
if (((1.0d0 - (((((d_m * m) / (d * 2.0d0)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))) <= (-1d-41)) then
tmp = t_0
else
tmp = abs(t_0)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double t_0 = d / Math.sqrt((h * l));
double tmp;
if (((1.0 - ((Math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)))) <= -1e-41) {
tmp = t_0;
} else {
tmp = Math.abs(t_0);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): t_0 = d / math.sqrt((h * l)) tmp = 0 if ((1.0 - ((math.pow(((D_m * M) / (d * 2.0)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))) <= -1e-41: tmp = t_0 else: tmp = math.fabs(t_0) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M) / Float64(d * 2.0)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= -1e-41) tmp = t_0; else tmp = abs(t_0); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
t_0 = d / sqrt((h * l));
tmp = 0.0;
if (((1.0 - (((((D_m * M) / (d * 2.0)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)))) <= -1e-41)
tmp = t_0;
else
tmp = abs(t_0);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1e-41], t$95$0, N[Abs[t$95$0], $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M}{d \cdot 2}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -1 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0\right|\\
\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)))) < -1.00000000000000001e-41Initial program 80.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f645.4
Applied rewrites5.4%
Applied rewrites5.4%
if -1.00000000000000001e-41 < (*.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 56.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.3
Applied rewrites31.3%
Applied rewrites61.4%
Final simplification40.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ 0.5 d) M)) (t_1 (sqrt (- d))))
(if (<= l -6.8e-187)
(/
(*
(*
(/ t_1 (sqrt (- l)))
(fma (* (/ h l) -0.5) (pow (* (/ d D_m) (/ 2.0 M)) -2.0) 1.0))
t_1)
(sqrt (- h)))
(if (<= l 5e-271)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(fma (* (* (/ (- M) d) (* 0.25 D_m)) (/ (* t_0 D_m) l)) h 1.0)))
(/
(*
(*
(fma (/ (- D_m) l) (* (* (* (/ M d) h) D_m) (* t_0 0.25)) 1.0)
(sqrt d))
(sqrt d))
(* (sqrt l) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (0.5 / d) * M;
double t_1 = sqrt(-d);
double tmp;
if (l <= -6.8e-187) {
tmp = (((t_1 / sqrt(-l)) * fma(((h / l) * -0.5), pow(((d / D_m) * (2.0 / M)), -2.0), 1.0)) * t_1) / sqrt(-h);
} else if (l <= 5e-271) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma((((-M / d) * (0.25 * D_m)) * ((t_0 * D_m) / l)), h, 1.0));
} else {
tmp = ((fma((-D_m / l), ((((M / d) * h) * D_m) * (t_0 * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(0.5 / d) * M) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (l <= -6.8e-187) tmp = Float64(Float64(Float64(Float64(t_1 / sqrt(Float64(-l))) * fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(d / D_m) * Float64(2.0 / M)) ^ -2.0), 1.0)) * t_1) / sqrt(Float64(-h))); elseif (l <= 5e-271) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(Float64(Float64(-M) / d) * Float64(0.25 * D_m)) * Float64(Float64(t_0 * D_m) / l)), h, 1.0))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(-D_m) / l), Float64(Float64(Float64(Float64(M / d) * h) * D_m) * Float64(t_0 * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[l, -6.8e-187], N[(N[(N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[Power[N[(N[(d / D$95$m), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5e-271], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[((-M) / d), $MachinePrecision] * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * D$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[((-D$95$m) / l), $MachinePrecision] * N[(N[(N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(t$95$0 * 0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{0.5}{d} \cdot M\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;\ell \leq -6.8 \cdot 10^{-187}:\\
\;\;\;\;\frac{\left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{d}{D\_m} \cdot \frac{2}{M}\right)}^{-2}, 1\right)\right) \cdot t\_1}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 5 \cdot 10^{-271}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\left(\frac{-M}{d} \cdot \left(0.25 \cdot D\_m\right)\right) \cdot \frac{t\_0 \cdot D\_m}{\ell}, h, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{-D\_m}{\ell}, \left(\left(\frac{M}{d} \cdot h\right) \cdot D\_m\right) \cdot \left(t\_0 \cdot 0.25\right), 1\right) \cdot \sqrt{d}\right) \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -6.8000000000000003e-187Initial program 60.5%
Applied rewrites73.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6482.8
Applied rewrites82.8%
if -6.8000000000000003e-187 < l < 5.0000000000000002e-271Initial program 79.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites76.3%
Applied rewrites94.3%
if 5.0000000000000002e-271 < l Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites65.4%
Applied rewrites67.1%
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6466.3
Applied rewrites66.3%
Applied rewrites85.0%
Final simplification85.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ M d) h))
(t_1 (* (/ 0.5 d) M))
(t_2 (* t_1 D_m))
(t_3 (sqrt (- d))))
(if (<= h -7.6e-72)
(*
(* (fma (/ t_2 (- l)) (* t_0 (* 0.25 D_m)) 1.0) (/ t_3 (sqrt (- l))))
(sqrt (/ d h)))
(if (<= h -5e-310)
(/
(* (* (fma (* t_2 (* (/ h l) -0.5)) t_2 1.0) (sqrt (/ d l))) t_3)
(sqrt (- h)))
(/
(*
(* (fma (/ (- D_m) l) (* (* t_0 D_m) (* t_1 0.25)) 1.0) (sqrt d))
(sqrt d))
(* (sqrt l) (sqrt h)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M / d) * h;
double t_1 = (0.5 / d) * M;
double t_2 = t_1 * D_m;
double t_3 = sqrt(-d);
double tmp;
if (h <= -7.6e-72) {
tmp = (fma((t_2 / -l), (t_0 * (0.25 * D_m)), 1.0) * (t_3 / sqrt(-l))) * sqrt((d / h));
} else if (h <= -5e-310) {
tmp = ((fma((t_2 * ((h / l) * -0.5)), t_2, 1.0) * sqrt((d / l))) * t_3) / sqrt(-h);
} else {
tmp = ((fma((-D_m / l), ((t_0 * D_m) * (t_1 * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M / d) * h) t_1 = Float64(Float64(0.5 / d) * M) t_2 = Float64(t_1 * D_m) t_3 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -7.6e-72) tmp = Float64(Float64(fma(Float64(t_2 / Float64(-l)), Float64(t_0 * Float64(0.25 * D_m)), 1.0) * Float64(t_3 / sqrt(Float64(-l)))) * sqrt(Float64(d / h))); elseif (h <= -5e-310) tmp = Float64(Float64(Float64(fma(Float64(t_2 * Float64(Float64(h / l) * -0.5)), t_2, 1.0) * sqrt(Float64(d / l))) * t_3) / sqrt(Float64(-h))); else tmp = Float64(Float64(Float64(fma(Float64(Float64(-D_m) / l), Float64(Float64(t_0 * D_m) * Float64(t_1 * 0.25)), 1.0) * sqrt(d)) * sqrt(d)) / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * D$95$m), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -7.6e-72], N[(N[(N[(N[(t$95$2 / (-l)), $MachinePrecision] * N[(t$95$0 * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(t$95$3 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(N[(N[(N[(t$95$2 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[((-D$95$m) / l), $MachinePrecision] * N[(N[(t$95$0 * D$95$m), $MachinePrecision] * N[(t$95$1 * 0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot h\\
t_1 := \frac{0.5}{d} \cdot M\\
t_2 := t\_1 \cdot D\_m\\
t_3 := \sqrt{-d}\\
\mathbf{if}\;h \leq -7.6 \cdot 10^{-72}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{t\_2}{-\ell}, t\_0 \cdot \left(0.25 \cdot D\_m\right), 1\right) \cdot \frac{t\_3}{\sqrt{-\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(t\_2 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), t\_2, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_3}{\sqrt{-h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{-D\_m}{\ell}, \left(t\_0 \cdot D\_m\right) \cdot \left(t\_1 \cdot 0.25\right), 1\right) \cdot \sqrt{d}\right) \cdot \sqrt{d}}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -7.60000000000000004e-72Initial program 64.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites67.0%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6476.2
Applied rewrites76.2%
if -7.60000000000000004e-72 < h < -4.999999999999985e-310Initial program 67.1%
Applied rewrites83.9%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites88.5%
if -4.999999999999985e-310 < h Initial program 65.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.4%
Applied rewrites68.3%
lift-sqrt.f64N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6467.6
Applied rewrites67.6%
Applied rewrites84.6%
Final simplification82.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ M d) h))
(t_1 (* (/ 0.5 d) M))
(t_2 (* t_1 D_m))
(t_3 (fma (/ t_2 (- l)) (* t_0 (* 0.25 D_m)) 1.0))
(t_4 (sqrt (- d)))
(t_5 (sqrt (/ d l))))
(if (<= h -7.6e-72)
(* (* t_3 (/ t_4 (sqrt (- l)))) (sqrt (/ d h)))
(if (<= h -5e-310)
(/ (* (* (fma (* t_2 (* (/ h l) -0.5)) t_2 1.0) t_5) t_4) (sqrt (- h)))
(if (<= h 1.3e+82)
(*
(/ d (sqrt (* h l)))
(fma (* (* (* t_0 D_m) 0.25) t_1) (/ (- D_m) l) 1.0))
(* (/ (sqrt d) (sqrt h)) (* t_3 t_5)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M / d) * h;
double t_1 = (0.5 / d) * M;
double t_2 = t_1 * D_m;
double t_3 = fma((t_2 / -l), (t_0 * (0.25 * D_m)), 1.0);
double t_4 = sqrt(-d);
double t_5 = sqrt((d / l));
double tmp;
if (h <= -7.6e-72) {
tmp = (t_3 * (t_4 / sqrt(-l))) * sqrt((d / h));
} else if (h <= -5e-310) {
tmp = ((fma((t_2 * ((h / l) * -0.5)), t_2, 1.0) * t_5) * t_4) / sqrt(-h);
} else if (h <= 1.3e+82) {
tmp = (d / sqrt((h * l))) * fma((((t_0 * D_m) * 0.25) * t_1), (-D_m / l), 1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_3 * t_5);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M / d) * h) t_1 = Float64(Float64(0.5 / d) * M) t_2 = Float64(t_1 * D_m) t_3 = fma(Float64(t_2 / Float64(-l)), Float64(t_0 * Float64(0.25 * D_m)), 1.0) t_4 = sqrt(Float64(-d)) t_5 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -7.6e-72) tmp = Float64(Float64(t_3 * Float64(t_4 / sqrt(Float64(-l)))) * sqrt(Float64(d / h))); elseif (h <= -5e-310) tmp = Float64(Float64(Float64(fma(Float64(t_2 * Float64(Float64(h / l) * -0.5)), t_2, 1.0) * t_5) * t_4) / sqrt(Float64(-h))); elseif (h <= 1.3e+82) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * fma(Float64(Float64(Float64(t_0 * D_m) * 0.25) * t_1), Float64(Float64(-D_m) / l), 1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_3 * t_5)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * D$95$m), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 / (-l)), $MachinePrecision] * N[(t$95$0 * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -7.6e-72], N[(N[(t$95$3 * N[(t$95$4 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[(N[(N[(N[(t$95$2 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision] * t$95$5), $MachinePrecision] * t$95$4), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.3e+82], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(t$95$0 * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$1), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * t$95$5), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot h\\
t_1 := \frac{0.5}{d} \cdot M\\
t_2 := t\_1 \cdot D\_m\\
t_3 := \mathsf{fma}\left(\frac{t\_2}{-\ell}, t\_0 \cdot \left(0.25 \cdot D\_m\right), 1\right)\\
t_4 := \sqrt{-d}\\
t_5 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -7.6 \cdot 10^{-72}:\\
\;\;\;\;\left(t\_3 \cdot \frac{t\_4}{\sqrt{-\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(t\_2 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), t\_2, 1\right) \cdot t\_5\right) \cdot t\_4}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq 1.3 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\left(\left(t\_0 \cdot D\_m\right) \cdot 0.25\right) \cdot t\_1, \frac{-D\_m}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_3 \cdot t\_5\right)\\
\end{array}
\end{array}
if h < -7.60000000000000004e-72Initial program 64.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites67.0%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6476.2
Applied rewrites76.2%
if -7.60000000000000004e-72 < h < -4.999999999999985e-310Initial program 67.1%
Applied rewrites83.9%
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
Applied rewrites88.5%
if -4.999999999999985e-310 < h < 1.2999999999999999e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
Applied rewrites84.0%
if 1.2999999999999999e82 < h Initial program 71.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.9%
Applied rewrites62.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f6480.8
Applied rewrites80.8%
Final simplification81.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ M d) h))
(t_1 (* (/ 0.5 d) M))
(t_2 (fma (/ (* t_1 D_m) (- l)) (* t_0 (* 0.25 D_m)) 1.0)))
(if (<= h -8e-242)
(* (* t_2 (/ (sqrt (- d)) (sqrt (- l)))) (sqrt (/ d h)))
(if (<= h -5e-310)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= h 1.3e+82)
(*
(/ d (sqrt (* h l)))
(fma (* (* (* t_0 D_m) 0.25) t_1) (/ (- D_m) l) 1.0))
(* (/ (sqrt d) (sqrt h)) (* t_2 (sqrt (/ d l)))))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M / d) * h;
double t_1 = (0.5 / d) * M;
double t_2 = fma(((t_1 * D_m) / -l), (t_0 * (0.25 * D_m)), 1.0);
double tmp;
if (h <= -8e-242) {
tmp = (t_2 * (sqrt(-d) / sqrt(-l))) * sqrt((d / h));
} else if (h <= -5e-310) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (h <= 1.3e+82) {
tmp = (d / sqrt((h * l))) * fma((((t_0 * D_m) * 0.25) * t_1), (-D_m / l), 1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_2 * sqrt((d / l)));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M / d) * h) t_1 = Float64(Float64(0.5 / d) * M) t_2 = fma(Float64(Float64(t_1 * D_m) / Float64(-l)), Float64(t_0 * Float64(0.25 * D_m)), 1.0) tmp = 0.0 if (h <= -8e-242) tmp = Float64(Float64(t_2 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * sqrt(Float64(d / h))); elseif (h <= -5e-310) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (h <= 1.3e+82) tmp = Float64(Float64(d / sqrt(Float64(h * l))) * fma(Float64(Float64(Float64(t_0 * D_m) * 0.25) * t_1), Float64(Float64(-D_m) / l), 1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_2 * sqrt(Float64(d / l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 / d), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 * D$95$m), $MachinePrecision] / (-l)), $MachinePrecision] * N[(t$95$0 * N[(0.25 * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[h, -8e-242], N[(N[(t$95$2 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -5e-310], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[h, 1.3e+82], N[(N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(t$95$0 * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * t$95$1), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot h\\
t_1 := \frac{0.5}{d} \cdot M\\
t_2 := \mathsf{fma}\left(\frac{t\_1 \cdot D\_m}{-\ell}, t\_0 \cdot \left(0.25 \cdot D\_m\right), 1\right)\\
\mathbf{if}\;h \leq -8 \cdot 10^{-242}:\\
\;\;\;\;\left(t\_2 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;h \leq 1.3 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}} \cdot \mathsf{fma}\left(\left(\left(t\_0 \cdot D\_m\right) \cdot 0.25\right) \cdot t\_1, \frac{-D\_m}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_2 \cdot \sqrt{\frac{d}{\ell}}\right)\\
\end{array}
\end{array}
if h < -8e-242Initial program 70.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites69.1%
Applied rewrites70.4%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6478.1
Applied rewrites78.1%
if -8e-242 < h < -4.999999999999985e-310Initial program 27.6%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6475.1
Applied rewrites75.1%
if -4.999999999999985e-310 < h < 1.2999999999999999e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
Applied rewrites84.0%
if 1.2999999999999999e82 < h Initial program 71.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.9%
Applied rewrites62.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f6480.8
Applied rewrites80.8%
Final simplification80.2%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* h l))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d / sqrt((h * l));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d / sqrt((h * l))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d / Math.sqrt((h * l));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d / math.sqrt((h * l))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d / sqrt(Float64(h * l))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d / sqrt((h * l));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 65.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites21.6%
Final simplification21.6%
herbie shell --seed 2024276
(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)))))