
(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 26 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* M_m (/ 0.5 d)) D_m)) (t_1 (sqrt (- d))))
(if (<= h -5e-310)
(*
(/ t_1 (sqrt (- h)))
(*
(/ t_1 (sqrt (- l)))
(fma (/ t_0 (- l)) (* (* 0.25 D_m) (* (/ M_m d) h)) 1.0)))
(if (<= h 2.85e+82)
(*
(/ d (sqrt (* l h)))
(fma t_0 (* (* (* D_m h) (/ M_m d)) (/ -0.25 l)) 1.0))
(/
(*
(sqrt d)
(*
(sqrt (/ d l))
(fma (* (/ h l) -0.5) (pow (* (/ d D_m) (/ 2.0 M_m)) -2.0) 1.0)))
(sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * (0.5 / d)) * D_m;
double t_1 = sqrt(-d);
double tmp;
if (h <= -5e-310) {
tmp = (t_1 / sqrt(-h)) * ((t_1 / sqrt(-l)) * fma((t_0 / -l), ((0.25 * D_m) * ((M_m / d) * h)), 1.0));
} else if (h <= 2.85e+82) {
tmp = (d / sqrt((l * h))) * fma(t_0, (((D_m * h) * (M_m / d)) * (-0.25 / l)), 1.0);
} else {
tmp = (sqrt(d) * (sqrt((d / l)) * fma(((h / l) * -0.5), pow(((d / D_m) * (2.0 / M_m)), -2.0), 1.0))) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * Float64(0.5 / d)) * D_m) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(t_1 / sqrt(Float64(-h))) * Float64(Float64(t_1 / sqrt(Float64(-l))) * fma(Float64(t_0 / Float64(-l)), Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)), 1.0))); elseif (h <= 2.85e+82) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(t_0, Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / l)), 1.0)); else tmp = Float64(Float64(sqrt(d) * Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(h / l) * -0.5), (Float64(Float64(d / D_m) * Float64(2.0 / M_m)) ^ -2.0), 1.0))) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 / (-l)), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.85e+82], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[(N[Sqrt[N[(d / 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$95$m), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_1}{\sqrt{-h}} \cdot \left(\frac{t\_1}{\sqrt{-\ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{-\ell}, \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right), 1\right)\right)\\
\mathbf{elif}\;h \leq 2.85 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(t\_0, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, {\left(\frac{d}{D\_m} \cdot \frac{2}{M\_m}\right)}^{-2}, 1\right)\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites66.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.f6474.3
Applied rewrites74.3%
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
lift-sqrt.f64N/A
lower-/.f6488.3
Applied rewrites88.3%
if -4.999999999999985e-310 < h < 2.85000000000000008e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites71.6%
Applied rewrites85.1%
if 2.85000000000000008e82 < h Initial program 71.0%
Applied rewrites87.0%
Final simplification87.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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
(* (- M_m) (/ (* D_m 0.5) (* l d)))
(* (* 0.25 D_m) (* (/ M_m d) h))
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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((-M_m * ((D_m * 0.5) / (l * d))), ((0.25 * D_m) * ((M_m / d) * h)), 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(-M_m) * Float64(Float64(D_m * 0.5) / Float64(l * d))), Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)), 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[((-M$95$m) * N[(N[(D$95$m * 0.5), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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(\left(-M\_m\right) \cdot \frac{D\_m \cdot 0.5}{\ell \cdot d}, \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\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%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6474.6
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
lift-neg.f64N/A
lower-*.f6474.6
Applied rewrites74.6%
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 h around 0
*-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 h around 0
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification74.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h)))))
(if (<= t_0 (- INFINITY))
(*
(*
(/ (fma (/ (* -0.125 (* (* M_m M_m) h)) d) (/ (* D_m D_m) d) l) l)
t_2)
t_1)
(if (<= t_0 0.0)
(*
(fma
(/ (* (* (* D_m M_m) 0.5) (* (* M_m (/ 0.5 d)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((fma(((-0.125 * ((M_m * M_m) * h)) / d), ((D_m * D_m) / d), l) / l) * t_2) * t_1;
} else if (t_0 <= 0.0) {
tmp = fma(((((D_m * M_m) * 0.5) * ((M_m * (0.5 / d)) * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fma(Float64(Float64(-0.125 * Float64(Float64(M_m * M_m) * h)) / d), Float64(Float64(D_m * D_m) / d), l) / l) * t_2) * t_1); elseif (t_0 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * 0.5) * Float64(Float64(M_m * Float64(0.5 / d)) * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(N[(-0.125 * N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] + l), $MachinePrecision] / l), $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$95$m), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \left(\left(M\_m \cdot M\_m\right) \cdot h\right)}{d}, \frac{D\_m \cdot D\_m}{d}, \ell\right)}{\ell} \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\_m\right) \cdot 0.5\right) \cdot \left(\left(M\_m \cdot \frac{0.5}{d}\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 l around 0
lower-/.f64N/A
Applied rewrites73.0%
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 h around 0
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification69.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* M_m (/ 0.5 d)) D_m))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_4 (/ d (sqrt (* l h)))))
(if (<= t_3 -1e+273)
(*
(* (* (/ (* (* M_m M_m) h) l) (* (/ (/ (* D_m D_m) d) d) -0.125)) t_1)
t_2)
(if (<= t_3 0.0)
(* (fma (* (* (/ h l) -0.5) t_0) t_0 1.0) t_4)
(if (<= t_3 1e+248) (* t_1 t_2) (fabs t_4))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * (0.5 / d)) * D_m;
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_4 = d / sqrt((l * h));
double tmp;
if (t_3 <= -1e+273) {
tmp = (((((M_m * M_m) * h) / l) * ((((D_m * D_m) / d) / d) * -0.125)) * t_1) * t_2;
} else if (t_3 <= 0.0) {
tmp = fma((((h / l) * -0.5) * t_0), t_0, 1.0) * t_4;
} else if (t_3 <= 1e+248) {
tmp = t_1 * t_2;
} else {
tmp = fabs(t_4);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * Float64(0.5 / d)) * D_m) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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_4 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (t_3 <= -1e+273) tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) / l) * Float64(Float64(Float64(Float64(D_m * D_m) / d) / d) * -0.125)) * t_1) * t_2); elseif (t_3 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_0), t_0, 1.0) * t_4); elseif (t_3 <= 1e+248) tmp = Float64(t_1 * t_2); else tmp = abs(t_4); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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$4 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -1e+273], N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * t$95$4), $MachinePrecision], If[LessEqual[t$95$3, 1e+248], N[(t$95$1 * t$95$2), $MachinePrecision], N[Abs[t$95$4], $MachinePrecision]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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_4 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;t\_3 \leq -1 \cdot 10^{+273}:\\
\;\;\;\;\left(\left(\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot \left(\frac{\frac{D\_m \cdot D\_m}{d}}{d} \cdot -0.125\right)\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_0, t\_0, 1\right) \cdot t\_4\\
\mathbf{elif}\;t\_3 \leq 10^{+248}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left|t\_4\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.99999999999999945e272Initial program 77.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.8%
Applied rewrites86.9%
Taylor expanded in h around inf
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-*.f6463.8
Applied rewrites63.8%
if -9.99999999999999945e272 < (*.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 62.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites53.4%
Applied rewrites43.9%
Applied rewrites44.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 h around 0
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification67.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h)))))
(if (<= t_0 (- INFINITY))
(*
(* (* (* (/ (/ (* M_m M_m) d) d) h) (/ (* (* D_m D_m) -0.125) l)) t_2)
t_1)
(if (<= t_0 0.0)
(*
(fma
(/ (* (* (* D_m M_m) 0.5) (* (* M_m (/ 0.5 d)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((((M_m * M_m) / d) / d) * h) * (((D_m * D_m) * -0.125) / l)) * t_2) * t_1;
} else if (t_0 <= 0.0) {
tmp = fma(((((D_m * M_m) * 0.5) * ((M_m * (0.5 / d)) * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(M_m * M_m) / d) / d) * h) * Float64(Float64(Float64(D_m * D_m) * -0.125) / l)) * t_2) * t_1); elseif (t_0 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * 0.5) * Float64(Float64(M_m * Float64(0.5 / d)) * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision] / l), $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$95$m), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(\left(\frac{\frac{M\_m \cdot M\_m}{d}}{d} \cdot h\right) \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot -0.125}{\ell}\right) \cdot t\_2\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(\left(D\_m \cdot M\_m\right) \cdot 0.5\right) \cdot \left(\left(M\_m \cdot \frac{0.5}{d}\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 h around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6471.8
Applied rewrites71.8%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 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 h around 0
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification69.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h)))))
(if (<= t_0 (- INFINITY))
(*
(* (/ (* (/ (* (* D_m D_m) h) l) (* -0.125 (* M_m M_m))) (* d d)) t_2)
t_1)
(if (<= t_0 0.0)
(*
(fma
(/ (* (* (* D_m M_m) 0.5) (* (* M_m (/ 0.5 d)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((((D_m * D_m) * h) / l) * (-0.125 * (M_m * M_m))) / (d * d)) * t_2) * t_1;
} else if (t_0 <= 0.0) {
tmp = fma(((((D_m * M_m) * 0.5) * ((M_m * (0.5 / d)) * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(Float64(Float64(D_m * D_m) * h) / l) * Float64(-0.125 * Float64(M_m * M_m))) / Float64(d * d)) * t_2) * t_1); elseif (t_0 <= 0.0) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * 0.5) * Float64(Float64(M_m * Float64(0.5 / d)) * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(-0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $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$95$m), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\frac{\frac{\left(D\_m \cdot D\_m\right) \cdot h}{\ell} \cdot \left(-0.125 \cdot \left(M\_m \cdot M\_m\right)\right)}{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\_m\right) \cdot 0.5\right) \cdot \left(\left(M\_m \cdot \frac{0.5}{d}\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
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 h around inf
Applied rewrites61.1%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 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 h around 0
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification66.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h))))
(t_2 (fabs t_1)))
(if (<= t_0 -2e-73)
(*
(fma
(/ (* (* (* D_m M_m) 0.5) (* D_m M_m)) (* (* 2.0 d) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double t_2 = fabs(t_1);
double tmp;
if (t_0 <= -2e-73) {
tmp = fma(((((D_m * M_m) * 0.5) * (D_m * M_m)) / ((2.0 * d) * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) t_2 = abs(t_1) tmp = 0.0 if (t_0 <= -2e-73) tmp = Float64(fma(Float64(Float64(Float64(Float64(D_m * M_m) * 0.5) * Float64(D_m * M_m)) / Float64(Float64(2.0 * d) * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $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$95$m), $MachinePrecision] * 0.5), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(N[(2.0 * d), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
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\_m\right) \cdot 0.5\right) \cdot \left(D\_m \cdot M\_m\right)}{\left(2 \cdot d\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 h around 0
*-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 h around 0
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification57.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h))))
(t_2 (fabs t_1)))
(if (<= t_0 -1e+127)
(* (* (/ (* (* M_m M_m) h) l) (* (/ (/ (* D_m D_m) d) d) -0.125)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double t_2 = fabs(t_1);
double tmp;
if (t_0 <= -1e+127) {
tmp = ((((M_m * M_m) * h) / l) * ((((D_m * D_m) / d) / d) * -0.125)) * 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)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))
t_1 = d / sqrt((l * h))
t_2 = abs(t_1)
if (t_0 <= (-1d+127)) then
tmp = ((((m_m * m_m) * h) / l) * ((((d_m * d_m) / d) / d) * (-0.125d0))) * 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);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double t_2 = Math.abs(t_1);
double tmp;
if (t_0 <= -1e+127) {
tmp = ((((M_m * M_m) * h) / l) * ((((D_m * D_m) / d) / d) * -0.125)) * 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) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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((l * h)) t_2 = math.fabs(t_1) tmp = 0 if t_0 <= -1e+127: tmp = ((((M_m * M_m) * h) / l) * ((((D_m * D_m) / d) / d) * -0.125)) * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) t_2 = abs(t_1) tmp = 0.0 if (t_0 <= -1e+127) tmp = Float64(Float64(Float64(Float64(Float64(M_m * M_m) * h) / l) * Float64(Float64(Float64(Float64(D_m * D_m) / d) / d) * -0.125)) * 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);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)));
t_1 = d / sqrt((l * h));
t_2 = abs(t_1);
tmp = 0.0;
if (t_0 <= -1e+127)
tmp = ((((M_m * M_m) * h) / l) * ((((D_m * D_m) / d) / d) * -0.125)) * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $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[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] / d), $MachinePrecision] * -0.125), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
t_2 := \left|t\_1\right|\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+127}:\\
\;\;\;\;\left(\frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell} \cdot \left(\frac{\frac{D\_m \cdot D\_m}{d}}{d} \cdot -0.125\right)\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 h around inf
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 h around 0
*-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 h around 0
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification54.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2 (fabs (/ d (sqrt (* l h)))))
(t_3
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = fabs((d / sqrt((l * h))));
double t_3 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((d / l))
t_1 = sqrt((d / h))
t_2 = abs((d / sqrt((l * h))))
t_3 = (1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 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);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((d / l));
double t_1 = Math.sqrt((d / h));
double t_2 = Math.abs((d / Math.sqrt((l * h))));
double t_3 = (1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((d / l)) t_1 = math.sqrt((d / h)) t_2 = math.fabs((d / math.sqrt((l * h)))) t_3 = (1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = abs(Float64(d / sqrt(Float64(l * h)))) t_3 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((d / l));
t_1 = sqrt((d / h));
t_2 = abs((d / sqrt((l * h))));
t_3 = (1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_3 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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 h around 0
*-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 h around 0
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification51.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h))) (- 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -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)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 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 / (l * h))) * -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);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -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) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) * 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);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = abs((d / sqrt((l * h))));
t_1 = (1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 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 / (l * h))) * -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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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}{\ell \cdot h}} \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 h around 0
*-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 h around 0
lower-sqrt.f64N/A
lower-/.f6495.9
Applied rewrites95.9%
Final simplification48.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h))) (- d))
(if (<= t_1 2e-150)
t_0
(if (<= t_1 1e+96) (sqrt (* (/ d h) (/ d l))) t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d;
} else if (t_1 <= 2e-150) {
tmp = t_0;
} else if (t_1 <= 1e+96) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 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 / (l * h))) * -d
else if (t_1 <= 2d-150) then
tmp = t_0
else if (t_1 <= 1d+96) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = t_0
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d;
} else if (t_1 <= 2e-150) {
tmp = t_0;
} else if (t_1 <= 1e+96) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d elif t_1 <= 2e-150: tmp = t_0 elif t_1 <= 1e+96: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = t_0 return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) * Float64(-d)); elseif (t_1 <= 2e-150) tmp = t_0; elseif (t_1 <= 1e+96) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = t_0; end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = abs((d / sqrt((l * h))));
t_1 = (1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 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 / (l * h))) * -d;
elseif (t_1 <= 2e-150)
tmp = t_0;
elseif (t_1 <= 1e+96)
tmp = sqrt(((d / h) * (d / l)));
else
tmp = t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $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 / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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}{\ell \cdot h}} \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}{h} \cdot \frac{d}{\ell}}\\
\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 h around 0
*-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 h around 0
*-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)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (* (/ M_m d) h))
(t_2 (sqrt (/ d l))))
(if (<= t_0 1e+248)
(*
(sqrt (/ d h))
(*
(fma (* (* M_m (/ 0.5 d)) D_m) (/ (* (* t_1 D_m) 0.25) (- l)) 1.0)
t_2))
(if (<= t_0 INFINITY)
(fabs (/ d (sqrt (* l h))))
(*
(*
(fma (/ (* (* M_m 0.5) D_m) (* (- d) l)) (* (* 0.25 D_m) t_1) 1.0)
t_2)
(/ (sqrt d) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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 = (M_m / d) * h;
double t_2 = sqrt((d / l));
double tmp;
if (t_0 <= 1e+248) {
tmp = sqrt((d / h)) * (fma(((M_m * (0.5 / d)) * D_m), (((t_1 * D_m) * 0.25) / -l), 1.0) * t_2);
} else if (t_0 <= ((double) INFINITY)) {
tmp = fabs((d / sqrt((l * h))));
} else {
tmp = (fma((((M_m * 0.5) * D_m) / (-d * l)), ((0.25 * D_m) * t_1), 1.0) * t_2) * (sqrt(d) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(Float64(M_m / d) * h) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (t_0 <= 1e+248) tmp = Float64(sqrt(Float64(d / h)) * Float64(fma(Float64(Float64(M_m * Float64(0.5 / d)) * D_m), Float64(Float64(Float64(t_1 * D_m) * 0.25) / Float64(-l)), 1.0) * t_2)); elseif (t_0 <= Inf) tmp = abs(Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), Float64(Float64(0.25 * D_m) * t_1), 1.0) * t_2) * Float64(sqrt(d) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 1e+248], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(t$95$1 * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{M\_m}{d} \cdot h\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq 10^{+248}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\mathsf{fma}\left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m, \frac{\left(t\_1 \cdot D\_m\right) \cdot 0.25}{-\ell}, 1\right) \cdot t\_2\right)\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, \left(0.25 \cdot D\_m\right) \cdot t\_1, 1\right) \cdot t\_2\right) \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 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-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites82.6%
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)))) < +inf.0Initial program 49.5%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.7
Applied rewrites40.7%
Applied rewrites97.5%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites2.6%
Applied rewrites13.2%
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-*.f6413.1
Applied rewrites13.1%
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.f6428.4
Applied rewrites28.4%
Final simplification76.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h)))))
(if (<= t_0 0.0)
(*
t_1
(fma
(* (* M_m (/ 0.5 d)) D_m)
(* (* (* D_m h) (/ M_m d)) (/ -0.25 l))
1.0))
(if (<= t_0 1e+248) (* (sqrt (/ d l)) (sqrt (/ d h))) (fabs t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double tmp;
if (t_0 <= 0.0) {
tmp = t_1 * fma(((M_m * (0.5 / d)) * D_m), (((D_m * h) * (M_m / d)) * (-0.25 / 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(t_1 * fma(Float64(Float64(M_m * Float64(0.5 / d)) * D_m), Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(t$95$1 * N[(N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\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%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites75.4%
Applied rewrites42.8%
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 h around 0
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 h around 0
*-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.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h)))))
(if (<= t_0 0.0)
(* (/ (fma (* (/ (* D_m D_m) d) -0.125) (/ (* (* M_m 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((l * h));
double tmp;
if (t_0 <= 0.0) {
tmp = (fma((((D_m * D_m) / d) * -0.125), (((M_m * 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) 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 * 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $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$95$m * M$95$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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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{\ell \cdot h}}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{D\_m \cdot D\_m}{d} \cdot -0.125, \frac{\left(M\_m \cdot M\_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 h around 0
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 h around 0
*-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)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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))
(*
(fma
(* (* M_m (/ 0.5 d)) D_m)
(/ (* (* (* (/ M_m d) h) D_m) 0.25) (- l))
1.0)
(sqrt (/ d l))))
(fabs (/ d (sqrt (* l h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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)) * (fma(((M_m * (0.5 / d)) * D_m), (((((M_m / d) * h) * D_m) * 0.25) / -l), 1.0) * sqrt((d / l)));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(fma(Float64(Float64(M_m * Float64(0.5 / d)) * D_m), Float64(Float64(Float64(Float64(Float64(M_m / d) * h) * D_m) * 0.25) / Float64(-l)), 1.0) * sqrt(Float64(d / l)))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] / (-l)), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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(\mathsf{fma}\left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m, \frac{\left(\left(\frac{M\_m}{d} \cdot h\right) \cdot D\_m\right) \cdot 0.25}{-\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites82.6%
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 h around 0
*-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.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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
(* (* M_m (/ 0.5 d)) D_m)
(* (* (/ -0.25 l) (* (/ M_m d) h)) D_m)
1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* l h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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(((M_m * (0.5 / d)) * D_m), (((-0.25 / l) * ((M_m / d) * h)) * D_m), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(M_m * Float64(0.5 / d)) * D_m), Float64(Float64(Float64(-0.25 / l) * Float64(Float64(M_m / d) * h)) * D_m), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(-0.25 / l), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] * D$95$m), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m, \left(\frac{-0.25}{\ell} \cdot \left(\frac{M\_m}{d} \cdot h\right)\right) \cdot D\_m, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites82.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
metadata-eval80.5
Applied rewrites80.5%
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification73.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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
(/ (* (* M_m 0.5) D_m) (* (- d) l))
(* (* (* 0.25 D_m) (/ M_m d)) h)
1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* l h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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((((M_m * 0.5) * D_m) / (-d * l)), (((0.25 * D_m) * (M_m / d)) * h), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), Float64(Float64(Float64(0.25 * D_m) * Float64(M_m / d)) * h), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * h), $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[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, \left(\left(0.25 \cdot D\_m\right) \cdot \frac{M\_m}{d}\right) \cdot h, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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
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-*.f6478.0
Applied rewrites78.0%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6480.6
Applied rewrites80.6%
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 h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.8
Applied rewrites22.8%
Applied rewrites55.0%
Final simplification73.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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 (* l h))) (- d))
(fabs (/ d (sqrt (* l h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d;
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (((1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 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 / (l * h))) * -d
else
tmp = abs((d / sqrt((l * h))))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (((1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d;
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if ((1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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 / (l * h))) * -d else: tmp = math.fabs((d / math.sqrt((l * h)))) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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(l * h))) * Float64(-d)); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (((1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 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 / (l * h))) * -d;
else
tmp = abs((d / sqrt((l * h))));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\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 h around 0
*-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)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ d (sqrt (* l h)))))
(if (<=
(*
(-
1.0
(* (* (pow (/ (* D_m M_m) (* 2.0 d)) 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);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double tmp;
if (((1.0 - ((pow(((D_m * M_m) / (2.0 * d)), 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)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((l * h))
if (((1.0d0 - (((((d_m * m_m) / (2.0d0 * d)) ** 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);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (((1.0 - ((Math.pow(((D_m * M_m) / (2.0 * d)), 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) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = d / math.sqrt((l * h)) tmp = 0 if ((1.0 - ((math.pow(((D_m * M_m) / (2.0 * d)), 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) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 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);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = d / sqrt((l * h));
tmp = 0.0;
if (((1.0 - (((((D_m * M_m) / (2.0 * d)) ^ 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]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $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|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;\left(1 - \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\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 h around 0
*-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 h around 0
*-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)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* M_m (/ 0.5 d)) D_m))
(t_1 (fma (/ t_0 (- l)) (* (* 0.25 D_m) (* (/ M_m d) h)) 1.0))
(t_2 (sqrt (- d))))
(if (<= h -5e-310)
(* (/ t_2 (sqrt (- h))) (* (/ t_2 (sqrt (- l))) t_1))
(if (<= h 2.8e+82)
(*
(/ d (sqrt (* l h)))
(fma t_0 (* (* (* D_m h) (/ M_m d)) (/ -0.25 l)) 1.0))
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_1))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * (0.5 / d)) * D_m;
double t_1 = fma((t_0 / -l), ((0.25 * D_m) * ((M_m / d) * h)), 1.0);
double t_2 = sqrt(-d);
double tmp;
if (h <= -5e-310) {
tmp = (t_2 / sqrt(-h)) * ((t_2 / sqrt(-l)) * t_1);
} else if (h <= 2.8e+82) {
tmp = (d / sqrt((l * h))) * fma(t_0, (((D_m * h) * (M_m / d)) * (-0.25 / l)), 1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * Float64(0.5 / d)) * D_m) t_1 = fma(Float64(t_0 / Float64(-l)), Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)), 1.0) t_2 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(t_2 / sqrt(Float64(-h))) * Float64(Float64(t_2 / sqrt(Float64(-l))) * t_1)); elseif (h <= 2.8e+82) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(t_0, Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / l)), 1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_1)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 / (-l)), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(t$95$2 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$2 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.8e+82], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m\\
t_1 := \mathsf{fma}\left(\frac{t\_0}{-\ell}, \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right), 1\right)\\
t_2 := \sqrt{-d}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{t\_2}{\sqrt{-h}} \cdot \left(\frac{t\_2}{\sqrt{-\ell}} \cdot t\_1\right)\\
\mathbf{elif}\;h \leq 2.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(t\_0, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites66.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.f6474.3
Applied rewrites74.3%
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
lift-sqrt.f64N/A
lower-/.f6488.3
Applied rewrites88.3%
if -4.999999999999985e-310 < h < 2.8e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites71.6%
Applied rewrites85.1%
if 2.8e82 < 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 simplification86.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* M_m (/ 0.5 d)) D_m))
(t_1
(*
(sqrt (/ d l))
(fma (/ t_0 (- l)) (* (* 0.25 D_m) (* (/ M_m d) h)) 1.0))))
(if (<= h -5e-310)
(* t_1 (/ (sqrt (- d)) (sqrt (- h))))
(if (<= h 2.8e+82)
(*
(/ d (sqrt (* l h)))
(fma t_0 (* (* (* D_m h) (/ M_m d)) (/ -0.25 l)) 1.0))
(* (/ (sqrt d) (sqrt h)) t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * (0.5 / d)) * D_m;
double t_1 = sqrt((d / l)) * fma((t_0 / -l), ((0.25 * D_m) * ((M_m / d) * h)), 1.0);
double tmp;
if (h <= -5e-310) {
tmp = t_1 * (sqrt(-d) / sqrt(-h));
} else if (h <= 2.8e+82) {
tmp = (d / sqrt((l * h))) * fma(t_0, (((D_m * h) * (M_m / d)) * (-0.25 / l)), 1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * Float64(0.5 / d)) * D_m) t_1 = Float64(sqrt(Float64(d / l)) * fma(Float64(t_0 / Float64(-l)), Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)), 1.0)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_1 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))); elseif (h <= 2.8e+82) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(t_0, Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / l)), 1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 / (-l)), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$1 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.8e+82], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m\\
t_1 := \sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\frac{t\_0}{-\ell}, \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right), 1\right)\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq 2.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(t\_0, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_1\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites66.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
lift-sqrt.f64N/A
lower-/.f6477.6
Applied rewrites77.6%
if -4.999999999999985e-310 < h < 2.8e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites71.6%
Applied rewrites85.1%
if 2.8e82 < 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.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* 0.25 D_m) (* (/ M_m d) h)))
(t_1 (* (* M_m (/ 0.5 d)) D_m))
(t_2 (sqrt (/ d l))))
(if (<= h -5e-310)
(*
(* (fma (/ (* (* M_m 0.5) D_m) (* (- d) l)) t_0 1.0) t_2)
(/ (sqrt (- d)) (sqrt (- h))))
(if (<= h 2.8e+82)
(*
(/ d (sqrt (* l h)))
(fma t_1 (* (* (* D_m h) (/ M_m d)) (/ -0.25 l)) 1.0))
(* (/ (sqrt d) (sqrt h)) (* t_2 (fma (/ t_1 (- l)) t_0 1.0)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (0.25 * D_m) * ((M_m / d) * h);
double t_1 = (M_m * (0.5 / d)) * D_m;
double t_2 = sqrt((d / l));
double tmp;
if (h <= -5e-310) {
tmp = (fma((((M_m * 0.5) * D_m) / (-d * l)), t_0, 1.0) * t_2) * (sqrt(-d) / sqrt(-h));
} else if (h <= 2.8e+82) {
tmp = (d / sqrt((l * h))) * fma(t_1, (((D_m * h) * (M_m / d)) * (-0.25 / l)), 1.0);
} else {
tmp = (sqrt(d) / sqrt(h)) * (t_2 * fma((t_1 / -l), t_0, 1.0));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)) t_1 = Float64(Float64(M_m * Float64(0.5 / d)) * D_m) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (h <= -5e-310) tmp = Float64(Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), t_0, 1.0) * t_2) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))); elseif (h <= 2.8e+82) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(t_1, Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / l)), 1.0)); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_2 * fma(Float64(t_1 / Float64(-l)), t_0, 1.0))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.8e+82], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * N[(N[(t$95$1 / (-l)), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right)\\
t_1 := \left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, t\_0, 1\right) \cdot t\_2\right) \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq 2.8 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(t\_1, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_2 \cdot \mathsf{fma}\left(\frac{t\_1}{-\ell}, t\_0, 1\right)\right)\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites66.0%
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-*.f6462.0
Applied rewrites62.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
lift-sqrt.f64N/A
lower-/.f6473.6
Applied rewrites73.6%
if -4.999999999999985e-310 < h < 2.8e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites71.6%
Applied rewrites85.1%
if 2.8e82 < 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 simplification78.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(fma
(/ (* (* M_m 0.5) D_m) (* (- d) l))
(* (* 0.25 D_m) (* (/ M_m d) h))
1.0)
(sqrt (/ d l)))))
(if (<= h -5e-310)
(* t_0 (/ (sqrt (- d)) (sqrt (- h))))
(if (<= h 2.85e+82)
(*
(/ d (sqrt (* l h)))
(fma
(* (* M_m (/ 0.5 d)) D_m)
(* (* (* D_m h) (/ M_m d)) (/ -0.25 l))
1.0))
(* t_0 (/ (sqrt d) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma((((M_m * 0.5) * D_m) / (-d * l)), ((0.25 * D_m) * ((M_m / d) * h)), 1.0) * sqrt((d / l));
double tmp;
if (h <= -5e-310) {
tmp = t_0 * (sqrt(-d) / sqrt(-h));
} else if (h <= 2.85e+82) {
tmp = (d / sqrt((l * h))) * fma(((M_m * (0.5 / d)) * D_m), (((D_m * h) * (M_m / d)) * (-0.25 / l)), 1.0);
} else {
tmp = t_0 * (sqrt(d) / sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(fma(Float64(Float64(Float64(M_m * 0.5) * D_m) / Float64(Float64(-d) * l)), Float64(Float64(0.25 * D_m) * Float64(Float64(M_m / d) * h)), 1.0) * sqrt(Float64(d / l))) tmp = 0.0 if (h <= -5e-310) tmp = Float64(t_0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h)))); elseif (h <= 2.85e+82) tmp = Float64(Float64(d / sqrt(Float64(l * h))) * fma(Float64(Float64(M_m * Float64(0.5 / d)) * D_m), Float64(Float64(Float64(D_m * h) * Float64(M_m / d)) * Float64(-0.25 / l)), 1.0)); else tmp = Float64(t_0 * Float64(sqrt(d) / sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(N[(M$95$m * 0.5), $MachinePrecision] * D$95$m), $MachinePrecision] / N[((-d) * l), $MachinePrecision]), $MachinePrecision] * N[(N[(0.25 * D$95$m), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -5e-310], N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 2.85e+82], N[(N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(N[(N[(D$95$m * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.25 / l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{\left(M\_m \cdot 0.5\right) \cdot D\_m}{\left(-d\right) \cdot \ell}, \left(0.25 \cdot D\_m\right) \cdot \left(\frac{M\_m}{d} \cdot h\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq 2.85 \cdot 10^{+82}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\left(M\_m \cdot \frac{0.5}{d}\right) \cdot D\_m, \left(\left(D\_m \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{-0.25}{\ell}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{\sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -4.999999999999985e-310Initial program 65.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.9%
Applied rewrites66.0%
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-*.f6462.0
Applied rewrites62.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
lift-sqrt.f64N/A
lower-/.f6473.6
Applied rewrites73.6%
if -4.999999999999985e-310 < h < 2.85000000000000008e82Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.8%
Applied rewrites71.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
metadata-evalN/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-fma.f64N/A
Applied rewrites71.6%
Applied rewrites85.1%
if 2.85000000000000008e82 < 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-/.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-*.f6462.7
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.5
Applied rewrites80.5%
Final simplification78.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= d -1.35e+154)
(* (* 1.0 (/ (sqrt (- d)) (sqrt (- l)))) t_0)
(if (<= d -1.6e-255)
(*
(*
(/
(fma (* (* -0.125 D_m) (/ (* (* M_m M_m) h) l)) D_m (* d d))
(* d d))
(sqrt (/ d l)))
t_0)
(*
(fma
(* (* (* (* (/ M_m d) h) D_m) 0.25) (* M_m (/ 0.5 d)))
(/ (- D_m) l)
1.0)
(/ d (sqrt (* l h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double tmp;
if (d <= -1.35e+154) {
tmp = (1.0 * (sqrt(-d) / sqrt(-l))) * t_0;
} else if (d <= -1.6e-255) {
tmp = ((fma(((-0.125 * D_m) * (((M_m * M_m) * h) / l)), D_m, (d * d)) / (d * d)) * sqrt((d / l))) * t_0;
} else {
tmp = fma((((((M_m / d) * h) * D_m) * 0.25) * (M_m * (0.5 / d))), (-D_m / l), 1.0) * (d / sqrt((l * h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -1.35e+154) tmp = Float64(Float64(1.0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * t_0); elseif (d <= -1.6e-255) tmp = Float64(Float64(Float64(fma(Float64(Float64(-0.125 * D_m) * Float64(Float64(Float64(M_m * M_m) * h) / l)), D_m, Float64(d * d)) / Float64(d * d)) * sqrt(Float64(d / l))) * t_0); else tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M_m / d) * h) * D_m) * 0.25) * Float64(M_m * Float64(0.5 / d))), Float64(Float64(-D_m) / l), 1.0) * Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.35e+154], N[(N[(1.0 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[d, -1.6e-255], N[(N[(N[(N[(N[(N[(-0.125 * D$95$m), $MachinePrecision] * N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * D$95$m + N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\left(1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot t\_0\\
\mathbf{elif}\;d \leq -1.6 \cdot 10^{-255}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\left(-0.125 \cdot D\_m\right) \cdot \frac{\left(M\_m \cdot M\_m\right) \cdot h}{\ell}, D\_m, d \cdot d\right)}{d \cdot d} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\frac{M\_m}{d} \cdot h\right) \cdot D\_m\right) \cdot 0.25\right) \cdot \left(M\_m \cdot \frac{0.5}{d}\right), \frac{-D\_m}{\ell}, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -1.35000000000000003e154Initial program 75.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites79.5%
Applied rewrites76.1%
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.f6489.4
Applied rewrites89.4%
Taylor expanded in h around 0
Applied rewrites78.7%
if -1.35000000000000003e154 < d < -1.59999999999999996e-255Initial program 68.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites66.9%
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
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6449.9
Applied rewrites49.9%
Applied rewrites53.0%
if -1.59999999999999996e-255 < d Initial program 61.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites60.1%
Applied rewrites63.5%
Applied rewrites68.1%
Final simplification63.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= h -1.35e-172)
(* (* 1.0 (/ (sqrt (- d)) (sqrt (- l)))) (sqrt (/ d h)))
(if (<= h -5e-310)
(* (sqrt (/ 1.0 (* l h))) (- d))
(*
(fma
(* (* (* (* (/ M_m d) h) D_m) 0.25) (* M_m (/ 0.5 d)))
(/ (- D_m) l)
1.0)
(/ d (sqrt (* l h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (h <= -1.35e-172) {
tmp = (1.0 * (sqrt(-d) / sqrt(-l))) * sqrt((d / h));
} else if (h <= -5e-310) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = fma((((((M_m / d) * h) * D_m) * 0.25) * (M_m * (0.5 / d))), (-D_m / l), 1.0) * (d / sqrt((l * h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (h <= -1.35e-172) tmp = Float64(Float64(1.0 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * sqrt(Float64(d / h))); elseif (h <= -5e-310) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(fma(Float64(Float64(Float64(Float64(Float64(M_m / d) * h) * D_m) * 0.25) * Float64(M_m * Float64(0.5 / d))), Float64(Float64(-D_m) / l), 1.0) * Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[h, -1.35e-172], N[(N[(1.0 * 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[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * 0.25), $MachinePrecision] * N[(M$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[((-D$95$m) / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;h \leq -1.35 \cdot 10^{-172}:\\
\;\;\;\;\left(1 \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(\frac{M\_m}{d} \cdot h\right) \cdot D\_m\right) \cdot 0.25\right) \cdot \left(M\_m \cdot \frac{0.5}{d}\right), \frac{-D\_m}{\ell}, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if h < -1.35000000000000013e-172Initial program 70.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.7%
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%
Taylor expanded in h around 0
Applied rewrites43.8%
if -1.35000000000000013e-172 < h < -4.999999999999985e-310Initial program 46.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-*.f6465.1
Applied rewrites65.1%
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%
Applied rewrites74.2%
Final simplification60.7%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* l h))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((l * h));
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((l * h))
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 65.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites21.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)))))