
(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 16 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 (* (* (/ 0.5 d) M_m) D_m)) (t_1 (/ t_0 l)))
(if (<= d -1.1e-267)
(/
(* (sqrt (/ d l)) (fma (* (* t_1 h) t_0) -0.5 1.0))
(/ (sqrt (- h)) (sqrt (- d))))
(if (<= d 5.2e-185)
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0))
(*
(- 1.0 (* (/ h (/ d (* (* 0.25 D_m) M_m))) t_1))
(* (/ (sqrt d) (sqrt h)) (pow (/ d l) (/ 1.0 2.0))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((0.5 / d) * M_m) * D_m;
double t_1 = t_0 / l;
double tmp;
if (d <= -1.1e-267) {
tmp = (sqrt((d / l)) * fma(((t_1 * h) * t_0), -0.5, 1.0)) / (sqrt(-h) / sqrt(-d));
} else if (d <= 5.2e-185) {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
} else {
tmp = (1.0 - ((h / (d / ((0.25 * D_m) * M_m))) * t_1)) * ((sqrt(d) / sqrt(h)) * pow((d / l), (1.0 / 2.0)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(0.5 / d) * M_m) * D_m) t_1 = Float64(t_0 / l) tmp = 0.0 if (d <= -1.1e-267) tmp = Float64(Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(t_1 * h) * t_0), -0.5, 1.0)) / Float64(sqrt(Float64(-h)) / sqrt(Float64(-d)))); elseif (d <= 5.2e-185) tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); else tmp = Float64(Float64(1.0 - Float64(Float64(h / Float64(d / Float64(Float64(0.25 * D_m) * M_m))) * t_1)) * Float64(Float64(sqrt(d) / sqrt(h)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / l), $MachinePrecision]}, If[LessEqual[d, -1.1e-267], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t$95$1 * h), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[Sqrt[(-h)], $MachinePrecision] / N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.2e-185], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 - N[(N[(h / N[(d / N[(N[(0.25 * D$95$m), $MachinePrecision] * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m\\
t_1 := \frac{t\_0}{\ell}\\
\mathbf{if}\;d \leq -1.1 \cdot 10^{-267}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\left(t\_1 \cdot h\right) \cdot t\_0, -0.5, 1\right)}{\frac{\sqrt{-h}}{\sqrt{-d}}}\\
\mathbf{elif}\;d \leq 5.2 \cdot 10^{-185}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \frac{h}{\frac{d}{\left(0.25 \cdot D\_m\right) \cdot M\_m}} \cdot t\_1\right) \cdot \left(\frac{\sqrt{d}}{\sqrt{h}} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\end{array}
\end{array}
if d < -1.09999999999999994e-267Initial program 75.0%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval74.5
Applied rewrites74.5%
Applied rewrites75.3%
Applied rewrites75.4%
lift-/.f64N/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
lower-/.f64N/A
lower-sqrt.f6487.5
Applied rewrites87.5%
if -1.09999999999999994e-267 < d < 5.1999999999999997e-185Initial program 23.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6423.1
Applied rewrites23.1%
Applied rewrites24.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6414.4
Applied rewrites14.4%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6414.4
Applied rewrites57.6%
if 5.1999999999999997e-185 < d Initial program 73.5%
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 rewrites83.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-pow.f64N/A
unpow-1N/A
remove-double-divN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6483.0
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
lower-*.f64N/A
metadata-eval83.0
Applied rewrites83.0%
lift-/.f64N/A
metadata-eval83.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
lower-sqrt.f6492.3
Applied rewrites92.3%
Final simplification84.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1 (/ (* D_m M_m) d))
(t_2
(*
(/ (fabs d) (sqrt (* l h)))
(fma (/ (* -0.5 t_1) l) (* (* D_m h) (* 0.25 (/ M_m d))) 1.0)))
(t_3 (sqrt (/ d h)))
(t_4 (sqrt (/ d l))))
(if (<= t_0 -4e-134)
(*
(- 1.0 (* (* (* (* 0.25 D_m) h) (/ M_m d)) (/ (* t_1 0.5) l)))
(* t_3 t_4))
(if (<= t_0 2e-264) t_2 (if (<= t_0 1e+215) (* (* 1.0 t_4) t_3) t_2)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = (D_m * M_m) / d;
double t_2 = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * t_1) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
double t_3 = sqrt((d / h));
double t_4 = sqrt((d / l));
double tmp;
if (t_0 <= -4e-134) {
tmp = (1.0 - ((((0.25 * D_m) * h) * (M_m / d)) * ((t_1 * 0.5) / l))) * (t_3 * t_4);
} else if (t_0 <= 2e-264) {
tmp = t_2;
} else if (t_0 <= 1e+215) {
tmp = (1.0 * t_4) * t_3;
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(Float64(D_m * M_m) / d) t_2 = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * t_1) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)) t_3 = sqrt(Float64(d / h)) t_4 = sqrt(Float64(d / l)) tmp = 0.0 if (t_0 <= -4e-134) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(0.25 * D_m) * h) * Float64(M_m / d)) * Float64(Float64(t_1 * 0.5) / l))) * Float64(t_3 * t_4)); elseif (t_0 <= 2e-264) tmp = t_2; elseif (t_0 <= 1e+215) tmp = Float64(Float64(1.0 * t_4) * t_3); else tmp = t_2; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * t$95$1), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -4e-134], N[(N[(1.0 - N[(N[(N[(N[(0.25 * D$95$m), $MachinePrecision] * h), $MachinePrecision] * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * t$95$4), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-264], t$95$2, If[LessEqual[t$95$0, 1e+215], N[(N[(1.0 * t$95$4), $MachinePrecision] * t$95$3), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{D\_m \cdot M\_m}{d}\\
t_2 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot t\_1}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-134}:\\
\;\;\;\;\left(1 - \left(\left(\left(0.25 \cdot D\_m\right) \cdot h\right) \cdot \frac{M\_m}{d}\right) \cdot \frac{t\_1 \cdot 0.5}{\ell}\right) \cdot \left(t\_3 \cdot t\_4\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-264}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{+215}:\\
\;\;\;\;\left(1 \cdot t\_4\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.00000000000000016e-134Initial program 81.3%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6480.2
Applied rewrites80.2%
Applied rewrites79.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6479.7
lift-/.f64N/A
metadata-eval79.7
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6479.7
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
lower-sqrt.f6480.8
Applied rewrites80.8%
if -4.00000000000000016e-134 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-264 or 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 28.2%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.0
Applied rewrites29.0%
Applied rewrites32.0%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6415.8
Applied rewrites15.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6415.8
Applied rewrites75.1%
if 2e-264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 99.5%
Taylor expanded in h around 0
Applied rewrites99.5%
Applied rewrites99.5%
Final simplification83.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(t_1
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0))))
(if (<= t_0 2e-264)
t_1
(if (<= t_0 1e+215) (* (* 1.0 (sqrt (/ d l))) (sqrt (/ d 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 = (1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double t_1 = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
double tmp;
if (t_0 <= 2e-264) {
tmp = t_1;
} else if (t_0 <= 1e+215) {
tmp = (1.0 * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = t_1;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) t_1 = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)) tmp = 0.0 if (t_0 <= 2e-264) tmp = t_1; elseif (t_0 <= 1e+215) tmp = Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = t_1; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-264], t$95$1, If[LessEqual[t$95$0, 1e+215], N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-264}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+215}:\\
\;\;\;\;\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 2e-264 or 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 54.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6454.3
Applied rewrites54.3%
Applied rewrites55.6%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6426.3
Applied rewrites26.3%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6426.3
Applied rewrites75.0%
if 2e-264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 99.5%
Taylor expanded in h around 0
Applied rewrites99.5%
Applied rewrites99.5%
Final simplification81.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 (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(if (<=
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
t_0)
1e+215)
(*
(fma
(* (* (* (/ 0.5 d) M_m) D_m) (/ (- h) l))
(* (/ M_m d) (* (* 0.5 D_m) 0.5))
1.0)
t_0)
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0));
double tmp;
if (((1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * t_0) <= 1e+215) {
tmp = fma(((((0.5 / d) * M_m) * D_m) * (-h / l)), ((M_m / d) * ((0.5 * D_m) * 0.5)), 1.0) * t_0;
} else {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * t_0) <= 1e+215) tmp = Float64(fma(Float64(Float64(Float64(Float64(0.5 / d) * M_m) * D_m) * Float64(Float64(-h) / l)), Float64(Float64(M_m / d) * Float64(Float64(0.5 * D_m) * 0.5)), 1.0) * t_0); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], 1e+215], N[(N[(N[(N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision] * N[((-h) / l), $MachinePrecision]), $MachinePrecision] * N[(N[(M$95$m / d), $MachinePrecision] * N[(N[(0.5 * D$95$m), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\\
\mathbf{if}\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot t\_0 \leq 10^{+215}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m\right) \cdot \frac{-h}{\ell}, \frac{M\_m}{d} \cdot \left(\left(0.5 \cdot D\_m\right) \cdot 0.5\right), 1\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 84.3%
Applied rewrites87.3%
if 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 26.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
Applied rewrites31.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6413.7
Applied rewrites74.3%
Final simplification83.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (/ 0.5 d) M_m) D_m))
(t_1 (* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0)))))
(if (<=
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
t_1)
1e+215)
(* (- 1.0 (* (* (* 0.5 (/ h l)) t_0) t_0)) t_1)
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((0.5 / d) * M_m) * D_m;
double t_1 = pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0));
double tmp;
if (((1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * t_1) <= 1e+215) {
tmp = (1.0 - (((0.5 * (h / l)) * t_0) * t_0)) * t_1;
} else {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(0.5 / d) * M_m) * D_m) t_1 = Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0))) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * t_1) <= 1e+215) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(0.5 * Float64(h / l)) * t_0) * t_0)) * t_1); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1e+215], N[(N[(1.0 - N[(N[(N[(0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m\\
t_1 := {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\\
\mathbf{if}\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot t\_1 \leq 10^{+215}:\\
\;\;\;\;\left(1 - \left(\left(0.5 \cdot \frac{h}{\ell}\right) \cdot t\_0\right) \cdot t\_0\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 84.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites87.3%
if 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 26.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
Applied rewrites31.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6413.7
Applied rewrites74.3%
Final simplification83.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (/ 0.5 d) M_m) D_m)))
(if (<=
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+215)
(/
(* (sqrt (/ d l)) (fma (* (* (/ t_0 l) h) t_0) -0.5 1.0))
(/ 1.0 (sqrt (/ d h))))
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((0.5 / d) * M_m) * D_m;
double tmp;
if (((1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+215) {
tmp = (sqrt((d / l)) * fma((((t_0 / l) * h) * t_0), -0.5, 1.0)) / (1.0 / sqrt((d / h)));
} else {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(0.5 / d) * M_m) * D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+215) tmp = Float64(Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(Float64(t_0 / l) * h) * t_0), -0.5, 1.0)) / Float64(1.0 / sqrt(Float64(d / h)))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+215], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * h), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m\\
\mathbf{if}\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+215}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot h\right) \cdot t\_0, -0.5, 1\right)}{\frac{1}{\sqrt{\frac{d}{h}}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 84.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval83.7
Applied rewrites83.7%
Applied rewrites83.7%
Applied rewrites86.9%
/-rgt-identityN/A
clear-numN/A
lift-/.f64N/A
lift-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
sqrt-divN/A
clear-numN/A
lift-/.f64N/A
lower-sqrt.f6487.4
Applied rewrites87.4%
if 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 26.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
Applied rewrites31.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6413.7
Applied rewrites74.3%
Final simplification83.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* (* (/ 0.5 d) M_m) D_m)))
(if (<=
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+215)
(/
(* (sqrt (/ d l)) (fma (* (* (/ t_0 l) h) t_0) -0.5 1.0))
(sqrt (/ h d)))
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = ((0.5 / d) * M_m) * D_m;
double tmp;
if (((1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+215) {
tmp = (sqrt((d / l)) * fma((((t_0 / l) * h) * t_0), -0.5, 1.0)) / sqrt((h / d));
} else {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(Float64(0.5 / d) * M_m) * D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+215) tmp = Float64(Float64(sqrt(Float64(d / l)) * fma(Float64(Float64(Float64(t_0 / l) * h) * t_0), -0.5, 1.0)) / sqrt(Float64(h / d))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(0.5 / d), $MachinePrecision] * M$95$m), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+215], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(t$95$0 / l), $MachinePrecision] * h), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \left(\frac{0.5}{d} \cdot M\_m\right) \cdot D\_m\\
\mathbf{if}\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+215}:\\
\;\;\;\;\frac{\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(\left(\frac{t\_0}{\ell} \cdot h\right) \cdot t\_0, -0.5, 1\right)}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 84.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval83.7
Applied rewrites83.7%
Applied rewrites83.7%
Applied rewrites86.9%
if 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 26.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
Applied rewrites31.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6413.7
Applied rewrites74.3%
Final simplification83.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 (<=
(*
(-
1.0
(* (/ h l) (* (pow (/ (* D_m M_m) (* 2.0 d)) 2.0) (/ 1.0 2.0))))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
1e+215)
(/
(* (fma (* (* t_0 (* 0.25 (/ h l))) t_0) -0.5 1.0) (sqrt (/ d l)))
(sqrt (/ h d)))
(*
(/ (fabs d) (sqrt (* l h)))
(fma
(/ (* -0.5 (/ (* D_m M_m) d)) l)
(* (* D_m h) (* 0.25 (/ M_m d)))
1.0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m / d) * D_m;
double tmp;
if (((1.0 - ((h / l) * (pow(((D_m * M_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 1e+215) {
tmp = (fma(((t_0 * (0.25 * (h / l))) * t_0), -0.5, 1.0) * sqrt((d / l))) / sqrt((h / d));
} else {
tmp = (fabs(d) / sqrt((l * h))) * fma(((-0.5 * ((D_m * M_m) / d)) / l), ((D_m * h) * (0.25 * (M_m / d))), 1.0);
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m / d) * D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64(h / l) * Float64((Float64(Float64(D_m * M_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 1e+215) tmp = Float64(Float64(fma(Float64(Float64(t_0 * Float64(0.25 * Float64(h / l))) * t_0), -0.5, 1.0) * sqrt(Float64(d / l))) / sqrt(Float64(h / d))); else tmp = Float64(Float64(abs(d) / sqrt(Float64(l * h))) * fma(Float64(Float64(-0.5 * Float64(Float64(D_m * M_m) / d)) / l), Float64(Float64(D_m * h) * Float64(0.25 * Float64(M_m / d))), 1.0)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(D$95$m * M$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+215], N[(N[(N[(N[(N[(t$95$0 * N[(0.25 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[(N[(D$95$m * M$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * N[(N[(D$95$m * h), $MachinePrecision] * N[(0.25 * N[(M$95$m / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m}{d} \cdot D\_m\\
\mathbf{if}\;\left(1 - \frac{h}{\ell} \cdot \left({\left(\frac{D\_m \cdot M\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right)\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 10^{+215}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(t\_0 \cdot \left(0.25 \cdot \frac{h}{\ell}\right)\right) \cdot t\_0, -0.5, 1\right) \cdot \sqrt{\frac{d}{\ell}}}{\sqrt{\frac{h}{d}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|d\right|}{\sqrt{\ell \cdot h}} \cdot \mathsf{fma}\left(\frac{-0.5 \cdot \frac{D\_m \cdot M\_m}{d}}{\ell}, \left(D\_m \cdot h\right) \cdot \left(0.25 \cdot \frac{M\_m}{d}\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 9.99999999999999907e214Initial program 84.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval83.7
Applied rewrites83.7%
Applied rewrites83.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
lower-*.f6486.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.2
Applied rewrites86.2%
if 9.99999999999999907e214 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 26.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6427.1
Applied rewrites27.1%
Applied rewrites31.2%
lift-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
sqrt-divN/A
lift-/.f64N/A
clear-numN/A
lift-/.f64N/A
pow1/2N/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f6413.7
Applied rewrites13.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6413.7
Applied rewrites74.3%
Final simplification82.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -5e-310)
(* (* (/ t_0 (sqrt (- l))) (/ t_0 (sqrt (- h)))) 1.0)
(if (<= d 2.2e+138)
(*
(fma (/ (* (* D_m D_m) -0.125) l) (* (/ (* (/ M_m d) M_m) d) h) 1.0)
(* (sqrt (/ 1.0 (* l h))) 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(-d);
double tmp;
if (d <= -5e-310) {
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0;
} else if (d <= 2.2e+138) {
tmp = fma((((D_m * D_m) * -0.125) / l), ((((M_m / d) * M_m) / d) * h), 1.0) * (sqrt((1.0 / (l * h))) * d);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(t_0 / sqrt(Float64(-h)))) * 1.0); elseif (d <= 2.2e+138) tmp = Float64(fma(Float64(Float64(Float64(D_m * D_m) * -0.125) / l), Float64(Float64(Float64(Float64(M_m / d) * M_m) / d) * h), 1.0) * Float64(sqrt(Float64(1.0 / Float64(l * h))) * d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[d, 2.2e+138], N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-\ell}} \cdot \frac{t\_0}{\sqrt{-h}}\right) \cdot 1\\
\mathbf{elif}\;d \leq 2.2 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(D\_m \cdot D\_m\right) \cdot -0.125}{\ell}, \frac{\frac{M\_m}{d} \cdot M\_m}{d} \cdot h, 1\right) \cdot \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 71.4%
Taylor expanded in h around 0
Applied rewrites42.0%
lift-/.f64N/A
metadata-eval42.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
metadata-eval49.7
lift-pow.f64N/A
pow1/2N/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.f6454.1
Applied rewrites54.1%
if -4.999999999999985e-310 < d < 2.2000000000000001e138Initial program 55.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6455.7
Applied rewrites55.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.6
Applied rewrites64.6%
Taylor expanded in h around 0
+-commutativeN/A
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-fma.f64N/A
Applied rewrites56.1%
if 2.2000000000000001e138 < d Initial program 74.0%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval75.3
Applied rewrites75.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.8
Applied rewrites59.8%
Applied rewrites59.8%
Applied rewrites75.3%
Final simplification57.8%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -5e-310)
(* (* (/ t_0 (sqrt (- l))) (/ t_0 (sqrt (- h)))) 1.0)
(if (<= d 8.2)
(*
(* (* (/ (* (/ M_m d) M_m) d) h) (/ (* (* D_m D_m) -0.125) l))
(* (sqrt (/ 1.0 (* l h))) 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(-d);
double tmp;
if (d <= -5e-310) {
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0;
} else if (d <= 8.2) {
tmp = (((((M_m / d) * M_m) / d) * h) * (((D_m * D_m) * -0.125) / l)) * (sqrt((1.0 / (l * h))) * 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(-d)
if (d <= (-5d-310)) then
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0d0
else if (d <= 8.2d0) then
tmp = (((((m_m / d) * m_m) / d) * h) * (((d_m * d_m) * (-0.125d0)) / l)) * (sqrt((1.0d0 / (l * h))) * 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(-d);
double tmp;
if (d <= -5e-310) {
tmp = ((t_0 / Math.sqrt(-l)) * (t_0 / Math.sqrt(-h))) * 1.0;
} else if (d <= 8.2) {
tmp = (((((M_m / d) * M_m) / d) * h) * (((D_m * D_m) * -0.125) / l)) * (Math.sqrt((1.0 / (l * h))) * 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(-d) tmp = 0 if d <= -5e-310: tmp = ((t_0 / math.sqrt(-l)) * (t_0 / math.sqrt(-h))) * 1.0 elif d <= 8.2: tmp = (((((M_m / d) * M_m) / d) * h) * (((D_m * D_m) * -0.125) / l)) * (math.sqrt((1.0 / (l * h))) * 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(-d)) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(t_0 / sqrt(Float64(-h)))) * 1.0); elseif (d <= 8.2) tmp = Float64(Float64(Float64(Float64(Float64(Float64(M_m / d) * M_m) / d) * h) * Float64(Float64(Float64(D_m * D_m) * -0.125) / l)) * Float64(sqrt(Float64(1.0 / Float64(l * h))) * 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(-d);
tmp = 0.0;
if (d <= -5e-310)
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0;
elseif (d <= 8.2)
tmp = (((((M_m / d) * M_m) / d) * h) * (((D_m * D_m) * -0.125) / l)) * (sqrt((1.0 / (l * h))) * 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[(-d)], $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[d, 8.2], N[(N[(N[(N[(N[(N[(M$95$m / d), $MachinePrecision] * M$95$m), $MachinePrecision] / d), $MachinePrecision] * h), $MachinePrecision] * N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] * -0.125), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-\ell}} \cdot \frac{t\_0}{\sqrt{-h}}\right) \cdot 1\\
\mathbf{elif}\;d \leq 8.2:\\
\;\;\;\;\left(\left(\frac{\frac{M\_m}{d} \cdot M\_m}{d} \cdot h\right) \cdot \frac{\left(D\_m \cdot D\_m\right) \cdot -0.125}{\ell}\right) \cdot \left(\sqrt{\frac{1}{\ell \cdot h}} \cdot d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 71.4%
Taylor expanded in h around 0
Applied rewrites42.0%
lift-/.f64N/A
metadata-eval42.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
metadata-eval49.7
lift-pow.f64N/A
pow1/2N/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.f6454.1
Applied rewrites54.1%
if -4.999999999999985e-310 < d < 8.1999999999999993Initial program 43.1%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6443.1
Applied rewrites43.1%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
Taylor expanded in h around inf
associate-*r/N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6437.7
Applied rewrites37.7%
if 8.1999999999999993 < d Initial program 81.4%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval82.2
Applied rewrites82.2%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6453.1
Applied rewrites53.1%
Applied rewrites53.1%
Applied rewrites66.4%
Final simplification52.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (- d))))
(if (<= d -5e-310)
(* (* (/ t_0 (sqrt (- l))) (/ t_0 (sqrt (- h)))) 1.0)
(/ d (* (sqrt l) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt(-d);
double tmp;
if (d <= -5e-310) {
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(-d)
if (d <= (-5d-310)) then
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0d0
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt(-d);
double tmp;
if (d <= -5e-310) {
tmp = ((t_0 / Math.sqrt(-l)) * (t_0 / Math.sqrt(-h))) * 1.0;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt(-d) tmp = 0 if d <= -5e-310: tmp = ((t_0 / math.sqrt(-l)) * (t_0 / math.sqrt(-h))) * 1.0 else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(-d)) tmp = 0.0 if (d <= -5e-310) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-l))) * Float64(t_0 / sqrt(Float64(-h)))) * 1.0); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt(-d);
tmp = 0.0;
if (d <= -5e-310)
tmp = ((t_0 / sqrt(-l)) * (t_0 / sqrt(-h))) * 1.0;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[d, -5e-310], N[(N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-h)], $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}
t_0 := \sqrt{-d}\\
\mathbf{if}\;d \leq -5 \cdot 10^{-310}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-\ell}} \cdot \frac{t\_0}{\sqrt{-h}}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -4.999999999999985e-310Initial program 71.4%
Taylor expanded in h around 0
Applied rewrites42.0%
lift-/.f64N/A
metadata-eval42.0
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6449.7
Applied rewrites49.7%
lift-/.f64N/A
metadata-eval49.7
lift-pow.f64N/A
pow1/2N/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.f6454.1
Applied rewrites54.1%
if -4.999999999999985e-310 < d Initial program 61.5%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval61.8
Applied rewrites61.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.2
Applied rewrites37.2%
Applied rewrites37.2%
Applied rewrites45.2%
Final simplification50.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 (<= h -3.3e-284)
(/ (* (* 1.0 (sqrt (/ d l))) (sqrt (- d))) (sqrt (- h)))
(if (<= h 9e-276)
(* (sqrt (/ 1.0 (* l h))) (- 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 tmp;
if (h <= -3.3e-284) {
tmp = ((1.0 * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
} else if (h <= 9e-276) {
tmp = sqrt((1.0 / (l * h))) * -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) :: tmp
if (h <= (-3.3d-284)) then
tmp = ((1.0d0 * sqrt((d / l))) * sqrt(-d)) / sqrt(-h)
else if (h <= 9d-276) then
tmp = sqrt((1.0d0 / (l * h))) * -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 tmp;
if (h <= -3.3e-284) {
tmp = ((1.0 * Math.sqrt((d / l))) * Math.sqrt(-d)) / Math.sqrt(-h);
} else if (h <= 9e-276) {
tmp = Math.sqrt((1.0 / (l * h))) * -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): tmp = 0 if h <= -3.3e-284: tmp = ((1.0 * math.sqrt((d / l))) * math.sqrt(-d)) / math.sqrt(-h) elif h <= 9e-276: tmp = math.sqrt((1.0 / (l * h))) * -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) tmp = 0.0 if (h <= -3.3e-284) tmp = Float64(Float64(Float64(1.0 * sqrt(Float64(d / l))) * sqrt(Float64(-d))) / sqrt(Float64(-h))); elseif (h <= 9e-276) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-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)
tmp = 0.0;
if (h <= -3.3e-284)
tmp = ((1.0 * sqrt((d / l))) * sqrt(-d)) / sqrt(-h);
elseif (h <= 9e-276)
tmp = sqrt((1.0 / (l * h))) * -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_] := If[LessEqual[h, -3.3e-284], N[(N[(N[(1.0 * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 9e-276], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-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}
\mathbf{if}\;h \leq -3.3 \cdot 10^{-284}:\\
\;\;\;\;\frac{\left(1 \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{-d}}{\sqrt{-h}}\\
\mathbf{elif}\;h \leq 9 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < -3.30000000000000008e-284Initial program 71.9%
Taylor expanded in h around 0
Applied rewrites42.2%
lift-/.f64N/A
metadata-eval42.2
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6449.6
Applied rewrites49.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-/.f64N/A
Applied rewrites49.6%
if -3.30000000000000008e-284 < h < 8.99999999999999925e-276Initial program 55.8%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval58.2
Applied rewrites58.2%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6462.9
Applied rewrites62.9%
if 8.99999999999999925e-276 < h Initial program 62.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval62.7
Applied rewrites62.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites38.8%
Applied rewrites47.1%
Final simplification49.2%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= h 9e-276) (* (sqrt (/ 1.0 (* l h))) (- 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 tmp;
if (h <= 9e-276) {
tmp = sqrt((1.0 / (l * h))) * -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) :: tmp
if (h <= 9d-276) then
tmp = sqrt((1.0d0 / (l * h))) * -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 tmp;
if (h <= 9e-276) {
tmp = Math.sqrt((1.0 / (l * h))) * -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): tmp = 0 if h <= 9e-276: tmp = math.sqrt((1.0 / (l * h))) * -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) tmp = 0.0 if (h <= 9e-276) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-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)
tmp = 0.0;
if (h <= 9e-276)
tmp = sqrt((1.0 / (l * h))) * -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_] := If[LessEqual[h, 9e-276], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-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}
\mathbf{if}\;h \leq 9 \cdot 10^{-276}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if h < 8.99999999999999925e-276Initial program 70.4%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval69.9
Applied rewrites69.9%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites47.8%
if 8.99999999999999925e-276 < h Initial program 62.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval62.7
Applied rewrites62.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites38.8%
Applied rewrites47.1%
Final simplification47.5%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (let* ((t_0 (sqrt (/ 1.0 (* l h))))) (if (<= h 9.5e-276) (* t_0 (- d)) (* 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((1.0 / (l * h)));
double tmp;
if (h <= 9.5e-276) {
tmp = t_0 * -d;
} 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((1.0d0 / (l * h)))
if (h <= 9.5d-276) then
tmp = t_0 * -d
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((1.0 / (l * h)));
double tmp;
if (h <= 9.5e-276) {
tmp = t_0 * -d;
} 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((1.0 / (l * h))) tmp = 0 if h <= 9.5e-276: tmp = t_0 * -d 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(1.0 / Float64(l * h))) tmp = 0.0 if (h <= 9.5e-276) tmp = Float64(t_0 * Float64(-d)); 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((1.0 / (l * h)));
tmp = 0.0;
if (h <= 9.5e-276)
tmp = t_0 * -d;
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[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, 9.5e-276], N[(t$95$0 * (-d)), $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{\frac{1}{\ell \cdot h}}\\
\mathbf{if}\;h \leq 9.5 \cdot 10^{-276}:\\
\;\;\;\;t\_0 \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot d\\
\end{array}
\end{array}
if h < 9.49999999999999929e-276Initial program 70.4%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval69.9
Applied rewrites69.9%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.8
Applied rewrites47.8%
if 9.49999999999999929e-276 < h Initial program 62.3%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval62.7
Applied rewrites62.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Final simplification43.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 (* (sqrt (/ 1.0 (* l h))) 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((1.0 / (l * h))) * 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((1.0d0 / (l * h))) * 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((1.0 / (l * h))) * 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((1.0 / (l * h))) * 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(1.0 / Float64(l * h))) * 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((1.0 / (l * h))) * 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[(1.0 / N[(l * h), $MachinePrecision]), $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{\frac{1}{\ell \cdot h}} \cdot d
\end{array}
Initial program 66.8%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval66.7
Applied rewrites66.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.1
Applied rewrites22.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 (/ 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 66.8%
lift-pow.f64N/A
lift-/.f64N/A
clear-numN/A
inv-powN/A
pow-powN/A
lift-/.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lift-/.f64N/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval66.7
Applied rewrites66.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6422.1
Applied rewrites22.1%
Applied rewrites21.7%
herbie shell --seed 2024242
(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)))))