
(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 21 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 (sqrt l))) (t_1 (* (/ M_m d) D_m)))
(if (<= d -2e+88)
(*
(/ (- d) (sqrt (* h l)))
(-
1.0
(*
(/ (* (* (/ 0.5 d) M_m) D_m) l)
(/ (* (* 0.5 (* D_m 0.5)) (/ M_m d)) (pow h -1.0)))))
(if (<= d -5e-310)
(*
(* (fma -0.5 (* (* (* 0.25 (/ h l)) t_1) t_1) 1.0) (sqrt (/ d h)))
(/ (sqrt (- d)) (sqrt (- l))))
(if (<= d 1.85e+172)
(*
(/ (fma (* -0.125 (sqrt h)) (* t_1 t_1) (* (sqrt (pow h -1.0)) l)) l)
t_0)
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
t_0))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = d / sqrt(l);
double t_1 = (M_m / d) * D_m;
double tmp;
if (d <= -2e+88) {
tmp = (-d / sqrt((h * l))) * (1.0 - (((((0.5 / d) * M_m) * D_m) / l) * (((0.5 * (D_m * 0.5)) * (M_m / d)) / pow(h, -1.0))));
} else if (d <= -5e-310) {
tmp = (fma(-0.5, (((0.25 * (h / l)) * t_1) * t_1), 1.0) * sqrt((d / h))) * (sqrt(-d) / sqrt(-l));
} else if (d <= 1.85e+172) {
tmp = (fma((-0.125 * sqrt(h)), (t_1 * t_1), (sqrt(pow(h, -1.0)) * l)) / l) * t_0;
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(d / sqrt(l)) t_1 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (d <= -2e+88) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(0.5 / d) * M_m) * D_m) / l) * Float64(Float64(Float64(0.5 * Float64(D_m * 0.5)) * Float64(M_m / d)) / (h ^ -1.0))))); elseif (d <= -5e-310) tmp = Float64(Float64(fma(-0.5, Float64(Float64(Float64(0.25 * Float64(h / l)) * t_1) * t_1), 1.0) * sqrt(Float64(d / h))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (d <= 1.85e+172) tmp = Float64(Float64(fma(Float64(-0.125 * sqrt(h)), Float64(t_1 * t_1), Float64(sqrt((h ^ -1.0)) * l)) / l) * t_0); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_0); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[d, -2e+88], N[(N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(0.5 * N[(D$95$m * 0.5), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(-0.5 * N[(N[(N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e+172], N[(N[(N[(N[(-0.125 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$1), $MachinePrecision] + N[(N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell}}\\
t_1 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;d \leq -2 \cdot 10^{+88}:\\
\;\;\;\;\frac{-d}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m}{\ell} \cdot \frac{\left(0.5 \cdot \left(D\_m \cdot 0.5\right)\right) \cdot \frac{M\_m}{d}}{{h}^{-1}}\right)\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, \left(\left(0.25 \cdot \frac{h}{\ell}\right) \cdot t\_1\right) \cdot t\_1, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{+172}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \sqrt{h}, t\_1 \cdot t\_1, \sqrt{{h}^{-1}} \cdot \ell\right)}{\ell} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot t\_0\\
\end{array}
\end{array}
if d < -1.99999999999999992e88Initial program 62.8%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
div-invN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites69.5%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow-prod-downN/A
unpow1/2N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqrt-divN/A
sqr-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-*.f6495.6
Applied rewrites95.6%
if -1.99999999999999992e88 < d < -4.999999999999985e-310Initial program 78.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites77.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
Applied rewrites77.2%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6487.2
Applied rewrites87.2%
if -4.999999999999985e-310 < d < 1.84999999999999986e172Initial program 70.9%
Taylor expanded in d around inf
Applied rewrites34.7%
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.2
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites39.2%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites81.3%
if 1.84999999999999986e172 < d Initial program 61.6%
Taylor expanded in d around inf
Applied rewrites38.4%
Applied rewrites60.9%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites64.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites79.8%
Final simplification85.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m)) (t_1 (/ d (sqrt l))))
(if (<= d -8.8e+88)
(*
(fma -0.5 (* (/ h l) (* 0.25 (pow (* D_m (/ M_m d)) 2.0))) 1.0)
(/ (- d) (sqrt (* h l))))
(if (<= d -5e-310)
(*
(* (fma -0.5 (* (* (* 0.25 (/ h l)) t_0) t_0) 1.0) (sqrt (/ d h)))
(/ (sqrt (- d)) (sqrt (- l))))
(if (<= d 1.85e+172)
(*
(/ (fma (* -0.125 (sqrt h)) (* t_0 t_0) (* (sqrt (pow h -1.0)) l)) l)
t_1)
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
t_1))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = d / sqrt(l);
double tmp;
if (d <= -8.8e+88) {
tmp = fma(-0.5, ((h / l) * (0.25 * pow((D_m * (M_m / d)), 2.0))), 1.0) * (-d / sqrt((h * l)));
} else if (d <= -5e-310) {
tmp = (fma(-0.5, (((0.25 * (h / l)) * t_0) * t_0), 1.0) * sqrt((d / h))) * (sqrt(-d) / sqrt(-l));
} else if (d <= 1.85e+172) {
tmp = (fma((-0.125 * sqrt(h)), (t_0 * t_0), (sqrt(pow(h, -1.0)) * l)) / l) * t_1;
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = Float64(d / sqrt(l)) tmp = 0.0 if (d <= -8.8e+88) tmp = Float64(fma(-0.5, Float64(Float64(h / l) * Float64(0.25 * (Float64(D_m * Float64(M_m / d)) ^ 2.0))), 1.0) * Float64(Float64(-d) / sqrt(Float64(h * l)))); elseif (d <= -5e-310) tmp = Float64(Float64(fma(-0.5, Float64(Float64(Float64(0.25 * Float64(h / l)) * t_0) * t_0), 1.0) * sqrt(Float64(d / h))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (d <= 1.85e+172) tmp = Float64(Float64(fma(Float64(-0.125 * sqrt(h)), Float64(t_0 * t_0), Float64(sqrt((h ^ -1.0)) * l)) / l) * t_1); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.8e+88], N[(N[(-0.5 * N[(N[(h / l), $MachinePrecision] * N[(0.25 * N[Power[N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[(-0.5 * N[(N[(N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e+172], N[(N[(N[(N[(-0.125 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \frac{d}{\sqrt{\ell}}\\
\mathbf{if}\;d \leq -8.8 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h}{\ell} \cdot \left(0.25 \cdot {\left(D\_m \cdot \frac{M\_m}{d}\right)}^{2}\right), 1\right) \cdot \frac{-d}{\sqrt{h \cdot \ell}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, \left(\left(0.25 \cdot \frac{h}{\ell}\right) \cdot t\_0\right) \cdot t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{+172}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \sqrt{h}, t\_0 \cdot t\_0, \sqrt{{h}^{-1}} \cdot \ell\right)}{\ell} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot t\_1\\
\end{array}
\end{array}
if d < -8.80000000000000035e88Initial program 62.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites87.5%
if -8.80000000000000035e88 < d < -4.999999999999985e-310Initial program 78.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites77.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.2
Applied rewrites77.2%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6487.2
Applied rewrites87.2%
if -4.999999999999985e-310 < d < 1.84999999999999986e172Initial program 70.9%
Taylor expanded in d around inf
Applied rewrites34.7%
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.2
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites39.2%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites81.3%
if 1.84999999999999986e172 < d Initial program 61.6%
Taylor expanded in d around inf
Applied rewrites38.4%
Applied rewrites60.9%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites64.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites79.8%
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 (* (/ M_m d) D_m)))
(if (<= l -2.9e+129)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 1.72e-153)
(*
(*
(fma
(* (* (/ (* h 0.25) d) (/ M_m l)) (* D_m (/ M_m d)))
(* D_m -0.5)
1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(if (<= l 1.22e+244)
(*
(/ (fma (* -0.125 (sqrt h)) (* t_0 t_0) (* (sqrt (pow h -1.0)) l)) l)
(/ d (sqrt l)))
(/ d (sqrt (* l h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (l <= -2.9e+129) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 1.72e-153) {
tmp = (fma(((((h * 0.25) / d) * (M_m / l)) * (D_m * (M_m / d))), (D_m * -0.5), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else if (l <= 1.22e+244) {
tmp = (fma((-0.125 * sqrt(h)), (t_0 * t_0), (sqrt(pow(h, -1.0)) * l)) / l) * (d / sqrt(l));
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (l <= -2.9e+129) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 1.72e-153) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(h * 0.25) / d) * Float64(M_m / l)) * Float64(D_m * Float64(M_m / d))), Float64(D_m * -0.5), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); elseif (l <= 1.22e+244) tmp = Float64(Float64(fma(Float64(-0.125 * sqrt(h)), Float64(t_0 * t_0), Float64(sqrt((h ^ -1.0)) * l)) / l) * Float64(d / sqrt(l))); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[l, -2.9e+129], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.72e-153], N[(N[(N[(N[(N[(N[(N[(h * 0.25), $MachinePrecision] / d), $MachinePrecision] * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.22e+244], N[(N[(N[(N[(-0.125 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(d / N[Sqrt[l], $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}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+129}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 1.72 \cdot 10^{-153}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h \cdot 0.25}{d} \cdot \frac{M\_m}{\ell}\right) \cdot \left(D\_m \cdot \frac{M\_m}{d}\right), D\_m \cdot -0.5, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;\ell \leq 1.22 \cdot 10^{+244}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \sqrt{h}, t\_0 \cdot t\_0, \sqrt{{h}^{-1}} \cdot \ell\right)}{\ell} \cdot \frac{d}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < -2.90000000000000003e129Initial program 35.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6452.8
Applied rewrites52.8%
Taylor expanded in d 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-*.f6463.0
Applied rewrites63.0%
if -2.90000000000000003e129 < l < 1.71999999999999997e-153Initial program 85.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6421.6
Applied rewrites21.6%
Applied rewrites84.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites82.1%
if 1.71999999999999997e-153 < l < 1.22000000000000005e244Initial program 68.7%
Taylor expanded in d around inf
Applied rewrites42.6%
Applied rewrites43.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6443.0
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites48.0%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites84.4%
if 1.22000000000000005e244 < l Initial program 22.9%
Taylor expanded in d around inf
Applied rewrites23.7%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6480.0
Applied rewrites80.0%
Applied rewrites80.0%
Final simplification80.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 (* (/ M_m d) D_m)) (t_1 (/ d (sqrt l))))
(if (<= d -5e-310)
(*
(* (fma -0.5 (* (* (* 0.25 (/ h l)) t_0) t_0) 1.0) (sqrt (/ d h)))
(/ (sqrt (- d)) (sqrt (- l))))
(if (<= d 1.85e+172)
(*
(/ (fma (* -0.125 (sqrt h)) (* t_0 t_0) (* (sqrt (pow h -1.0)) l)) l)
t_1)
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
t_1)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double t_1 = d / sqrt(l);
double tmp;
if (d <= -5e-310) {
tmp = (fma(-0.5, (((0.25 * (h / l)) * t_0) * t_0), 1.0) * sqrt((d / h))) * (sqrt(-d) / sqrt(-l));
} else if (d <= 1.85e+172) {
tmp = (fma((-0.125 * sqrt(h)), (t_0 * t_0), (sqrt(pow(h, -1.0)) * l)) / l) * t_1;
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) t_1 = Float64(d / sqrt(l)) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(fma(-0.5, Float64(Float64(Float64(0.25 * Float64(h / l)) * t_0) * t_0), 1.0) * sqrt(Float64(d / h))) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))); elseif (d <= 1.85e+172) tmp = Float64(Float64(fma(Float64(-0.125 * sqrt(h)), Float64(t_0 * t_0), Float64(sqrt((h ^ -1.0)) * l)) / l) * t_1); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(-0.5 * N[(N[(N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.85e+172], N[(N[(N[(N[(-0.125 * N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * t$95$0), $MachinePrecision] + N[(N[Sqrt[N[Power[h, -1.0], $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
t_1 := \frac{d}{\sqrt{\ell}}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, \left(\left(0.25 \cdot \frac{h}{\ell}\right) \cdot t\_0\right) \cdot t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 1.85 \cdot 10^{+172}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.125 \cdot \sqrt{h}, t\_0 \cdot t\_0, \sqrt{{h}^{-1}} \cdot \ell\right)}{\ell} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot t\_1\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 72.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites73.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.4
Applied rewrites73.4%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f6481.6
Applied rewrites81.6%
if -4.999999999999985e-310 < d < 1.84999999999999986e172Initial program 70.9%
Taylor expanded in d around inf
Applied rewrites34.7%
Applied rewrites34.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6434.2
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites39.2%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites81.3%
if 1.84999999999999986e172 < d Initial program 61.6%
Taylor expanded in d around inf
Applied rewrites38.4%
Applied rewrites60.9%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites64.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites79.8%
Final simplification81.3%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ -0.125 (* l d)))
(t_2 (* (* (* (* M_m M_m) h) D_m) (/ D_m d))))
(if (<= d -8.6e+82)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.75e+33)
(* (* (* t_1 t_2) t_0) (sqrt (/ d l)))
(if (<= d 1.15e-304)
(* (* t_0 (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(/ (* (* (sqrt (pow l -1.0)) d) (fma t_1 t_2 1.0)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = -0.125 / (l * d);
double t_2 = (((M_m * M_m) * h) * D_m) * (D_m / d);
double tmp;
if (d <= -8.6e+82) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.75e+33) {
tmp = ((t_1 * t_2) * t_0) * sqrt((d / l));
} else if (d <= 1.15e-304) {
tmp = (t_0 * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else {
tmp = ((sqrt(pow(l, -1.0)) * d) * fma(t_1, t_2, 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(-0.125 / Float64(l * d)) t_2 = Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)) tmp = 0.0 if (d <= -8.6e+82) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.75e+33) tmp = Float64(Float64(Float64(t_1 * t_2) * t_0) * sqrt(Float64(d / l))); elseif (d <= 1.15e-304) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); else tmp = Float64(Float64(Float64(sqrt((l ^ -1.0)) * d) * fma(t_1, t_2, 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+82], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.75e+33], N[(N[(N[(t$95$1 * t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[Sqrt[N[Power[l, -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * N[(t$95$1 * t$95$2 + 1.0), $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 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{-0.125}{\ell \cdot d}\\
t_2 := \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+82}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{+33}:\\
\;\;\;\;\left(\left(t\_1 \cdot t\_2\right) \cdot t\_0\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_0 \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sqrt{{\ell}^{-1}} \cdot d\right) \cdot \mathsf{fma}\left(t\_1, t\_2, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -8.60000000000000029e82Initial program 64.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in d 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-*.f6479.6
Applied rewrites79.6%
if -8.60000000000000029e82 < d < -1.75000000000000005e33Initial program 99.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites99.7%
Taylor expanded in d around 0
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -1.75000000000000005e33 < d < 1.15e-304Initial program 74.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d Initial program 68.8%
Taylor expanded in d around inf
Applied rewrites35.7%
Applied rewrites39.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6471.4
Applied rewrites71.4%
Final simplification67.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 -2.9e+129)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 2.8e-152)
(*
(*
(fma
(* (* (/ (* h 0.25) d) (/ M_m l)) (* D_m (/ M_m d)))
(* D_m -0.5)
1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(/
(*
(* (sqrt (pow l -1.0)) d)
(fma (/ -0.125 (* l d)) (* (* (* (* M_m M_m) h) D_m) (/ D_m d)) 1.0))
(sqrt h)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -2.9e+129) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 2.8e-152) {
tmp = (fma(((((h * 0.25) / d) * (M_m / l)) * (D_m * (M_m / d))), (D_m * -0.5), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = ((sqrt(pow(l, -1.0)) * d) * fma((-0.125 / (l * d)), ((((M_m * M_m) * h) * D_m) * (D_m / d)), 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -2.9e+129) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 2.8e-152) tmp = Float64(Float64(fma(Float64(Float64(Float64(Float64(h * 0.25) / d) * Float64(M_m / l)) * Float64(D_m * Float64(M_m / d))), Float64(D_m * -0.5), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(Float64(sqrt((l ^ -1.0)) * d) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)), 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -2.9e+129], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.8e-152], N[(N[(N[(N[(N[(N[(N[(h * 0.25), $MachinePrecision] / d), $MachinePrecision] * N[(M$95$m / l), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[Power[l, -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $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}
\mathbf{if}\;\ell \leq -2.9 \cdot 10^{+129}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-152}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\frac{h \cdot 0.25}{d} \cdot \frac{M\_m}{\ell}\right) \cdot \left(D\_m \cdot \frac{M\_m}{d}\right), D\_m \cdot -0.5, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sqrt{{\ell}^{-1}} \cdot d\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -2.90000000000000003e129Initial program 35.7%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6452.8
Applied rewrites52.8%
Taylor expanded in d 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-*.f6463.0
Applied rewrites63.0%
if -2.90000000000000003e129 < l < 2.79999999999999984e-152Initial program 85.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6421.6
Applied rewrites21.6%
Applied rewrites84.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites82.1%
if 2.79999999999999984e-152 < l Initial program 63.9%
Taylor expanded in d around inf
Applied rewrites40.6%
Applied rewrites46.0%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites55.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6470.4
Applied rewrites70.4%
Final simplification75.1%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (/ M_m d) D_m)))
(if (<= l -1.15e+145)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 2.8e-152)
(*
(* (fma -0.5 (* (* (* 0.25 (/ h l)) t_0) t_0) 1.0) (sqrt (/ d h)))
(sqrt (/ d l)))
(/
(*
(* (sqrt (pow l -1.0)) d)
(fma (/ -0.125 (* l d)) (* (* (* (* M_m M_m) h) D_m) (/ D_m d)) 1.0))
(sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (l <= -1.15e+145) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 2.8e-152) {
tmp = (fma(-0.5, (((0.25 * (h / l)) * t_0) * t_0), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = ((sqrt(pow(l, -1.0)) * d) * fma((-0.125 / (l * d)), ((((M_m * M_m) * h) * D_m) * (D_m / d)), 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (l <= -1.15e+145) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 2.8e-152) tmp = Float64(Float64(fma(-0.5, Float64(Float64(Float64(0.25 * Float64(h / l)) * t_0) * t_0), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(Float64(sqrt((l ^ -1.0)) * d) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)), 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[l, -1.15e+145], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.8e-152], N[(N[(N[(-0.5 * N[(N[(N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[N[Power[l, -1.0], $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $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 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;\ell \leq -1.15 \cdot 10^{+145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-152}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, \left(\left(0.25 \cdot \frac{h}{\ell}\right) \cdot t\_0\right) \cdot t\_0, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\sqrt{{\ell}^{-1}} \cdot d\right) \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if l < -1.15e145Initial program 27.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6446.8
Applied rewrites46.8%
Taylor expanded in d 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-*.f6461.4
Applied rewrites61.4%
if -1.15e145 < l < 2.79999999999999984e-152Initial program 86.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6420.9
Applied rewrites20.9%
Applied rewrites84.8%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.9
Applied rewrites84.9%
if 2.79999999999999984e-152 < l Initial program 63.9%
Taylor expanded in d around inf
Applied rewrites40.6%
Applied rewrites46.0%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites55.2%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6470.4
Applied rewrites70.4%
Final simplification76.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (pow (* l h) -1.0))))
(if (<= l -3.9e-222)
(* (- d) t_0)
(if (<= l -5e-310) (* t_0 d) (/ d (* (sqrt l) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(pow((l * h), -1.0));
double tmp;
if (l <= -3.9e-222) {
tmp = -d * t_0;
} else if (l <= -5e-310) {
tmp = t_0 * d;
} 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) :: t_0
real(8) :: tmp
t_0 = sqrt(((l * h) ** (-1.0d0)))
if (l <= (-3.9d-222)) then
tmp = -d * t_0
else if (l <= (-5d-310)) then
tmp = t_0 * d
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 t_0 = Math.sqrt(Math.pow((l * h), -1.0));
double tmp;
if (l <= -3.9e-222) {
tmp = -d * t_0;
} else if (l <= -5e-310) {
tmp = t_0 * d;
} 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): t_0 = math.sqrt(math.pow((l * h), -1.0)) tmp = 0 if l <= -3.9e-222: tmp = -d * t_0 elif l <= -5e-310: tmp = t_0 * d 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) t_0 = sqrt((Float64(l * h) ^ -1.0)) tmp = 0.0 if (l <= -3.9e-222) tmp = Float64(Float64(-d) * t_0); elseif (l <= -5e-310) tmp = Float64(t_0 * d); 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)
t_0 = sqrt(((l * h) ^ -1.0));
tmp = 0.0;
if (l <= -3.9e-222)
tmp = -d * t_0;
elseif (l <= -5e-310)
tmp = t_0 * d;
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_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.9e-222], N[((-d) * t$95$0), $MachinePrecision], If[LessEqual[l, -5e-310], N[(t$95$0 * d), $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 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{-222}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{elif}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot d\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < -3.9000000000000001e-222Initial program 70.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6478.0
Applied rewrites78.0%
Taylor expanded in d 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-*.f6461.4
Applied rewrites61.4%
if -3.9000000000000001e-222 < l < -4.999999999999985e-310Initial program 80.2%
Taylor expanded in d around inf
Applied rewrites16.6%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6433.9
Applied rewrites33.9%
if -4.999999999999985e-310 < l Initial program 69.0%
Taylor expanded in d around inf
Applied rewrites35.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.5
Applied rewrites40.5%
Applied rewrites40.5%
Applied rewrites46.3%
Final simplification51.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (* (* (* M_m M_m) h) D_m))
(t_2 (/ d (sqrt l))))
(if (<= d -8.6e+82)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.75e+33)
(* (* (* (/ -0.125 (* l d)) (* t_1 (/ D_m d))) t_0) (sqrt (/ d l)))
(if (<= d 1.15e-304)
(* (* t_0 (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(if (<= d 2.5e-116)
(*
(/
(fma
(/ -0.125 (* d l))
(* (* h (/ (* M_m M_m) d)) (* D_m D_m))
1.0)
(sqrt h))
t_2)
(*
(/ (fma (/ (* -0.125 (/ D_m d)) d) (/ t_1 l) 1.0) (sqrt h))
t_2)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = ((M_m * M_m) * h) * D_m;
double t_2 = d / sqrt(l);
double tmp;
if (d <= -8.6e+82) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.75e+33) {
tmp = (((-0.125 / (l * d)) * (t_1 * (D_m / d))) * t_0) * sqrt((d / l));
} else if (d <= 1.15e-304) {
tmp = (t_0 * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else if (d <= 2.5e-116) {
tmp = (fma((-0.125 / (d * l)), ((h * ((M_m * M_m) / d)) * (D_m * D_m)), 1.0) / sqrt(h)) * t_2;
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), (t_1 / l), 1.0) / sqrt(h)) * t_2;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(Float64(Float64(M_m * M_m) * h) * D_m) t_2 = Float64(d / sqrt(l)) tmp = 0.0 if (d <= -8.6e+82) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.75e+33) tmp = Float64(Float64(Float64(Float64(-0.125 / Float64(l * d)) * Float64(t_1 * Float64(D_m / d))) * t_0) * sqrt(Float64(d / l))); elseif (d <= 1.15e-304) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); elseif (d <= 2.5e-116) tmp = Float64(Float64(fma(Float64(-0.125 / Float64(d * l)), Float64(Float64(h * Float64(Float64(M_m * M_m) / d)) * Float64(D_m * D_m)), 1.0) / sqrt(h)) * t_2); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(t_1 / l), 1.0) / sqrt(h)) * 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[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$2 = N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+82], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.75e+33], N[(N[(N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[d, 2.5e-116], N[(N[(N[(N[(-0.125 / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(t$95$1 / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $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 := \sqrt{\frac{d}{h}}\\
t_1 := \left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\\
t_2 := \frac{d}{\sqrt{\ell}}\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+82}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{+33}:\\
\;\;\;\;\left(\left(\frac{-0.125}{\ell \cdot d} \cdot \left(t\_1 \cdot \frac{D\_m}{d}\right)\right) \cdot t\_0\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_0 \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{elif}\;d \leq 2.5 \cdot 10^{-116}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125}{d \cdot \ell}, \left(h \cdot \frac{M\_m \cdot M\_m}{d}\right) \cdot \left(D\_m \cdot D\_m\right), 1\right)}{\sqrt{h}} \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{t\_1}{\ell}, 1\right)}{\sqrt{h}} \cdot t\_2\\
\end{array}
\end{array}
if d < -8.60000000000000029e82Initial program 64.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in d 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-*.f6479.6
Applied rewrites79.6%
if -8.60000000000000029e82 < d < -1.75000000000000005e33Initial program 99.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites99.7%
Taylor expanded in d around 0
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -1.75000000000000005e33 < d < 1.15e-304Initial program 74.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d < 2.5000000000000001e-116Initial program 41.3%
Taylor expanded in d around inf
Applied rewrites19.9%
Applied rewrites16.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.5
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites23.3%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
Applied rewrites49.5%
if 2.5000000000000001e-116 < d Initial program 76.3%
Taylor expanded in d around inf
Applied rewrites40.0%
Applied rewrites46.1%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites67.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites76.2%
Final simplification67.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -1.25e+91)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d 7e-228)
(*
(*
(fma (* (* -0.125 (* (* (/ h l) D_m) (/ M_m d))) (/ M_m d)) D_m 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
(/ d (sqrt l))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.25e+91) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= 7e-228) {
tmp = (fma(((-0.125 * (((h / l) * D_m) * (M_m / d))) * (M_m / d)), D_m, 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * (d / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.25e+91) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= 7e-228) tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(Float64(Float64(h / l) * D_m) * Float64(M_m / d))) * Float64(M_m / d)), D_m, 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.25e+91], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7e-228], N[(N[(N[(N[(N[(-0.125 * N[(N[(N[(h / l), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * D$95$m + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.25 \cdot 10^{+91}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-228}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(-0.125 \cdot \left(\left(\frac{h}{\ell} \cdot D\_m\right) \cdot \frac{M\_m}{d}\right)\right) \cdot \frac{M\_m}{d}, D\_m, 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.2500000000000001e91Initial program 62.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6468.2
Applied rewrites68.2%
Taylor expanded in d 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-*.f6478.8
Applied rewrites78.8%
if -1.2500000000000001e91 < d < 6.9999999999999995e-228Initial program 76.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f647.8
Applied rewrites7.8%
Applied rewrites73.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites67.7%
if 6.9999999999999995e-228 < d Initial program 69.8%
Taylor expanded in d around inf
Applied rewrites36.6%
Applied rewrites41.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites60.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites74.1%
Final simplification72.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 -1.25e+91)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d 7e-228)
(*
(*
(fma (* D_m (/ M_m d)) (* -0.125 (* (* (/ h l) D_m) (/ M_m d))) 1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
(/ d (sqrt l))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -1.25e+91) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= 7e-228) {
tmp = (fma((D_m * (M_m / d)), (-0.125 * (((h / l) * D_m) * (M_m / d))), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * (d / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -1.25e+91) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= 7e-228) tmp = Float64(Float64(fma(Float64(D_m * Float64(M_m / d)), Float64(-0.125 * Float64(Float64(Float64(h / l) * D_m) * Float64(M_m / d))), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -1.25e+91], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7e-228], N[(N[(N[(N[(D$95$m * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(N[(N[(h / l), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.25 \cdot 10^{+91}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq 7 \cdot 10^{-228}:\\
\;\;\;\;\left(\mathsf{fma}\left(D\_m \cdot \frac{M\_m}{d}, -0.125 \cdot \left(\left(\frac{h}{\ell} \cdot D\_m\right) \cdot \frac{M\_m}{d}\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if d < -1.2500000000000001e91Initial program 62.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6468.2
Applied rewrites68.2%
Taylor expanded in d 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-*.f6478.8
Applied rewrites78.8%
if -1.2500000000000001e91 < d < 6.9999999999999995e-228Initial program 76.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f647.8
Applied rewrites7.8%
Applied rewrites73.1%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites69.8%
if 6.9999999999999995e-228 < d Initial program 69.8%
Taylor expanded in d around inf
Applied rewrites36.6%
Applied rewrites41.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites60.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites74.1%
Final simplification73.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
(if (<= l -1e+145)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= l 1.5e-308)
(*
(*
(fma
-0.5
(* (/ (* (* h 0.25) (* D_m M_m)) (* d l)) (* (/ M_m d) D_m))
1.0)
(sqrt (/ d h)))
(sqrt (/ d l)))
(*
(/
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(sqrt h))
(/ d (sqrt l))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= -1e+145) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (l <= 1.5e-308) {
tmp = (fma(-0.5, ((((h * 0.25) * (D_m * M_m)) / (d * l)) * ((M_m / d) * D_m)), 1.0) * sqrt((d / h))) * sqrt((d / l));
} else {
tmp = (fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * (d / sqrt(l));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= -1e+145) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (l <= 1.5e-308) tmp = Float64(Float64(fma(-0.5, Float64(Float64(Float64(Float64(h * 0.25) * Float64(D_m * M_m)) / Float64(d * l)) * Float64(Float64(M_m / d) * D_m)), 1.0) * sqrt(Float64(d / h))) * sqrt(Float64(d / l))); else tmp = Float64(Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, -1e+145], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.5e-308], N[(N[(N[(-0.5 * N[(N[(N[(N[(h * 0.25), $MachinePrecision] * N[(D$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{+145}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;\ell \leq 1.5 \cdot 10^{-308}:\\
\;\;\;\;\left(\mathsf{fma}\left(-0.5, \frac{\left(h \cdot 0.25\right) \cdot \left(D\_m \cdot M\_m\right)}{d \cdot \ell} \cdot \left(\frac{M\_m}{d} \cdot D\_m\right), 1\right) \cdot \sqrt{\frac{d}{h}}\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -9.9999999999999999e144Initial program 27.4%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6446.8
Applied rewrites46.8%
Taylor expanded in d 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-*.f6461.4
Applied rewrites61.4%
if -9.9999999999999999e144 < l < 1.4999999999999999e-308Initial program 86.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites86.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6486.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.9
Applied rewrites86.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lift-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6483.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6483.9
Applied rewrites83.9%
if 1.4999999999999999e-308 < l Initial program 69.0%
Taylor expanded in d around inf
Applied rewrites35.4%
Applied rewrites39.5%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
Applied rewrites72.3%
Final simplification75.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (/ -0.125 (* l d)))
(t_2 (* (* (* (* M_m M_m) h) D_m) (/ D_m d))))
(if (<= d -8.6e+82)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -1.75e+33)
(* (* (* t_1 t_2) t_0) (sqrt (/ d l)))
(if (<= d 1.15e-304)
(* (* t_0 (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(/ (* (/ d (sqrt l)) (fma t_1 t_2 1.0)) (sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = -0.125 / (l * d);
double t_2 = (((M_m * M_m) * h) * D_m) * (D_m / d);
double tmp;
if (d <= -8.6e+82) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -1.75e+33) {
tmp = ((t_1 * t_2) * t_0) * sqrt((d / l));
} else if (d <= 1.15e-304) {
tmp = (t_0 * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else {
tmp = ((d / sqrt(l)) * fma(t_1, t_2, 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = Float64(-0.125 / Float64(l * d)) t_2 = Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)) tmp = 0.0 if (d <= -8.6e+82) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -1.75e+33) tmp = Float64(Float64(Float64(t_1 * t_2) * t_0) * sqrt(Float64(d / l))); elseif (d <= 1.15e-304) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); else tmp = Float64(Float64(Float64(d / sqrt(l)) * fma(t_1, t_2, 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+82], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.75e+33], N[(N[(N[(t$95$1 * t$95$2), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * t$95$2 + 1.0), $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 := \sqrt{\frac{d}{h}}\\
t_1 := \frac{-0.125}{\ell \cdot d}\\
t_2 := \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+82}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -1.75 \cdot 10^{+33}:\\
\;\;\;\;\left(\left(t\_1 \cdot t\_2\right) \cdot t\_0\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_0 \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}} \cdot \mathsf{fma}\left(t\_1, t\_2, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -8.60000000000000029e82Initial program 64.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in d 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-*.f6479.6
Applied rewrites79.6%
if -8.60000000000000029e82 < d < -1.75000000000000005e33Initial program 99.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites99.7%
Taylor expanded in d around 0
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -1.75000000000000005e33 < d < 1.15e-304Initial program 74.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d Initial program 68.8%
Taylor expanded in d around inf
Applied rewrites35.7%
Applied rewrites39.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-/.f6471.4
Applied rewrites71.4%
Final simplification67.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h))))
(if (<= d -2.3e+82)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -2.5e+33)
(*
(* (* (/ -0.125 (* d l)) (* (* h (/ (* M_m M_m) d)) (* D_m D_m))) t_0)
(sqrt (/ d l)))
(if (<= d 1.15e-304)
(* (* t_0 (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(/
(*
(/ d (sqrt l))
(fma
(/ -0.125 (* l d))
(* (* (* (* M_m M_m) h) D_m) (/ D_m d))
1.0))
(sqrt h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double tmp;
if (d <= -2.3e+82) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -2.5e+33) {
tmp = (((-0.125 / (d * l)) * ((h * ((M_m * M_m) / d)) * (D_m * D_m))) * t_0) * sqrt((d / l));
} else if (d <= 1.15e-304) {
tmp = (t_0 * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else {
tmp = ((d / sqrt(l)) * fma((-0.125 / (l * d)), ((((M_m * M_m) * h) * D_m) * (D_m / d)), 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) tmp = 0.0 if (d <= -2.3e+82) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -2.5e+33) tmp = Float64(Float64(Float64(Float64(-0.125 / Float64(d * l)) * Float64(Float64(h * Float64(Float64(M_m * M_m) / d)) * Float64(D_m * D_m))) * t_0) * sqrt(Float64(d / l))); elseif (d <= 1.15e-304) tmp = Float64(Float64(t_0 * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); else tmp = Float64(Float64(Float64(d / sqrt(l)) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)), 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.3e+82], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -2.5e+33], N[(N[(N[(N[(-0.125 / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(t$95$0 * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $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 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;d \leq -2.3 \cdot 10^{+82}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -2.5 \cdot 10^{+33}:\\
\;\;\;\;\left(\left(\frac{-0.125}{d \cdot \ell} \cdot \left(\left(h \cdot \frac{M\_m \cdot M\_m}{d}\right) \cdot \left(D\_m \cdot D\_m\right)\right)\right) \cdot t\_0\right) \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(t\_0 \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.29999999999999988e82Initial program 64.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6469.5
Applied rewrites69.5%
Taylor expanded in d 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-*.f6479.6
Applied rewrites79.6%
if -2.29999999999999988e82 < d < -2.49999999999999986e33Initial program 99.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f640.0
Applied rewrites0.0%
Applied rewrites99.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in d around 0
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6475.6
Applied rewrites75.6%
if -2.49999999999999986e33 < d < 1.15e-304Initial program 74.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6481.7
Applied rewrites81.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d Initial program 68.8%
Taylor expanded in d around inf
Applied rewrites35.7%
Applied rewrites39.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-/.f6471.4
Applied rewrites71.4%
Final simplification67.0%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -5e+31)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d 1.15e-304)
(* (* (sqrt (/ d h)) (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(/
(*
(/ d (sqrt l))
(fma (/ -0.125 (* l d)) (* (* (* (* M_m M_m) h) D_m) (/ D_m d)) 1.0))
(sqrt h)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -5e+31) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= 1.15e-304) {
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else {
tmp = ((d / sqrt(l)) * fma((-0.125 / (l * d)), ((((M_m * M_m) * h) * D_m) * (D_m / d)), 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -5e+31) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= 1.15e-304) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); else tmp = Float64(Float64(Float64(d / sqrt(l)) * fma(Float64(-0.125 / Float64(l * d)), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) * Float64(D_m / d)), 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -5e+31], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] + 1.0), $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}
\mathbf{if}\;d \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}} \cdot \mathsf{fma}\left(\frac{-0.125}{\ell \cdot d}, \left(\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m\right) \cdot \frac{D\_m}{d}, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -5.00000000000000027e31Initial program 70.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6474.4
Applied rewrites74.4%
Taylor expanded in d around inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
if -5.00000000000000027e31 < d < 1.15e-304Initial program 75.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6482.7
Applied rewrites82.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d Initial program 68.8%
Taylor expanded in d around inf
Applied rewrites35.7%
Applied rewrites39.8%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.8%
lift-sqrt.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
sqrt-divN/A
sqrt-prodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-/.f6471.4
Applied rewrites71.4%
Final simplification63.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 (<= d -5e+31)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d 1.15e-304)
(* (* (sqrt (/ d h)) (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(if (<= d 1.34e-20)
(*
(/
(fma (/ -0.125 (* d l)) (* (* h (/ (* M_m M_m) d)) (* D_m D_m)) 1.0)
(sqrt h))
(/ d (sqrt l)))
(*
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(/ d (sqrt (* l h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -5e+31) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= 1.15e-304) {
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else if (d <= 1.34e-20) {
tmp = (fma((-0.125 / (d * l)), ((h * ((M_m * M_m) / d)) * (D_m * D_m)), 1.0) / sqrt(h)) * (d / sqrt(l));
} else {
tmp = fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) * (d / sqrt((l * h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -5e+31) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= 1.15e-304) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); elseif (d <= 1.34e-20) tmp = Float64(Float64(fma(Float64(-0.125 / Float64(d * l)), Float64(Float64(h * Float64(Float64(M_m * M_m) / d)) * Float64(D_m * D_m)), 1.0) / sqrt(h)) * Float64(d / sqrt(l))); else tmp = Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) * Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -5e+31], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.15e-304], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[d, 1.34e-20], N[(N[(N[(N[(-0.125 / N[(d * l), $MachinePrecision]), $MachinePrecision] * N[(N[(h * N[(N[(M$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq 1.15 \cdot 10^{-304}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{elif}\;d \leq 1.34 \cdot 10^{-20}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-0.125}{d \cdot \ell}, \left(h \cdot \frac{M\_m \cdot M\_m}{d}\right) \cdot \left(D\_m \cdot D\_m\right), 1\right)}{\sqrt{h}} \cdot \frac{d}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -5.00000000000000027e31Initial program 70.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6474.4
Applied rewrites74.4%
Taylor expanded in d around inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
if -5.00000000000000027e31 < d < 1.15e-304Initial program 75.0%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6482.7
Applied rewrites82.7%
Taylor expanded in d around inf
Applied rewrites47.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6447.3
Applied rewrites47.3%
if 1.15e-304 < d < 1.3399999999999999e-20Initial program 59.3%
Taylor expanded in d around inf
Applied rewrites26.5%
Applied rewrites25.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6425.7
lift-sqrt.f64N/A
lift-*.f64N/A
sqrt-prodN/A
lift-/.f64N/A
sqrt-divN/A
associate-*l/N/A
rem-square-sqrtN/A
Applied rewrites29.6%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-/l*N/A
associate-/l/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
Applied rewrites57.1%
if 1.3399999999999999e-20 < d Initial program 77.0%
Taylor expanded in d around inf
Applied rewrites43.7%
Applied rewrites52.0%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites67.0%
Applied rewrites69.5%
Final simplification60.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 -5e+31)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -5e-310)
(* (* (sqrt (/ d h)) (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 1.0)
(*
(fma (/ (* -0.125 (/ D_m d)) d) (/ (* (* (* M_m M_m) h) D_m) l) 1.0)
(/ d (sqrt (* l h)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -5e+31) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -5e-310) {
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt((-1.0 / l)))) * 1.0;
} else {
tmp = fma(((-0.125 * (D_m / d)) / d), ((((M_m * M_m) * h) * D_m) / l), 1.0) * (d / sqrt((l * h)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -5e+31) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -5e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 1.0); else tmp = Float64(fma(Float64(Float64(-0.125 * Float64(D_m / d)) / d), Float64(Float64(Float64(Float64(M_m * M_m) * h) * D_m) / l), 1.0) * Float64(d / sqrt(Float64(l * h)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -5e+31], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(-0.125 * N[(D$95$m / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(N[(N[(M$95$m * M$95$m), $MachinePrecision] * h), $MachinePrecision] * D$95$m), $MachinePrecision] / l), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-0.125 \cdot \frac{D\_m}{d}}{d}, \frac{\left(\left(M\_m \cdot M\_m\right) \cdot h\right) \cdot D\_m}{\ell}, 1\right) \cdot \frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -5.00000000000000027e31Initial program 70.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6474.4
Applied rewrites74.4%
Taylor expanded in d around inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
if -5.00000000000000027e31 < d < -4.999999999999985e-310Initial program 74.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6484.1
Applied rewrites84.1%
Taylor expanded in d around inf
Applied rewrites48.0%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6448.0
Applied rewrites48.0%
if -4.999999999999985e-310 < d Initial program 69.0%
Taylor expanded in d around inf
Applied rewrites35.4%
Applied rewrites39.5%
Taylor expanded in d around 0
div-subN/A
*-inversesN/A
associate-*r/N/A
associate-/l/N/A
associate-*r/N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
Applied rewrites57.3%
Applied rewrites63.9%
Final simplification60.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 (<= d -5e+31)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -5e-310)
(* (* (sqrt (/ d h)) (* (sqrt (- d)) (sqrt (/ -1.0 l)))) 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 <= -5e+31) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -5e-310) {
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt((-1.0 / l)))) * 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 <= (-5d+31)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (d <= (-5d-310)) then
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt(((-1.0d0) / l)))) * 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 <= -5e+31) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (d <= -5e-310) {
tmp = (Math.sqrt((d / h)) * (Math.sqrt(-d) * Math.sqrt((-1.0 / l)))) * 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 <= -5e+31: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif d <= -5e-310: tmp = (math.sqrt((d / h)) * (math.sqrt(-d) * math.sqrt((-1.0 / l)))) * 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 <= -5e+31) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -5e-310) tmp = Float64(Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(-d)) * sqrt(Float64(-1.0 / l)))) * 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 <= -5e+31)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (d <= -5e-310)
tmp = (sqrt((d / h)) * (sqrt(-d) * sqrt((-1.0 / l)))) * 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, -5e+31], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -5e-310], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] * N[Sqrt[N[(-1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.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}
\mathbf{if}\;d \leq -5 \cdot 10^{+31}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \left(\sqrt{-d} \cdot \sqrt{\frac{-1}{\ell}}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -5.00000000000000027e31Initial program 70.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6474.4
Applied rewrites74.4%
Taylor expanded in d around inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.6
Applied rewrites65.6%
if -5.00000000000000027e31 < d < -4.999999999999985e-310Initial program 74.6%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6484.1
Applied rewrites84.1%
Taylor expanded in d around inf
Applied rewrites48.0%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6448.0
Applied rewrites48.0%
if -4.999999999999985e-310 < d Initial program 69.0%
Taylor expanded in d around inf
Applied rewrites35.4%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.5
Applied rewrites40.5%
Applied rewrites40.5%
Applied rewrites46.3%
Final simplification51.6%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (pow (* l h) -1.0)))) (if (<= l -3.9e-222) (* (- d) t_0) (* t_0 d))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(pow((l * h), -1.0));
double tmp;
if (l <= -3.9e-222) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((l * h) ** (-1.0d0)))
if (l <= (-3.9d-222)) then
tmp = -d * t_0
else
tmp = t_0 * d
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(Math.pow((l * h), -1.0));
double tmp;
if (l <= -3.9e-222) {
tmp = -d * t_0;
} else {
tmp = t_0 * d;
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(math.pow((l * h), -1.0)) tmp = 0 if l <= -3.9e-222: tmp = -d * t_0 else: tmp = t_0 * d return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt((Float64(l * h) ^ -1.0)) tmp = 0.0 if (l <= -3.9e-222) tmp = Float64(Float64(-d) * t_0); else tmp = Float64(t_0 * d); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(((l * h) ^ -1.0));
tmp = 0.0;
if (l <= -3.9e-222)
tmp = -d * t_0;
else
tmp = t_0 * d;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -3.9e-222], N[((-d) * t$95$0), $MachinePrecision], N[(t$95$0 * d), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{if}\;\ell \leq -3.9 \cdot 10^{-222}:\\
\;\;\;\;\left(-d\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if l < -3.9000000000000001e-222Initial program 70.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
div-invN/A
sqrt-prodN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6478.0
Applied rewrites78.0%
Taylor expanded in d 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-*.f6461.4
Applied rewrites61.4%
if -3.9000000000000001e-222 < l Initial program 70.9%
Taylor expanded in d around inf
Applied rewrites32.3%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6439.4
Applied rewrites39.4%
Final simplification48.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 (* (sqrt (pow (* l h) -1.0)) d))
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 sqrt(pow((l * h), -1.0)) * d;
}
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 = sqrt(((l * h) ** (-1.0d0))) * d
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 Math.sqrt(Math.pow((l * h), -1.0)) * d;
}
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 math.sqrt(math.pow((l * h), -1.0)) * d
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(sqrt((Float64(l * h) ^ -1.0)) * d) 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 = sqrt(((l * h) ^ -1.0)) * d;
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[(N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision] * d), $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])\\
\\
\sqrt{{\left(\ell \cdot h\right)}^{-1}} \cdot d
\end{array}
Initial program 70.7%
Taylor expanded in d around inf
Applied rewrites39.6%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
Final simplification26.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 (/ 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 70.7%
Taylor expanded in d around inf
Applied rewrites39.6%
Taylor expanded in d around -inf
associate-*r*N/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
Applied rewrites25.5%
herbie shell --seed 2024304
(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)))))