
(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 22 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 (* D_m (/ M_m d)))
(t_1 (pow (/ l h) -0.75))
(t_2
(fma
(* (/ D_m 2.0) (/ M_m d))
(/ (* (* (/ M_m d) D_m) (* -0.5 h)) (* 2.0 l))
1.0)))
(if (<= d -4.2e-215)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 7.6e-211)
(/ (* (* (* D_m D_m) -0.125) (* t_1 (* t_1 (* (/ M_m d) M_m)))) h)
(if (<= d 4.1e+195)
(* (* (pow (/ d h) (pow 2.0 -1.0)) (/ (sqrt d) (sqrt l))) t_2)
(* (* (/ (sqrt d) (sqrt h)) (pow (/ d l) (pow 2.0 -1.0))) 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 = D_m * (M_m / d);
double t_1 = pow((l / h), -0.75);
double t_2 = fma(((D_m / 2.0) * (M_m / d)), ((((M_m / d) * D_m) * (-0.5 * h)) / (2.0 * l)), 1.0);
double tmp;
if (d <= -4.2e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 7.6e-211) {
tmp = (((D_m * D_m) * -0.125) * (t_1 * (t_1 * ((M_m / d) * M_m)))) / h;
} else if (d <= 4.1e+195) {
tmp = (pow((d / h), pow(2.0, -1.0)) * (sqrt(d) / sqrt(l))) * t_2;
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), pow(2.0, -1.0))) * 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(D_m * Float64(M_m / d)) t_1 = Float64(l / h) ^ -0.75 t_2 = fma(Float64(Float64(D_m / 2.0) * Float64(M_m / d)), Float64(Float64(Float64(Float64(M_m / d) * D_m) * Float64(-0.5 * h)) / Float64(2.0 * l)), 1.0) tmp = 0.0 if (d <= -4.2e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 7.6e-211) tmp = Float64(Float64(Float64(Float64(D_m * D_m) * -0.125) * Float64(t_1 * Float64(t_1 * Float64(Float64(M_m / d) * M_m)))) / h); elseif (d <= 4.1e+195) tmp = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * Float64(sqrt(d) / sqrt(l))) * t_2); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(l / h), $MachinePrecision], -0.75], $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(-0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -4.2e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.6e-211], N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(t$95$1 * N[(t$95$1 * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 4.1e+195], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := {\left(\frac{\ell}{h}\right)}^{-0.75}\\
t_2 := \mathsf{fma}\left(\frac{D\_m}{2} \cdot \frac{M\_m}{d}, \frac{\left(\frac{M\_m}{d} \cdot D\_m\right) \cdot \left(-0.5 \cdot h\right)}{2 \cdot \ell}, 1\right)\\
\mathbf{if}\;d \leq -4.2 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 7.6 \cdot 10^{-211}:\\
\;\;\;\;\frac{\left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right) \cdot \left(t\_1 \cdot \left(t\_1 \cdot \left(\frac{M\_m}{d} \cdot M\_m\right)\right)\right)}{h}\\
\mathbf{elif}\;d \leq 4.1 \cdot 10^{+195}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot t\_2\\
\end{array}
\end{array}
if d < -4.2e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -4.2e-215 < d < 7.60000000000000023e-211Initial program 40.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites59.9%
Applied rewrites61.9%
Taylor expanded in d around 0
Applied rewrites56.8%
Applied rewrites66.8%
if 7.60000000000000023e-211 < d < 4.1e195Initial program 72.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites74.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.6
Applied rewrites74.6%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6485.4
Applied rewrites85.4%
if 4.1e195 < d Initial program 68.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites72.2%
Applied rewrites68.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6472.2
Applied rewrites72.2%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6495.2
Applied rewrites95.2%
Final simplification84.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
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_1 (sqrt (/ h l))))
(if (or (<= t_0 2e-191) (not (<= t_0 INFINITY)))
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(* (/ h l) t_1)
(* t_1 d))
h)
(* (sqrt (/ d l)) (sqrt (/ d 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 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((h / l));
double tmp;
if ((t_0 <= 2e-191) || !(t_0 <= ((double) INFINITY))) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) * t_1), (t_1 * d)) / h;
} else {
tmp = sqrt((d / l)) * sqrt((d / 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((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(h / l)) tmp = 0.0 if ((t_0 <= 2e-191) || !(t_0 <= Inf)) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) * t_1), Float64(t_1 * d)) / h); else tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / 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[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t$95$0, 2e-191], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$1), $MachinePrecision] + N[(t$95$1 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / 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({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-191} \lor \neg \left(t\_0 \leq \infty\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{h}{\ell} \cdot t\_1, t\_1 \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-191 or +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 53.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites44.5%
Applied rewrites50.7%
if 2e-191 < (*.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 84.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.4
Applied rewrites44.4%
Applied rewrites84.0%
Final simplification63.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d)))
(t_1
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(*
(* (pow 2.0 -1.0) (pow (/ (* M_m D_m) (* 2.0 d)) 2.0))
(/ h l)))))
(t_2 (sqrt (/ h l)))
(t_3 (* t_2 d)))
(if (<= t_1 2e-191)
(/ (fma t_0 (/ (/ h l) (sqrt (/ l h))) t_3) h)
(if (<= t_1 INFINITY)
(* (sqrt (/ d l)) (sqrt (/ d h)))
(/ (fma t_0 (* (/ h l) t_2) t_3) 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 * M_m) * -0.125) * ((D_m * D_m) / d);
double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M_m * D_m) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = sqrt((h / l));
double t_3 = t_2 * d;
double tmp;
if (t_1 <= 2e-191) {
tmp = fma(t_0, ((h / l) / sqrt((l / h))), t_3) / h;
} else if (t_1 <= ((double) INFINITY)) {
tmp = sqrt((d / l)) * sqrt((d / h));
} else {
tmp = fma(t_0, ((h / l) * t_2), t_3) / 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(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)) t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M_m * D_m) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = sqrt(Float64(h / l)) t_3 = Float64(t_2 * d) tmp = 0.0 if (t_1 <= 2e-191) tmp = Float64(fma(t_0, Float64(Float64(h / l) / sqrt(Float64(l / h))), t_3) / h); elseif (t_1 <= Inf) tmp = Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))); else tmp = Float64(fma(t_0, Float64(Float64(h / l) * t_2), t_3) / 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[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * d), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-191], N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + t$95$3), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] + t$95$3), $MachinePrecision] / h), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M\_m \cdot D\_m}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{h}{\ell}}\\
t_3 := t\_2 \cdot d\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-191}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, t\_3\right)}{h}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, \frac{h}{\ell} \cdot t\_2, t\_3\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-191Initial program 78.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.5%
Applied rewrites58.8%
if 2e-191 < (*.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 84.7%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6444.4
Applied rewrites44.4%
Applied rewrites84.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)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites31.8%
Applied rewrites33.8%
Final simplification63.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d)))
(t_1
(fma
(* (/ D_m 2.0) (/ M_m d))
(/ (* (* (/ M_m d) D_m) (* -0.5 h)) (* 2.0 l))
1.0)))
(if (<= l -5e-310)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= l 2.9e-134)
(* (* (pow (/ d h) (pow 2.0 -1.0)) (/ (sqrt d) (sqrt l))) t_1)
(* (* (/ (sqrt d) (sqrt h)) (pow (/ d l) (pow 2.0 -1.0))) 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 = D_m * (M_m / d);
double t_1 = fma(((D_m / 2.0) * (M_m / d)), ((((M_m / d) * D_m) * (-0.5 * h)) / (2.0 * l)), 1.0);
double tmp;
if (l <= -5e-310) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (l <= 2.9e-134) {
tmp = (pow((d / h), pow(2.0, -1.0)) * (sqrt(d) / sqrt(l))) * t_1;
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), pow(2.0, -1.0))) * 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(D_m * Float64(M_m / d)) t_1 = fma(Float64(Float64(D_m / 2.0) * Float64(M_m / d)), Float64(Float64(Float64(Float64(M_m / d) * D_m) * Float64(-0.5 * h)) / Float64(2.0 * l)), 1.0) tmp = 0.0 if (l <= -5e-310) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (l <= 2.9e-134) tmp = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * Float64(sqrt(d) / sqrt(l))) * t_1); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(-0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.9e-134], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \mathsf{fma}\left(\frac{D\_m}{2} \cdot \frac{M\_m}{d}, \frac{\left(\frac{M\_m}{d} \cdot D\_m\right) \cdot \left(-0.5 \cdot h\right)}{2 \cdot \ell}, 1\right)\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 2.9 \cdot 10^{-134}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \frac{\sqrt{d}}{\sqrt{\ell}}\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot t\_1\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 63.3%
Applied rewrites76.4%
Applied rewrites82.3%
if -4.999999999999985e-310 < l < 2.89999999999999993e-134Initial program 60.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites65.4%
Applied rewrites57.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6461.9
Applied rewrites61.9%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6480.7
Applied rewrites80.7%
if 2.89999999999999993e-134 < l Initial program 69.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites68.0%
Applied rewrites71.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6484.4
Applied rewrites84.4%
Final simplification82.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))))
(if (<= d -3.8e-215)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 6e-210)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(*
(* (/ (sqrt d) (sqrt h)) (pow (/ d l) (pow 2.0 -1.0)))
(fma
(* (/ D_m 2.0) (/ M_m d))
(/ (* (* (/ M_m d) D_m) (* -0.5 h)) (* 2.0 l))
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 = D_m * (M_m / d);
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 6e-210) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else {
tmp = ((sqrt(d) / sqrt(h)) * pow((d / l), pow(2.0, -1.0))) * fma(((D_m / 2.0) * (M_m / d)), ((((M_m / d) * D_m) * (-0.5 * h)) / (2.0 * l)), 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(D_m * Float64(M_m / d)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 6e-210) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * fma(Float64(Float64(D_m / 2.0) * Float64(M_m / d)), Float64(Float64(Float64(Float64(M_m / d) * D_m) * Float64(-0.5 * h)) / Float64(2.0 * l)), 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6e-210], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D$95$m / 2.0), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(-0.5 * h), $MachinePrecision]), $MachinePrecision] / N[(2.0 * l), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 6 \cdot 10^{-210}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \mathsf{fma}\left(\frac{D\_m}{2} \cdot \frac{M\_m}{d}, \frac{\left(\frac{M\_m}{d} \cdot D\_m\right) \cdot \left(-0.5 \cdot h\right)}{2 \cdot \ell}, 1\right)\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 6.0000000000000003e-210Initial program 39.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites58.8%
Applied rewrites62.6%
Taylor expanded in d around 0
Applied rewrites55.8%
Applied rewrites63.8%
if 6.0000000000000003e-210 < d Initial program 72.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites72.6%
Applied rewrites73.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6474.7
Applied rewrites74.7%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6483.3
Applied rewrites83.3%
Final simplification81.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 (* D_m (/ M_m d)))
(t_1 (fma (* (pow (* (/ M_m d) D_m) 2.0) 0.25) (* (/ h l) -0.5) 1.0))
(t_2 (sqrt (/ d l))))
(if (<= d -3.8e-215)
(/
(*
(* (fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0) t_2)
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.02e-241)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(if (<= d 5.3e-104)
(* t_1 (/ d (sqrt (* l h))))
(if (<= d 6.6e+146)
(* (* t_1 (sqrt (/ d h))) t_2)
(/ d (* (sqrt l) (sqrt h)))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double t_1 = fma((pow(((M_m / d) * D_m), 2.0) * 0.25), ((h / l) * -0.5), 1.0);
double t_2 = sqrt((d / l));
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * t_2) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.02e-241) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else if (d <= 5.3e-104) {
tmp = t_1 * (d / sqrt((l * h)));
} else if (d <= 6.6e+146) {
tmp = (t_1 * sqrt((d / h))) * t_2;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = fma(Float64((Float64(Float64(M_m / d) * D_m) ^ 2.0) * 0.25), Float64(Float64(h / l) * -0.5), 1.0) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * t_2) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.02e-241) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); elseif (d <= 5.3e-104) tmp = Float64(t_1 * Float64(d / sqrt(Float64(l * h)))); elseif (d <= 6.6e+146) tmp = Float64(Float64(t_1 * sqrt(Float64(d / h))) * t_2); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e-241], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 5.3e-104], N[(t$95$1 * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.6e+146], N[(N[(t$95$1 * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \mathsf{fma}\left({\left(\frac{M\_m}{d} \cdot D\_m\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot t\_2\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{-241}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{elif}\;d \leq 5.3 \cdot 10^{-104}:\\
\;\;\;\;t\_1 \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;d \leq 6.6 \cdot 10^{+146}:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{\frac{d}{h}}\right) \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 1.01999999999999994e-241Initial program 40.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites59.0%
Applied rewrites61.3%
Taylor expanded in d around 0
Applied rewrites56.9%
Applied rewrites63.9%
if 1.01999999999999994e-241 < d < 5.30000000000000018e-104Initial program 49.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites49.3%
Applied rewrites45.6%
Applied rewrites78.1%
if 5.30000000000000018e-104 < d < 6.60000000000000032e146Initial program 81.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites80.1%
Applied rewrites86.4%
Applied rewrites80.1%
if 6.60000000000000032e146 < d Initial program 68.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.7
Applied rewrites79.7%
Applied rewrites79.6%
Applied rewrites90.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 (* D_m (/ M_m d))) (t_1 (sqrt (/ d l))))
(if (<= d -3.8e-215)
(/
(*
(* (fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0) t_1)
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 6e-210)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(/
(*
(sqrt d)
(*
(fma (* (pow (* (/ M_m d) D_m) 2.0) 0.25) (* (/ h l) -0.5) 1.0)
t_1))
(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 = D_m * (M_m / d);
double t_1 = sqrt((d / l));
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * t_1) * sqrt(-d)) / sqrt(-h);
} else if (d <= 6e-210) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else {
tmp = (sqrt(d) * (fma((pow(((M_m / d) * D_m), 2.0) * 0.25), ((h / l) * -0.5), 1.0) * t_1)) / 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(D_m * Float64(M_m / d)) t_1 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * t_1) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 6e-210) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); else tmp = Float64(Float64(sqrt(d) * Float64(fma(Float64((Float64(Float64(M_m / d) * D_m) ^ 2.0) * 0.25), Float64(Float64(h / l) * -0.5), 1.0) * t_1)) / 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[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6e-210], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] * N[(N[(N[(N[Power[N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $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 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot t\_1\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 6 \cdot 10^{-210}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d} \cdot \left(\mathsf{fma}\left({\left(\frac{M\_m}{d} \cdot D\_m\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot t\_1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 6.0000000000000003e-210Initial program 39.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites58.8%
Applied rewrites62.6%
Taylor expanded in d around 0
Applied rewrites55.8%
Applied rewrites63.8%
if 6.0000000000000003e-210 < d Initial program 72.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites72.6%
Applied rewrites73.5%
Applied rewrites79.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 (* D_m (/ M_m d))))
(if (<= d -3.8e-215)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 3.9e-224)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(if (<= d 8.8e+126)
(/
(*
(/ d (sqrt h))
(fma (* -0.5 (/ h l)) (* 0.25 (pow (/ (/ d D_m) M_m) -2.0)) 1.0))
(sqrt l))
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 3.9e-224) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else if (d <= 8.8e+126) {
tmp = ((d / sqrt(h)) * fma((-0.5 * (h / l)), (0.25 * pow(((d / D_m) / M_m), -2.0)), 1.0)) / sqrt(l);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 3.9e-224) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); elseif (d <= 8.8e+126) tmp = Float64(Float64(Float64(d / sqrt(h)) * fma(Float64(-0.5 * Float64(h / l)), Float64(0.25 * (Float64(Float64(d / D_m) / M_m) ^ -2.0)), 1.0)) / sqrt(l)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.9e-224], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 8.8e+126], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(0.25 * N[Power[N[(N[(d / D$95$m), $MachinePrecision] / M$95$m), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 3.9 \cdot 10^{-224}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{elif}\;d \leq 8.8 \cdot 10^{+126}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}} \cdot \mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, 0.25 \cdot {\left(\frac{\frac{d}{D\_m}}{M\_m}\right)}^{-2}, 1\right)}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 3.8999999999999998e-224Initial program 39.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites58.2%
Applied rewrites60.3%
Taylor expanded in d around 0
Applied rewrites55.0%
Applied rewrites63.5%
if 3.8999999999999998e-224 < d < 8.79999999999999994e126Initial program 72.9%
Applied rewrites0.0%
Applied rewrites86.0%
if 8.79999999999999994e126 < d Initial program 68.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6478.6
Applied rewrites78.6%
Applied rewrites78.5%
Applied rewrites88.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m d))))
(if (<= d -3.8e-215)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.02e-241)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(if (<= d 1.02e+122)
(*
(fma (* (pow (* (/ M_m d) D_m) 2.0) 0.25) (* (/ h l) -0.5) 1.0)
(/ d (sqrt (* l h))))
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.02e-241) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else if (d <= 1.02e+122) {
tmp = fma((pow(((M_m / d) * D_m), 2.0) * 0.25), ((h / l) * -0.5), 1.0) * (d / sqrt((l * h)));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.02e-241) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); elseif (d <= 1.02e+122) tmp = Float64(fma(Float64((Float64(Float64(M_m / d) * D_m) ^ 2.0) * 0.25), Float64(Float64(h / l) * -0.5), 1.0) * Float64(d / sqrt(Float64(l * h)))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.02e-241], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.02e+122], N[(N[(N[(N[Power[N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision], 2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{-241}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{elif}\;d \leq 1.02 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left({\left(\frac{M\_m}{d} \cdot D\_m\right)}^{2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 1.01999999999999994e-241Initial program 40.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites59.0%
Applied rewrites61.3%
Taylor expanded in d around 0
Applied rewrites56.9%
Applied rewrites63.9%
if 1.01999999999999994e-241 < d < 1.0200000000000001e122Initial program 70.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites68.9%
Applied rewrites71.9%
Applied rewrites73.2%
if 1.0200000000000001e122 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (* D_m (/ M_m d)))
(t_1 (/ d (sqrt (* l h))))
(t_2 (* D_m (/ 0.5 d))))
(if (<= d -3.8e-215)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.32e-207)
(/ (* (* (/ M_m d) M_m) (* (pow (/ h l) 1.5) (* (* D_m D_m) -0.125))) h)
(if (<= d 1.6e+115)
(fma (* t_1 (* (* (* (/ h l) -0.5) M_m) t_2)) (* t_2 M_m) t_1)
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double t_1 = d / sqrt((l * h));
double t_2 = D_m * (0.5 / d);
double tmp;
if (d <= -3.8e-215) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.32e-207) {
tmp = (((M_m / d) * M_m) * (pow((h / l), 1.5) * ((D_m * D_m) * -0.125))) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_1 * ((((h / l) * -0.5) * M_m) * t_2)), (t_2 * M_m), t_1);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(d / sqrt(Float64(l * h))) t_2 = Float64(D_m * Float64(0.5 / d)) tmp = 0.0 if (d <= -3.8e-215) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.32e-207) tmp = Float64(Float64(Float64(Float64(M_m / d) * M_m) * Float64((Float64(h / l) ^ 1.5) * Float64(Float64(D_m * D_m) * -0.125))) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_1 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_2)), Float64(t_2 * M_m), t_1); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.8e-215], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.32e-207], N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] * N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$1 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * M$95$m), $MachinePrecision] + t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_2 := D\_m \cdot \frac{0.5}{d}\\
\mathbf{if}\;d \leq -3.8 \cdot 10^{-215}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.32 \cdot 10^{-207}:\\
\;\;\;\;\frac{\left(\frac{M\_m}{d} \cdot M\_m\right) \cdot \left({\left(\frac{h}{\ell}\right)}^{1.5} \cdot \left(\left(D\_m \cdot D\_m\right) \cdot -0.125\right)\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_2\right), t\_2 \cdot M\_m, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.79999999999999977e-215Initial program 70.5%
Applied rewrites81.4%
Applied rewrites88.7%
if -3.79999999999999977e-215 < d < 1.32000000000000003e-207Initial program 40.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites57.6%
Applied rewrites63.3%
Taylor expanded in d around 0
Applied rewrites54.7%
Applied rewrites64.5%
if 1.32000000000000003e-207 < d < 1.6e115Initial program 73.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites72.3%
Applied rewrites75.7%
Applied rewrites70.0%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (* D_m (/ M_m d)))
(t_1 (/ d (sqrt (* l h))))
(t_2 (* D_m (/ 0.5 d))))
(if (<= d -5.7e-214)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.32e-207)
(/ (* D_m (* D_m (* (* -0.125 (pow (/ h l) 1.5)) (* (/ M_m d) M_m)))) h)
(if (<= d 1.6e+115)
(fma (* t_1 (* (* (* (/ h l) -0.5) M_m) t_2)) (* t_2 M_m) t_1)
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double t_1 = d / sqrt((l * h));
double t_2 = D_m * (0.5 / d);
double tmp;
if (d <= -5.7e-214) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.32e-207) {
tmp = (D_m * (D_m * ((-0.125 * pow((h / l), 1.5)) * ((M_m / d) * M_m)))) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_1 * ((((h / l) * -0.5) * M_m) * t_2)), (t_2 * M_m), t_1);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(d / sqrt(Float64(l * h))) t_2 = Float64(D_m * Float64(0.5 / d)) tmp = 0.0 if (d <= -5.7e-214) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.32e-207) tmp = Float64(Float64(D_m * Float64(D_m * Float64(Float64(-0.125 * (Float64(h / l) ^ 1.5)) * Float64(Float64(M_m / d) * M_m)))) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_1 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_2)), Float64(t_2 * M_m), t_1); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.7e-214], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.32e-207], N[(N[(D$95$m * N[(D$95$m * N[(N[(-0.125 * N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$1 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * M$95$m), $MachinePrecision] + t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_2 := D\_m \cdot \frac{0.5}{d}\\
\mathbf{if}\;d \leq -5.7 \cdot 10^{-214}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.32 \cdot 10^{-207}:\\
\;\;\;\;\frac{D\_m \cdot \left(D\_m \cdot \left(\left(-0.125 \cdot {\left(\frac{h}{\ell}\right)}^{1.5}\right) \cdot \left(\frac{M\_m}{d} \cdot M\_m\right)\right)\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_2\right), t\_2 \cdot M\_m, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.6999999999999996e-214Initial program 71.9%
Applied rewrites83.0%
Applied rewrites89.5%
if -5.6999999999999996e-214 < d < 1.32000000000000003e-207Initial program 39.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites55.5%
Applied rewrites60.9%
Taylor expanded in d around 0
Applied rewrites53.0%
Applied rewrites70.4%
if 1.32000000000000003e-207 < d < 1.6e115Initial program 73.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites72.3%
Applied rewrites75.7%
Applied rewrites70.0%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (* D_m (/ 0.5 d))) (t_1 (/ d (sqrt (* l h)))))
(if (<= d -1.32e+154)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.5e-186)
(/
(*
(*
(/
(fma (* -0.125 (* D_m D_m)) (* h (/ (* M_m M_m) l)) (* d d))
(* d d))
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.1e-206)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.6e+115)
(fma (* t_1 (* (* (* (/ h l) -0.5) M_m) t_0)) (* t_0 M_m) t_1)
(/ d (* (sqrt l) (sqrt h)))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (0.5 / d);
double t_1 = d / sqrt((l * h));
double tmp;
if (d <= -1.32e+154) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.5e-186) {
tmp = (((fma((-0.125 * (D_m * D_m)), (h * ((M_m * M_m) / l)), (d * d)) / (d * d)) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.1e-206) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_1 * ((((h / l) * -0.5) * M_m) * t_0)), (t_0 * M_m), t_1);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(0.5 / d)) t_1 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (d <= -1.32e+154) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.5e-186) tmp = Float64(Float64(Float64(Float64(fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(h * Float64(Float64(M_m * M_m) / l)), Float64(d * d)) / Float64(d * d)) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.1e-206) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_1 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_0)), Float64(t_0 * M_m), t_1); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.32e+154], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.5e-186], N[(N[(N[(N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-206], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$1 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * M$95$m), $MachinePrecision] + t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{0.5}{d}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;d \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-186}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), h \cdot \frac{M\_m \cdot M\_m}{\ell}, d \cdot d\right)}{d \cdot d} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_0\right), t\_0 \cdot M\_m, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.31999999999999998e154Initial program 76.3%
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-*.f6462.6
Applied rewrites62.6%
if -1.31999999999999998e154 < d < -1.5000000000000001e-186Initial program 73.0%
Applied rewrites83.1%
Taylor expanded in d around 0
lower-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.0
Applied rewrites70.0%
if -1.5000000000000001e-186 < d < 1.0999999999999999e-206Initial program 39.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites52.5%
Applied rewrites59.4%
if 1.0999999999999999e-206 < d < 1.6e115Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites75.3%
Applied rewrites69.5%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.1%
Final simplification69.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 (/ d (sqrt (* l h)))) (t_1 (* D_m (/ 0.5 d))))
(if (<= d -1.32e+154)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.5e-186)
(/
(*
(*
(/
(fma (* -0.125 (* D_m D_m)) (* h (/ (* M_m M_m) l)) (* d d))
(* d d))
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.1e-206)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.6e+115)
(fma (* t_0 (* t_1 M_m)) (* (* (* (/ h l) -0.5) M_m) t_1) t_0)
(/ d (* (sqrt l) (sqrt h)))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double t_1 = D_m * (0.5 / d);
double tmp;
if (d <= -1.32e+154) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.5e-186) {
tmp = (((fma((-0.125 * (D_m * D_m)), (h * ((M_m * M_m) / l)), (d * d)) / (d * d)) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.1e-206) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_0 * (t_1 * M_m)), ((((h / l) * -0.5) * M_m) * t_1), t_0);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) t_1 = Float64(D_m * Float64(0.5 / d)) tmp = 0.0 if (d <= -1.32e+154) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.5e-186) tmp = Float64(Float64(Float64(Float64(fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(h * Float64(Float64(M_m * M_m) / l)), Float64(d * d)) / Float64(d * d)) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.1e-206) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_0 * Float64(t_1 * M_m)), Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_1), t_0); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.32e+154], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.5e-186], N[(N[(N[(N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-206], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$0 * N[(t$95$1 * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$1), $MachinePrecision] + t$95$0), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := D\_m \cdot \frac{0.5}{d}\\
\mathbf{if}\;d \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-186}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), h \cdot \frac{M\_m \cdot M\_m}{\ell}, d \cdot d\right)}{d \cdot d} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(t\_1 \cdot M\_m\right), \left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_1, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.31999999999999998e154Initial program 76.3%
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-*.f6462.6
Applied rewrites62.6%
if -1.31999999999999998e154 < d < -1.5000000000000001e-186Initial program 73.0%
Applied rewrites83.1%
Taylor expanded in d around 0
lower-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.0
Applied rewrites70.0%
if -1.5000000000000001e-186 < d < 1.0999999999999999e-206Initial program 39.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites52.5%
Applied rewrites59.4%
if 1.0999999999999999e-206 < d < 1.6e115Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites75.3%
Applied rewrites69.5%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.1%
Final simplification69.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 (* D_m (/ M_m d)))
(t_1 (/ d (sqrt (* l h))))
(t_2 (* D_m (/ 0.5 d))))
(if (<= d -5.5e-291)
(/
(*
(*
(fma (/ (* 0.5 t_0) 2.0) (/ (* (* t_0 h) -0.5) l) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.1e-206)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.6e+115)
(fma (* t_1 (* (* (* (/ h l) -0.5) M_m) t_2)) (* t_2 M_m) t_1)
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / d);
double t_1 = d / sqrt((l * h));
double t_2 = D_m * (0.5 / d);
double tmp;
if (d <= -5.5e-291) {
tmp = ((fma(((0.5 * t_0) / 2.0), (((t_0 * h) * -0.5) / l), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.1e-206) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_1 * ((((h / l) * -0.5) * M_m) * t_2)), (t_2 * M_m), t_1);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / d)) t_1 = Float64(d / sqrt(Float64(l * h))) t_2 = Float64(D_m * Float64(0.5 / d)) tmp = 0.0 if (d <= -5.5e-291) tmp = Float64(Float64(Float64(fma(Float64(Float64(0.5 * t_0) / 2.0), Float64(Float64(Float64(t_0 * h) * -0.5) / l), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.1e-206) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_1 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_2)), Float64(t_2 * M_m), t_1); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.5e-291], N[(N[(N[(N[(N[(N[(0.5 * t$95$0), $MachinePrecision] / 2.0), $MachinePrecision] * N[(N[(N[(t$95$0 * h), $MachinePrecision] * -0.5), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-206], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$1 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(t$95$2 * M$95$m), $MachinePrecision] + t$95$1), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d}\\
t_1 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_2 := D\_m \cdot \frac{0.5}{d}\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{-291}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{0.5 \cdot t\_0}{2}, \frac{\left(t\_0 \cdot h\right) \cdot -0.5}{\ell}, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_2\right), t\_2 \cdot M\_m, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.5000000000000002e-291Initial program 64.4%
Applied rewrites77.2%
Applied rewrites83.3%
if -5.5000000000000002e-291 < d < 1.0999999999999999e-206Initial program 46.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites62.4%
Applied rewrites69.1%
if 1.0999999999999999e-206 < d < 1.6e115Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites75.3%
Applied rewrites69.5%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (/ d (sqrt (* l h))))
(t_1 (* D_m (/ 0.5 d)))
(t_2 (* D_m (/ M_m d))))
(if (<= d -5.5e-291)
(/
(*
(*
(fma (* (* t_2 h) -0.5) (* (/ 0.5 l) (* 0.5 t_2)) 1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.1e-206)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.6e+115)
(fma (* t_0 (* (* (* (/ h l) -0.5) M_m) t_1)) (* t_1 M_m) t_0)
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double t_1 = D_m * (0.5 / d);
double t_2 = D_m * (M_m / d);
double tmp;
if (d <= -5.5e-291) {
tmp = ((fma(((t_2 * h) * -0.5), ((0.5 / l) * (0.5 * t_2)), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.1e-206) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_0 * ((((h / l) * -0.5) * M_m) * t_1)), (t_1 * M_m), t_0);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) t_1 = Float64(D_m * Float64(0.5 / d)) t_2 = Float64(D_m * Float64(M_m / d)) tmp = 0.0 if (d <= -5.5e-291) tmp = Float64(Float64(Float64(fma(Float64(Float64(t_2 * h) * -0.5), Float64(Float64(0.5 / l) * Float64(0.5 * t_2)), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.1e-206) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_0 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_1)), Float64(t_1 * M_m), t_0); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.5e-291], N[(N[(N[(N[(N[(N[(t$95$2 * h), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(0.5 / l), $MachinePrecision] * N[(0.5 * t$95$2), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-206], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$0 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * M$95$m), $MachinePrecision] + t$95$0), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := D\_m \cdot \frac{0.5}{d}\\
t_2 := D\_m \cdot \frac{M\_m}{d}\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{-291}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(t\_2 \cdot h\right) \cdot -0.5, \frac{0.5}{\ell} \cdot \left(0.5 \cdot t\_2\right), 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_1\right), t\_1 \cdot M\_m, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.5000000000000002e-291Initial program 64.4%
Applied rewrites77.2%
Applied rewrites83.4%
if -5.5000000000000002e-291 < d < 1.0999999999999999e-206Initial program 46.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites62.4%
Applied rewrites69.1%
if 1.0999999999999999e-206 < d < 1.6e115Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites75.3%
Applied rewrites69.5%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (/ d (sqrt (* l h)))) (t_1 (* D_m (/ 0.5 d))))
(if (<= d -5.5e-291)
(/
(*
(*
(fma
(* (* (* -0.25 (/ h l)) (* D_m (/ M_m d))) (/ M_m d))
(* 0.5 D_m)
1.0)
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 1.1e-206)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(if (<= d 1.6e+115)
(fma (* t_0 (* (* (* (/ h l) -0.5) M_m) t_1)) (* t_1 M_m) t_0)
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt((l * h));
double t_1 = D_m * (0.5 / d);
double tmp;
if (d <= -5.5e-291) {
tmp = ((fma((((-0.25 * (h / l)) * (D_m * (M_m / d))) * (M_m / d)), (0.5 * D_m), 1.0) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 1.1e-206) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else if (d <= 1.6e+115) {
tmp = fma((t_0 * ((((h / l) * -0.5) * M_m) * t_1)), (t_1 * M_m), t_0);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(Float64(l * h))) t_1 = Float64(D_m * Float64(0.5 / d)) tmp = 0.0 if (d <= -5.5e-291) tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(-0.25 * Float64(h / l)) * Float64(D_m * Float64(M_m / d))) * Float64(M_m / d)), Float64(0.5 * D_m), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 1.1e-206) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); elseif (d <= 1.6e+115) tmp = fma(Float64(t_0 * Float64(Float64(Float64(Float64(h / l) * -0.5) * M_m) * t_1)), Float64(t_1 * M_m), t_0); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.5e-291], N[(N[(N[(N[(N[(N[(N[(-0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(0.5 * D$95$m), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.1e-206], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 1.6e+115], N[(N[(t$95$0 * N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * M$95$m), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * M$95$m), $MachinePrecision] + t$95$0), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
t_1 := D\_m \cdot \frac{0.5}{d}\\
\mathbf{if}\;d \leq -5.5 \cdot 10^{-291}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\left(-0.25 \cdot \frac{h}{\ell}\right) \cdot \left(D\_m \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{M\_m}{d}, 0.5 \cdot D\_m, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 1.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot M\_m\right) \cdot t\_1\right), t\_1 \cdot M\_m, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.5000000000000002e-291Initial program 64.4%
Applied rewrites77.2%
Applied rewrites78.7%
if -5.5000000000000002e-291 < d < 1.0999999999999999e-206Initial program 46.6%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites62.4%
Applied rewrites69.1%
if 1.0999999999999999e-206 < d < 1.6e115Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites71.9%
Applied rewrites75.3%
Applied rewrites69.5%
if 1.6e115 < d Initial program 69.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites79.1%
Applied rewrites89.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 (<= d -1.32e+154)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.5e-186)
(/
(*
(*
(/
(fma (* -0.125 (* D_m D_m)) (* h (/ (* M_m M_m) l)) (* d d))
(* d d))
(sqrt (/ d l)))
(sqrt (- d)))
(sqrt (- h)))
(if (<= d 4.7e+124)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(/ d (* (sqrt l) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.32e+154) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.5e-186) {
tmp = (((fma((-0.125 * (D_m * D_m)), (h * ((M_m * M_m) / l)), (d * d)) / (d * d)) * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (d <= 4.7e+124) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.32e+154) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.5e-186) tmp = Float64(Float64(Float64(Float64(fma(Float64(-0.125 * Float64(D_m * D_m)), Float64(h * Float64(Float64(M_m * M_m) / l)), Float64(d * d)) / Float64(d * d)) * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (d <= 4.7e+124) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.32e+154], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.5e-186], N[(N[(N[(N[(N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.7e+124], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.5 \cdot 10^{-186}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(-0.125 \cdot \left(D\_m \cdot D\_m\right), h \cdot \frac{M\_m \cdot M\_m}{\ell}, d \cdot d\right)}{d \cdot d} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq 4.7 \cdot 10^{+124}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.31999999999999998e154Initial program 76.3%
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-*.f6462.6
Applied rewrites62.6%
if -1.31999999999999998e154 < d < -1.5000000000000001e-186Initial program 73.0%
Applied rewrites83.1%
Taylor expanded in d around 0
lower-/.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.0
Applied rewrites70.0%
if -1.5000000000000001e-186 < d < 4.69999999999999991e124Initial program 56.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites51.0%
Applied rewrites58.7%
if 4.69999999999999991e124 < d Initial program 68.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6478.6
Applied rewrites78.6%
Applied rewrites78.5%
Applied rewrites88.9%
Final simplification66.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 (<= d -2.7e-78)
(/
(*
(*
(fma (/ h (* l d)) (* (* -0.125 (* D_m D_m)) (/ (* M_m M_m) d)) 1.0)
(sqrt (/ d h)))
(sqrt (- d)))
(sqrt (- l)))
(if (<= d 4.7e+124)
(/
(fma
(* (* (* M_m M_m) -0.125) (/ (* D_m D_m) d))
(/ (/ h l) (sqrt (/ l h)))
(* (sqrt (/ h l)) d))
h)
(/ d (* (sqrt l) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.7e-78) {
tmp = ((fma((h / (l * d)), ((-0.125 * (D_m * D_m)) * ((M_m * M_m) / d)), 1.0) * sqrt((d / h))) * sqrt(-d)) / sqrt(-l);
} else if (d <= 4.7e+124) {
tmp = fma((((M_m * M_m) * -0.125) * ((D_m * D_m) / d)), ((h / l) / sqrt((l / h))), (sqrt((h / l)) * d)) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -2.7e-78) tmp = Float64(Float64(Float64(fma(Float64(h / Float64(l * d)), Float64(Float64(-0.125 * Float64(D_m * D_m)) * Float64(Float64(M_m * M_m) / d)), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(-d))) / sqrt(Float64(-l))); elseif (d <= 4.7e+124) tmp = Float64(fma(Float64(Float64(Float64(M_m * M_m) * -0.125) * Float64(Float64(D_m * D_m) / d)), Float64(Float64(h / l) / sqrt(Float64(l / h))), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2.7e-78], N[(N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.7e+124], N[(N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] / N[Sqrt[N[(l / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.7 \cdot 10^{-78}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\frac{h}{\ell \cdot d}, \left(-0.125 \cdot \left(D\_m \cdot D\_m\right)\right) \cdot \frac{M\_m \cdot M\_m}{d}, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 4.7 \cdot 10^{+124}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right) \cdot \frac{D\_m \cdot D\_m}{d}, \frac{\frac{h}{\ell}}{\sqrt{\frac{\ell}{h}}}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.69999999999999994e-78Initial program 78.4%
Applied rewrites79.4%
Taylor expanded in d around 0
+-commutativeN/A
metadata-evalN/A
cancel-sign-sub-invN/A
div-subN/A
*-inversesN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
Applied rewrites62.1%
if -2.69999999999999994e-78 < d < 4.69999999999999991e124Initial program 56.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.2%
Applied rewrites57.5%
if 4.69999999999999991e124 < d Initial program 68.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6478.6
Applied rewrites78.6%
Applied rewrites78.5%
Applied rewrites88.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 (<= l -2.5e-139)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 5.8e-298)
(/ (* (- d) (sqrt (/ h l))) h)
(/ d (* (sqrt l) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.5e-139) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 5.8e-298) {
tmp = (-d * sqrt((h / l))) / h;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= (-2.5d-139)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (l <= 5.8d-298) then
tmp = (-d * sqrt((h / l))) / h
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.5e-139) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (l <= 5.8e-298) {
tmp = (-d * Math.sqrt((h / l))) / h;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= -2.5e-139: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif l <= 5.8e-298: tmp = (-d * math.sqrt((h / l))) / h else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.5e-139) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 5.8e-298) tmp = Float64(Float64(Float64(-d) * sqrt(Float64(h / l))) / h); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= -2.5e-139)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (l <= 5.8e-298)
tmp = (-d * sqrt((h / l))) / h;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.5e-139], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 5.8e-298], N[(N[((-d) * N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{-139}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-298}:\\
\;\;\;\;\frac{\left(-d\right) \cdot \sqrt{\frac{h}{\ell}}}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -2.50000000000000017e-139Initial program 60.2%
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-*.f6445.2
Applied rewrites45.2%
if -2.50000000000000017e-139 < l < 5.8000000000000003e-298Initial program 71.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites31.4%
Taylor expanded in l around -inf
Applied rewrites44.9%
if 5.8000000000000003e-298 < l Initial program 67.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6448.6
Applied rewrites48.6%
Applied rewrites49.3%
Applied rewrites54.9%
Final simplification49.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 (<= d 7.5e-208) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (* (sqrt l) (sqrt h)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 7.5e-208) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= 7.5d-208) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= 7.5e-208) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= 7.5e-208: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= 7.5e-208) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= 7.5e-208)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, 7.5e-208], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 7.5 \cdot 10^{-208}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < 7.4999999999999999e-208Initial program 61.0%
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-*.f6436.3
Applied rewrites36.3%
if 7.4999999999999999e-208 < d Initial program 72.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.2
Applied rewrites56.2%
Applied rewrites56.2%
Applied rewrites63.0%
Final simplification46.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 (if (<= l -1e-201) (* (- d) (sqrt (pow (* l h) -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 (l <= -1e-201) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = 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 (l <= (-1d-201)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = 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 (l <= -1e-201) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = 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 l <= -1e-201: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = 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 (l <= -1e-201) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = 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 (l <= -1e-201)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = 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[l, -1e-201], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-201}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -9.99999999999999946e-202Initial program 61.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-*.f6441.8
Applied rewrites41.8%
if -9.99999999999999946e-202 < l Initial program 68.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.7
Applied rewrites46.7%
Applied rewrites47.3%
Final simplification44.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 (/ 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.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.9
Applied rewrites27.9%
Applied rewrites28.2%
herbie shell --seed 2024296
(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)))))