
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (/ (* (* D (/ 0.5 d)) M) l))
(t_2 (* (/ M d) D)))
(if (<= d -1.3e+118)
(*
(fma (* (* (* (- D) 0.25) (/ M d)) t_1) h 1.0)
(* (pow (/ d l) (/ 1.0 2.0)) (/ t_0 (sqrt (- h)))))
(if (<= d -6e-175)
(*
(- 1.0 (* (/ (* (* (* D 0.5) 0.5) (/ M d)) (pow h -1.0)) t_1))
(* (* (sqrt (pow (- l) -1.0)) t_0) (pow (/ d h) (/ 1.0 2.0))))
(if (<= d 2.4e-182)
(/
(fma
(pow (/ h l) 1.5)
(/ (* (pow (* D M) 2.0) -0.125) d)
(* (sqrt (/ h l)) d))
h)
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (fma (* t_2 (* -0.125 (/ h l))) t_2 1.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double t_1 = ((D * (0.5 / d)) * M) / l;
double t_2 = (M / d) * D;
double tmp;
if (d <= -1.3e+118) {
tmp = fma((((-D * 0.25) * (M / d)) * t_1), h, 1.0) * (pow((d / l), (1.0 / 2.0)) * (t_0 / sqrt(-h)));
} else if (d <= -6e-175) {
tmp = (1.0 - (((((D * 0.5) * 0.5) * (M / d)) / pow(h, -1.0)) * t_1)) * ((sqrt(pow(-l, -1.0)) * t_0) * pow((d / h), (1.0 / 2.0)));
} else if (d <= 2.4e-182) {
tmp = fma(pow((h / l), 1.5), ((pow((D * M), 2.0) * -0.125) / d), (sqrt((h / l)) * d)) / h;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * fma((t_2 * (-0.125 * (h / l))), t_2, 1.0));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(Float64(Float64(D * Float64(0.5 / d)) * M) / l) t_2 = Float64(Float64(M / d) * D) tmp = 0.0 if (d <= -1.3e+118) tmp = Float64(fma(Float64(Float64(Float64(Float64(-D) * 0.25) * Float64(M / d)) * t_1), h, 1.0) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(t_0 / sqrt(Float64(-h))))); elseif (d <= -6e-175) tmp = Float64(Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * 0.5) * 0.5) * Float64(M / d)) / (h ^ -1.0)) * t_1)) * Float64(Float64(sqrt((Float64(-l) ^ -1.0)) * t_0) * (Float64(d / h) ^ Float64(1.0 / 2.0)))); elseif (d <= 2.4e-182) tmp = Float64(fma((Float64(h / l) ^ 1.5), Float64(Float64((Float64(D * M) ^ 2.0) * -0.125) / d), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(t_2 * Float64(-0.125 * Float64(h / l))), t_2, 1.0))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, If[LessEqual[d, -1.3e+118], N[(N[(N[(N[(N[((-D) * 0.25), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6e-175], N[(N[(1.0 - N[(N[(N[(N[(N[(D * 0.5), $MachinePrecision] * 0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[Power[(-l), -1.0], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-182], N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] / d), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell}\\
t_2 := \frac{M}{d} \cdot D\\
\mathbf{if}\;d \leq -1.3 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(-D\right) \cdot 0.25\right) \cdot \frac{M}{d}\right) \cdot t\_1, h, 1\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{t\_0}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -6 \cdot 10^{-175}:\\
\;\;\;\;\left(1 - \frac{\left(\left(D \cdot 0.5\right) \cdot 0.5\right) \cdot \frac{M}{d}}{{h}^{-1}} \cdot t\_1\right) \cdot \left(\left(\sqrt{{\left(-\ell\right)}^{-1}} \cdot t\_0\right) \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5}, \frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(t\_2 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_2, 1\right)\right)\\
\end{array}
\end{array}
if d < -1.30000000000000008e118Initial program 58.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/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.f6477.0
Applied rewrites77.0%
Applied rewrites85.8%
if -1.30000000000000008e118 < d < -6e-175Initial program 78.2%
Applied rewrites83.4%
lift-/.f64N/A
metadata-eval83.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
div-invN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
inv-powN/A
lower-pow.f64N/A
lower-neg.f6493.2
Applied rewrites93.2%
if -6e-175 < d < 2.3999999999999998e-182Initial program 41.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.1%
Applied rewrites64.2%
if 2.3999999999999998e-182 < d Initial program 77.0%
Applied rewrites50.6%
Applied rewrites77.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6487.6
Applied rewrites87.6%
Final simplification83.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))))
(t_2 (sqrt (/ d l)))
(t_3 (sqrt (/ d h)))
(t_4 (fabs (/ d (sqrt (* l h))))))
(if (<= t_1 -4e-172)
(* (* (fma (/ (* (* -0.125 h) (* D M)) (* l d)) t_0 1.0) t_2) t_3)
(if (<= t_1 1e-247)
t_4
(if (<= t_1 5e+157)
(* (* (fma (* (/ h d) (/ (* (* D M) -0.125) l)) t_0 1.0) t_2) t_3)
t_4)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double t_2 = sqrt((d / l));
double t_3 = sqrt((d / h));
double t_4 = fabs((d / sqrt((l * h))));
double tmp;
if (t_1 <= -4e-172) {
tmp = (fma((((-0.125 * h) * (D * M)) / (l * d)), t_0, 1.0) * t_2) * t_3;
} else if (t_1 <= 1e-247) {
tmp = t_4;
} else if (t_1 <= 5e+157) {
tmp = (fma(((h / d) * (((D * M) * -0.125) / l)), t_0, 1.0) * t_2) * t_3;
} else {
tmp = t_4;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) t_2 = sqrt(Float64(d / l)) t_3 = sqrt(Float64(d / h)) t_4 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_1 <= -4e-172) tmp = Float64(Float64(fma(Float64(Float64(Float64(-0.125 * h) * Float64(D * M)) / Float64(l * d)), t_0, 1.0) * t_2) * t_3); elseif (t_1 <= 1e-247) tmp = t_4; elseif (t_1 <= 5e+157) tmp = Float64(Float64(fma(Float64(Float64(h / d) * Float64(Float64(Float64(D * M) * -0.125) / l)), t_0, 1.0) * t_2) * t_3); else tmp = t_4; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, -4e-172], N[(N[(N[(N[(N[(N[(-0.125 * h), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[t$95$1, 1e-247], t$95$4, If[LessEqual[t$95$1, 5e+157], N[(N[(N[(N[(N[(h / d), $MachinePrecision] * N[(N[(N[(D * M), $MachinePrecision] * -0.125), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$3), $MachinePrecision], t$95$4]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-172}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(-0.125 \cdot h\right) \cdot \left(D \cdot M\right)}{\ell \cdot d}, t\_0, 1\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{elif}\;t\_1 \leq 10^{-247}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{h}{d} \cdot \frac{\left(D \cdot M\right) \cdot -0.125}{\ell}, t\_0, 1\right) \cdot t\_2\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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.0000000000000002e-172Initial program 86.9%
Applied rewrites49.3%
Applied rewrites85.8%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6488.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.7
Applied rewrites84.7%
if -4.0000000000000002e-172 < (*.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)))) < 1e-247 or 4.99999999999999976e157 < (*.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 22.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.1
Applied rewrites31.1%
Applied rewrites55.7%
if 1e-247 < (*.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.99999999999999976e157Initial program 98.3%
Applied rewrites86.0%
Applied rewrites98.2%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6498.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.2
Applied rewrites98.2%
Taylor expanded in h around 0
associate-*r/N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
Final simplification77.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -4e-172)
(*
(* (fma (/ (* (* -0.125 h) (* D M)) (* l d)) (* (/ M d) D) 1.0) t_1)
t_2)
(if (<= t_0 1e-247) t_3 (if (<= t_0 5e+157) (* t_2 t_1) t_3)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -4e-172) {
tmp = (fma((((-0.125 * h) * (D * M)) / (l * d)), ((M / d) * D), 1.0) * t_1) * t_2;
} else if (t_0 <= 1e-247) {
tmp = t_3;
} else if (t_0 <= 5e+157) {
tmp = t_2 * t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -4e-172) tmp = Float64(Float64(fma(Float64(Float64(Float64(-0.125 * h) * Float64(D * M)) / Float64(l * d)), Float64(Float64(M / d) * D), 1.0) * t_1) * t_2); elseif (t_0 <= 1e-247) tmp = t_3; elseif (t_0 <= 5e+157) tmp = Float64(t_2 * t_1); else tmp = t_3; end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -4e-172], N[(N[(N[(N[(N[(N[(-0.125 * h), $MachinePrecision] * N[(D * M), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 1e-247], t$95$3, If[LessEqual[t$95$0, 5e+157], N[(t$95$2 * t$95$1), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-172}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\left(-0.125 \cdot h\right) \cdot \left(D \cdot M\right)}{\ell \cdot d}, \frac{M}{d} \cdot D, 1\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 10^{-247}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;t\_2 \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\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.0000000000000002e-172Initial program 86.9%
Applied rewrites49.3%
Applied rewrites85.8%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6488.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.5
Applied rewrites88.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6484.7
Applied rewrites84.7%
if -4.0000000000000002e-172 < (*.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)))) < 1e-247 or 4.99999999999999976e157 < (*.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 22.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.1
Applied rewrites31.1%
Applied rewrites55.7%
if 1e-247 < (*.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.99999999999999976e157Initial program 98.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.4
Applied rewrites46.4%
Applied rewrites97.1%
Final simplification77.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))))
(t_1 (fabs (/ d (sqrt (* l h))))))
(if (<= t_0 -4e-172)
(* (* (/ (sqrt (/ h l)) (fabs l)) (/ (* D D) d)) (* (* M M) -0.125))
(if (<= t_0 1e-247)
t_1
(if (<= t_0 5e+157) (* (sqrt (/ d h)) (sqrt (/ d l))) t_1)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double t_1 = fabs((d / sqrt((l * h))));
double tmp;
if (t_0 <= -4e-172) {
tmp = ((sqrt((h / l)) / fabs(l)) * ((D * D) / d)) * ((M * M) * -0.125);
} else if (t_0 <= 1e-247) {
tmp = t_1;
} else if (t_0 <= 5e+157) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
t_1 = abs((d / sqrt((l * h))))
if (t_0 <= (-4d-172)) then
tmp = ((sqrt((h / l)) / abs(l)) * ((d_1 * d_1) / d)) * ((m * m) * (-0.125d0))
else if (t_0 <= 1d-247) then
tmp = t_1
else if (t_0 <= 5d+157) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double tmp;
if (t_0 <= -4e-172) {
tmp = ((Math.sqrt((h / l)) / Math.abs(l)) * ((D * D) / d)) * ((M * M) * -0.125);
} else if (t_0 <= 1e-247) {
tmp = t_1;
} else if (t_0 <= 5e+157) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = (1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) t_1 = math.fabs((d / math.sqrt((l * h)))) tmp = 0 if t_0 <= -4e-172: tmp = ((math.sqrt((h / l)) / math.fabs(l)) * ((D * D) / d)) * ((M * M) * -0.125) elif t_0 <= 1e-247: tmp = t_1 elif t_0 <= 5e+157: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) tmp = 0.0 if (t_0 <= -4e-172) tmp = Float64(Float64(Float64(sqrt(Float64(h / l)) / abs(l)) * Float64(Float64(D * D) / d)) * Float64(Float64(M * M) * -0.125)); elseif (t_0 <= 1e-247) tmp = t_1; elseif (t_0 <= 5e+157) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = (1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))); t_1 = abs((d / sqrt((l * h)))); tmp = 0.0; if (t_0 <= -4e-172) tmp = ((sqrt((h / l)) / abs(l)) * ((D * D) / d)) * ((M * M) * -0.125); elseif (t_0 <= 1e-247) tmp = t_1; elseif (t_0 <= 5e+157) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -4e-172], N[(N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-247], t$95$1, If[LessEqual[t$95$0, 5e+157], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-172}:\\
\;\;\;\;\left(\frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|} \cdot \frac{D \cdot D}{d}\right) \cdot \left(\left(M \cdot M\right) \cdot -0.125\right)\\
\mathbf{elif}\;t\_0 \leq 10^{-247}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\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)))) < -4.0000000000000002e-172Initial program 86.9%
Taylor expanded in h around inf
associate-*l/N/A
*-commutativeN/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites39.9%
Applied rewrites46.0%
if -4.0000000000000002e-172 < (*.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)))) < 1e-247 or 4.99999999999999976e157 < (*.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 22.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.1
Applied rewrites31.1%
Applied rewrites55.7%
if 1e-247 < (*.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.99999999999999976e157Initial program 98.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.4
Applied rewrites46.4%
Applied rewrites97.1%
Final simplification62.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))))
(if (<= t_1 -4e-172)
(/ (* (sqrt (/ h l)) (- d)) h)
(if (<= t_1 1e-247)
t_0
(if (<= t_1 5e+157) (* (sqrt (/ d h)) (sqrt (/ d l))) t_0)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -4e-172) {
tmp = (sqrt((h / l)) * -d) / h;
} else if (t_1 <= 1e-247) {
tmp = t_0;
} else if (t_1 <= 5e+157) {
tmp = sqrt((d / h)) * sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
if (t_1 <= (-4d-172)) then
tmp = (sqrt((h / l)) * -d) / h
else if (t_1 <= 1d-247) then
tmp = t_0
else if (t_1 <= 5d+157) then
tmp = sqrt((d / h)) * sqrt((d / l))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -4e-172) {
tmp = (Math.sqrt((h / l)) * -d) / h;
} else if (t_1 <= 1e-247) {
tmp = t_0;
} else if (t_1 <= 5e+157) {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) tmp = 0 if t_1 <= -4e-172: tmp = (math.sqrt((h / l)) * -d) / h elif t_1 <= 1e-247: tmp = t_0 elif t_1 <= 5e+157: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -4e-172) tmp = Float64(Float64(sqrt(Float64(h / l)) * Float64(-d)) / h); elseif (t_1 <= 1e-247) tmp = t_0; elseif (t_1 <= 5e+157) tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = (1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))); tmp = 0.0; if (t_1 <= -4e-172) tmp = (sqrt((h / l)) * -d) / h; elseif (t_1 <= 1e-247) tmp = t_0; elseif (t_1 <= 5e+157) tmp = sqrt((d / h)) * sqrt((d / l)); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-172], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$1, 1e-247], t$95$0, If[LessEqual[t$95$1, 5e+157], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-172}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \left(-d\right)}{h}\\
\mathbf{elif}\;t\_1 \leq 10^{-247}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.0000000000000002e-172Initial program 86.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.7%
Taylor expanded in l around -inf
Applied rewrites29.6%
if -4.0000000000000002e-172 < (*.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)))) < 1e-247 or 4.99999999999999976e157 < (*.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 22.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.1
Applied rewrites31.1%
Applied rewrites55.7%
if 1e-247 < (*.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.99999999999999976e157Initial program 98.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6446.4
Applied rewrites46.4%
Applied rewrites97.1%
Final simplification55.6%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ h l)))
(t_1 (fabs (/ d (sqrt (* l h)))))
(t_2
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))))
(if (<= t_2 -4e-172)
(/ (* t_0 (- d)) h)
(if (<= t_2 1e-247) t_1 (if (<= t_2 1e+196) (/ (* t_0 d) h) t_1)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((h / l));
double t_1 = fabs((d / sqrt((l * h))));
double t_2 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_2 <= -4e-172) {
tmp = (t_0 * -d) / h;
} else if (t_2 <= 1e-247) {
tmp = t_1;
} else if (t_2 <= 1e+196) {
tmp = (t_0 * d) / h;
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((h / l))
t_1 = abs((d / sqrt((l * h))))
t_2 = (1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
if (t_2 <= (-4d-172)) then
tmp = (t_0 * -d) / h
else if (t_2 <= 1d-247) then
tmp = t_1
else if (t_2 <= 1d+196) then
tmp = (t_0 * d) / h
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.sqrt((h / l));
double t_1 = Math.abs((d / Math.sqrt((l * h))));
double t_2 = (1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_2 <= -4e-172) {
tmp = (t_0 * -d) / h;
} else if (t_2 <= 1e-247) {
tmp = t_1;
} else if (t_2 <= 1e+196) {
tmp = (t_0 * d) / h;
} else {
tmp = t_1;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.sqrt((h / l)) t_1 = math.fabs((d / math.sqrt((l * h)))) t_2 = (1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) tmp = 0 if t_2 <= -4e-172: tmp = (t_0 * -d) / h elif t_2 <= 1e-247: tmp = t_1 elif t_2 <= 1e+196: tmp = (t_0 * d) / h else: tmp = t_1 return tmp
function code(d, h, l, M, D) t_0 = sqrt(Float64(h / l)) t_1 = abs(Float64(d / sqrt(Float64(l * h)))) t_2 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_2 <= -4e-172) tmp = Float64(Float64(t_0 * Float64(-d)) / h); elseif (t_2 <= 1e-247) tmp = t_1; elseif (t_2 <= 1e+196) tmp = Float64(Float64(t_0 * d) / h); else tmp = t_1; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = sqrt((h / l)); t_1 = abs((d / sqrt((l * h)))); t_2 = (1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))); tmp = 0.0; if (t_2 <= -4e-172) tmp = (t_0 * -d) / h; elseif (t_2 <= 1e-247) tmp = t_1; elseif (t_2 <= 1e+196) tmp = (t_0 * d) / h; else tmp = t_1; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -4e-172], N[(N[(t$95$0 * (-d)), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$2, 1e-247], t$95$1, If[LessEqual[t$95$2, 1e+196], N[(N[(t$95$0 * d), $MachinePrecision] / h), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell}}\\
t_1 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_2 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_2 \leq -4 \cdot 10^{-172}:\\
\;\;\;\;\frac{t\_0 \cdot \left(-d\right)}{h}\\
\mathbf{elif}\;t\_2 \leq 10^{-247}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+196}:\\
\;\;\;\;\frac{t\_0 \cdot 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)))) < -4.0000000000000002e-172Initial program 86.9%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.7%
Taylor expanded in l around -inf
Applied rewrites29.6%
if -4.0000000000000002e-172 < (*.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)))) < 1e-247 or 9.9999999999999995e195 < (*.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 20.1%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6429.9
Applied rewrites29.9%
Applied rewrites54.2%
if 1e-247 < (*.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.9999999999999995e195Initial program 98.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites69.4%
Taylor expanded in h around 0
Applied rewrites92.5%
Final simplification54.4%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))))
(if (<= t_1 -5e+51)
(* (sqrt (/ 1.0 (* l h))) (- d))
(if (<= t_1 1e-247)
t_0
(if (<= t_1 1e+196) (/ (* (sqrt (/ h l)) d) h) t_0)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -5e+51) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else if (t_1 <= 1e-247) {
tmp = t_0;
} else if (t_1 <= 1e+196) {
tmp = (sqrt((h / l)) * d) / h;
} else {
tmp = t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
if (t_1 <= (-5d+51)) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else if (t_1 <= 1d-247) then
tmp = t_0
else if (t_1 <= 1d+196) then
tmp = (sqrt((h / l)) * d) / h
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -5e+51) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else if (t_1 <= 1e-247) {
tmp = t_0;
} else if (t_1 <= 1e+196) {
tmp = (Math.sqrt((h / l)) * d) / h;
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) tmp = 0 if t_1 <= -5e+51: tmp = math.sqrt((1.0 / (l * h))) * -d elif t_1 <= 1e-247: tmp = t_0 elif t_1 <= 1e+196: tmp = (math.sqrt((h / l)) * d) / h else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -5e+51) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); elseif (t_1 <= 1e-247) tmp = t_0; elseif (t_1 <= 1e+196) tmp = Float64(Float64(sqrt(Float64(h / l)) * d) / h); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = (1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))); tmp = 0.0; if (t_1 <= -5e+51) tmp = sqrt((1.0 / (l * h))) * -d; elseif (t_1 <= 1e-247) tmp = t_0; elseif (t_1 <= 1e+196) tmp = (sqrt((h / l)) * d) / h; else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+51], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 1e-247], t$95$0, If[LessEqual[t$95$1, 1e+196], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision] / h), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+51}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 10^{-247}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+196}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5e51Initial program 86.5%
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-*.f6414.1
Applied rewrites14.1%
if -5e51 < (*.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)))) < 1e-247 or 9.9999999999999995e195 < (*.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 22.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6429.1
Applied rewrites29.1%
Applied rewrites52.6%
if 1e-247 < (*.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.9999999999999995e195Initial program 98.3%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites69.4%
Taylor expanded in h around 0
Applied rewrites92.5%
Final simplification48.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (fabs (/ d (sqrt (* l h)))))
(t_1
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))))
(if (<= t_1 -5e+51)
(* (sqrt (/ 1.0 (* l h))) (- d))
(if (<= t_1 2e-200)
t_0
(if (<= t_1 4e+97) (sqrt (* (/ (/ d l) h) d)) t_0)))))
double code(double d, double h, double l, double M, double D) {
double t_0 = fabs((d / sqrt((l * h))));
double t_1 = (1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -5e+51) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else if (t_1 <= 2e-200) {
tmp = t_0;
} else if (t_1 <= 4e+97) {
tmp = sqrt((((d / l) / h) * d));
} else {
tmp = t_0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((d / sqrt((l * h))))
t_1 = (1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))
if (t_1 <= (-5d+51)) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else if (t_1 <= 2d-200) then
tmp = t_0
else if (t_1 <= 4d+97) then
tmp = sqrt((((d / l) / h) * d))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = Math.abs((d / Math.sqrt((l * h))));
double t_1 = (1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)));
double tmp;
if (t_1 <= -5e+51) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else if (t_1 <= 2e-200) {
tmp = t_0;
} else if (t_1 <= 4e+97) {
tmp = Math.sqrt((((d / l) / h) * d));
} else {
tmp = t_0;
}
return tmp;
}
def code(d, h, l, M, D): t_0 = math.fabs((d / math.sqrt((l * h)))) t_1 = (1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) tmp = 0 if t_1 <= -5e+51: tmp = math.sqrt((1.0 / (l * h))) * -d elif t_1 <= 2e-200: tmp = t_0 elif t_1 <= 4e+97: tmp = math.sqrt((((d / l) / h) * d)) else: tmp = t_0 return tmp
function code(d, h, l, M, D) t_0 = abs(Float64(d / sqrt(Float64(l * h)))) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -5e+51) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); elseif (t_1 <= 2e-200) tmp = t_0; elseif (t_1 <= 4e+97) tmp = sqrt(Float64(Float64(Float64(d / l) / h) * d)); else tmp = t_0; end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = abs((d / sqrt((l * h)))); t_1 = (1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))); tmp = 0.0; if (t_1 <= -5e+51) tmp = sqrt((1.0 / (l * h))) * -d; elseif (t_1 <= 2e-200) tmp = t_0; elseif (t_1 <= 4e+97) tmp = sqrt((((d / l) / h) * d)); else tmp = t_0; end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+51], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[t$95$1, 2e-200], t$95$0, If[LessEqual[t$95$1, 4e+97], N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
t_1 := \left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+51}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+97}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5e51Initial program 86.5%
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-*.f6414.1
Applied rewrites14.1%
if -5e51 < (*.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-200 or 4.0000000000000003e97 < (*.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 35.1%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6435.5
Applied rewrites35.5%
Applied rewrites56.9%
if 2e-200 < (*.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.0000000000000003e97Initial program 99.4%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6439.6
Applied rewrites39.6%
Applied rewrites96.9%
Final simplification47.8%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
5e+157)
(*
(*
(fma (* (/ (* D M) d) (* -0.125 (/ h l))) (* (/ M d) D) 1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= 5e+157) {
tmp = (fma((((D * M) / d) * (-0.125 * (h / l))), ((M / d) * D), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= 5e+157) tmp = Float64(Float64(fma(Float64(Float64(Float64(D * M) / d) * Float64(-0.125 * Float64(h / l))), Float64(Float64(M / d) * D), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+157], N[(N[(N[(N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{D \cdot M}{d} \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), \frac{M}{d} \cdot D, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.99999999999999976e157Initial program 86.8%
Applied rewrites60.6%
Applied rewrites86.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6487.7
Applied rewrites87.7%
if 4.99999999999999976e157 < (*.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 18.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.0
Applied rewrites24.0%
Applied rewrites48.9%
Final simplification76.1%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D)))
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
5e+157)
(*
(sqrt (/ d h))
(* (sqrt (/ d l)) (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0)))
(fabs (/ d (sqrt (* l h)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= 5e+157) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma((t_0 * (-0.125 * (h / l))), t_0, 1.0));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= 5e+157) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+157], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.99999999999999976e157Initial program 86.8%
Applied rewrites60.6%
Applied rewrites86.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
if 4.99999999999999976e157 < (*.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 18.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.0
Applied rewrites24.0%
Applied rewrites48.9%
Final simplification76.1%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
5e+157)
(*
(*
(fma (* (* (/ M d) D) (* -0.125 (/ h l))) (* (/ D d) M) 1.0)
(sqrt (/ d l)))
(sqrt (/ d h)))
(fabs (/ d (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= 5e+157) {
tmp = (fma((((M / d) * D) * (-0.125 * (h / l))), ((D / d) * M), 1.0) * sqrt((d / l))) * sqrt((d / h));
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= 5e+157) tmp = Float64(Float64(fma(Float64(Float64(Float64(M / d) * D) * Float64(-0.125 * Float64(h / l))), Float64(Float64(D / d) * M), 1.0) * sqrt(Float64(d / l))) * sqrt(Float64(d / h))); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+157], N[(N[(N[(N[(N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision] * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(D / d), $MachinePrecision] * M), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 5 \cdot 10^{+157}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(\frac{M}{d} \cdot D\right) \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), \frac{D}{d} \cdot M, 1\right) \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.99999999999999976e157Initial program 86.8%
Applied rewrites60.6%
Applied rewrites86.1%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6487.6
Applied rewrites87.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
if 4.99999999999999976e157 < (*.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 18.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.0
Applied rewrites24.0%
Applied rewrites48.9%
Final simplification76.1%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
-5e+51)
(* (sqrt (/ 1.0 (* l h))) (- d))
(fabs (/ d (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= -5e+51) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
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
real(8) :: tmp
if (((1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))) <= (-5d+51)) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = abs((d / sqrt((l * h))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)))) <= -5e+51) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)))) <= -5e+51: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = math.fabs((d / math.sqrt((l * h)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= -5e+51) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)))) <= -5e+51) tmp = sqrt((1.0 / (l * h))) * -d; else tmp = abs((d / sqrt((l * h)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5e+51], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -5 \cdot 10^{+51}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -5e51Initial program 86.5%
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-*.f6414.1
Applied rewrites14.1%
if -5e51 < (*.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.3%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6436.7
Applied rewrites36.7%
Applied rewrites60.8%
Final simplification42.9%
(FPCore (d h l M D)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
-2e-160)
(* (sqrt (/ 1.0 (* l h))) d)
(fabs (/ d (sqrt (* l h))))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= -2e-160) {
tmp = sqrt((1.0 / (l * h))) * d;
} else {
tmp = fabs((d / sqrt((l * h))));
}
return tmp;
}
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
real(8) :: tmp
if (((1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))) <= (-2d-160)) then
tmp = sqrt((1.0d0 / (l * h))) * d
else
tmp = abs((d / sqrt((l * h))))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (((1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)))) <= -2e-160) {
tmp = Math.sqrt((1.0 / (l * h))) * d;
} else {
tmp = Math.abs((d / Math.sqrt((l * h))));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if ((1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)))) <= -2e-160: tmp = math.sqrt((1.0 / (l * h))) * d else: tmp = math.fabs((d / math.sqrt((l * h)))) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= -2e-160) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * d); else tmp = abs(Float64(d / sqrt(Float64(l * h)))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (((1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)))) <= -2e-160) tmp = sqrt((1.0 / (l * h))) * d; else tmp = abs((d / sqrt((l * h)))); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-160], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision], N[Abs[N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -2 \cdot 10^{-160}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot d\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{d}{\sqrt{\ell \cdot h}}\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-160Initial program 86.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6411.9
Applied rewrites11.9%
if -2e-160 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 53.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.1
Applied rewrites37.1%
Applied rewrites61.6%
Final simplification42.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* l h)))))
(if (<=
(*
(- 1.0 (* (* (pow (/ (* D M) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))))
-2e-160)
t_0
(fabs t_0))))
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((l * h));
double tmp;
if (((1.0 - ((pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0)))) <= -2e-160) {
tmp = t_0;
} else {
tmp = fabs(t_0);
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = d / sqrt((l * h))
if (((1.0d0 - (((((d_1 * m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0)))) <= (-2d-160)) then
tmp = t_0
else
tmp = abs(t_0)
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double t_0 = d / Math.sqrt((l * h));
double tmp;
if (((1.0 - ((Math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0)))) <= -2e-160) {
tmp = t_0;
} else {
tmp = Math.abs(t_0);
}
return tmp;
}
def code(d, h, l, M, D): t_0 = d / math.sqrt((l * h)) tmp = 0 if ((1.0 - ((math.pow(((D * M) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0)))) <= -2e-160: tmp = t_0 else: tmp = math.fabs(t_0) return tmp
function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(l * h))) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(D * M) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0)))) <= -2e-160) tmp = t_0; else tmp = abs(t_0); end return tmp end
function tmp_2 = code(d, h, l, M, D) t_0 = d / sqrt((l * h)); tmp = 0.0; if (((1.0 - (((((D * M) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0)))) <= -2e-160) tmp = t_0; else tmp = abs(t_0); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(D * M), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-160], t$95$0, N[Abs[t$95$0], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{if}\;\left(1 - \left({\left(\frac{D \cdot M}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -2 \cdot 10^{-160}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|t\_0\right|\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -2e-160Initial program 86.8%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6411.9
Applied rewrites11.9%
Applied rewrites11.0%
if -2e-160 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 53.7%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6437.1
Applied rewrites37.1%
Applied rewrites61.6%
Final simplification41.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (- d)))
(t_1 (/ (* (* D (/ 0.5 d)) M) l))
(t_2 (* (/ M d) D)))
(if (<= d -1.35e+118)
(*
(fma (* (* (* (- D) 0.25) (/ M d)) t_1) h 1.0)
(* (pow (/ d l) (/ 1.0 2.0)) (/ t_0 (sqrt (- h)))))
(if (<= d -6e-175)
(*
(* (/ t_0 (sqrt (- l))) (pow (/ d h) (/ 1.0 2.0)))
(- 1.0 (* (/ (* (* (* D 0.5) 0.5) (/ M d)) (pow h -1.0)) t_1)))
(if (<= d 2.4e-182)
(/
(fma
(pow (/ h l) 1.5)
(/ (* (pow (* D M) 2.0) -0.125) d)
(* (sqrt (/ h l)) d))
h)
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (fma (* t_2 (* -0.125 (/ h l))) t_2 1.0))))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt(-d);
double t_1 = ((D * (0.5 / d)) * M) / l;
double t_2 = (M / d) * D;
double tmp;
if (d <= -1.35e+118) {
tmp = fma((((-D * 0.25) * (M / d)) * t_1), h, 1.0) * (pow((d / l), (1.0 / 2.0)) * (t_0 / sqrt(-h)));
} else if (d <= -6e-175) {
tmp = ((t_0 / sqrt(-l)) * pow((d / h), (1.0 / 2.0))) * (1.0 - (((((D * 0.5) * 0.5) * (M / d)) / pow(h, -1.0)) * t_1));
} else if (d <= 2.4e-182) {
tmp = fma(pow((h / l), 1.5), ((pow((D * M), 2.0) * -0.125) / d), (sqrt((h / l)) * d)) / h;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * fma((t_2 * (-0.125 * (h / l))), t_2, 1.0));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = sqrt(Float64(-d)) t_1 = Float64(Float64(Float64(D * Float64(0.5 / d)) * M) / l) t_2 = Float64(Float64(M / d) * D) tmp = 0.0 if (d <= -1.35e+118) tmp = Float64(fma(Float64(Float64(Float64(Float64(-D) * 0.25) * Float64(M / d)) * t_1), h, 1.0) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(t_0 / sqrt(Float64(-h))))); elseif (d <= -6e-175) tmp = Float64(Float64(Float64(t_0 / sqrt(Float64(-l))) * (Float64(d / h) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(Float64(Float64(D * 0.5) * 0.5) * Float64(M / d)) / (h ^ -1.0)) * t_1))); elseif (d <= 2.4e-182) tmp = Float64(fma((Float64(h / l) ^ 1.5), Float64(Float64((Float64(D * M) ^ 2.0) * -0.125) / d), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(t_2 * Float64(-0.125 * Float64(h / l))), t_2, 1.0))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[(-d)], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]}, Block[{t$95$2 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, If[LessEqual[d, -1.35e+118], N[(N[(N[(N[(N[((-D) * 0.25), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -6e-175], N[(N[(N[(t$95$0 / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(N[(N[(D * 0.5), $MachinePrecision] * 0.5), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] / N[Power[h, -1.0], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-182], N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] / d), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$2 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{-d}\\
t_1 := \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell}\\
t_2 := \frac{M}{d} \cdot D\\
\mathbf{if}\;d \leq -1.35 \cdot 10^{+118}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(-D\right) \cdot 0.25\right) \cdot \frac{M}{d}\right) \cdot t\_1, h, 1\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{t\_0}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -6 \cdot 10^{-175}:\\
\;\;\;\;\left(\frac{t\_0}{\sqrt{-\ell}} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \frac{\left(\left(D \cdot 0.5\right) \cdot 0.5\right) \cdot \frac{M}{d}}{{h}^{-1}} \cdot t\_1\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5}, \frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(t\_2 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_2, 1\right)\right)\\
\end{array}
\end{array}
if d < -1.35e118Initial program 58.5%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/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.f6477.0
Applied rewrites77.0%
Applied rewrites85.8%
if -1.35e118 < d < -6e-175Initial program 78.2%
Applied rewrites83.4%
lift-/.f64N/A
metadata-eval83.4
lift-pow.f64N/A
unpow1/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.f6493.0
Applied rewrites93.0%
if -6e-175 < d < 2.3999999999999998e-182Initial program 41.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.1%
Applied rewrites64.2%
if 2.3999999999999998e-182 < d Initial program 77.0%
Applied rewrites50.6%
Applied rewrites77.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6487.6
Applied rewrites87.6%
Final simplification83.2%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D)))
(if (<= d -7.8e-174)
(*
(fma (* (* (* (- D) 0.25) (/ M d)) (/ (* (* D (/ 0.5 d)) M) l)) h 1.0)
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= d 2.4e-182)
(/
(fma
(pow (/ h l) 1.5)
(/ (* (pow (* D M) 2.0) -0.125) d)
(* (sqrt (/ h l)) d))
h)
(*
(/ (sqrt d) (sqrt h))
(* (sqrt (/ d l)) (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double tmp;
if (d <= -7.8e-174) {
tmp = fma((((-D * 0.25) * (M / d)) * (((D * (0.5 / d)) * M) / l)), h, 1.0) * (pow((d / l), (1.0 / 2.0)) * (sqrt(-d) / sqrt(-h)));
} else if (d <= 2.4e-182) {
tmp = fma(pow((h / l), 1.5), ((pow((D * M), 2.0) * -0.125) / d), (sqrt((h / l)) * d)) / h;
} else {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * fma((t_0 * (-0.125 * (h / l))), t_0, 1.0));
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) tmp = 0.0 if (d <= -7.8e-174) tmp = Float64(fma(Float64(Float64(Float64(Float64(-D) * 0.25) * Float64(M / d)) * Float64(Float64(Float64(D * Float64(0.5 / d)) * M) / l)), h, 1.0) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (d <= 2.4e-182) tmp = Float64(fma((Float64(h / l) ^ 1.5), Float64(Float64((Float64(D * M) ^ 2.0) * -0.125) / d), Float64(sqrt(Float64(h / l)) * d)) / h); else tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0))); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, If[LessEqual[d, -7.8e-174], N[(N[(N[(N[(N[((-D) * 0.25), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.4e-182], N[(N[(N[Power[N[(h / l), $MachinePrecision], 1.5], $MachinePrecision] * N[(N[(N[Power[N[(D * M), $MachinePrecision], 2.0], $MachinePrecision] * -0.125), $MachinePrecision] / d), $MachinePrecision] + N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
\mathbf{if}\;d \leq -7.8 \cdot 10^{-174}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(-D\right) \cdot 0.25\right) \cdot \frac{M}{d}\right) \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell}, h, 1\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{\mathsf{fma}\left({\left(\frac{h}{\ell}\right)}^{1.5}, \frac{{\left(D \cdot M\right)}^{2} \cdot -0.125}{d}, \sqrt{\frac{h}{\ell}} \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\right)\\
\end{array}
\end{array}
if d < -7.7999999999999997e-174Initial program 70.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/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.f6478.8
Applied rewrites78.8%
Applied rewrites84.3%
if -7.7999999999999997e-174 < d < 2.3999999999999998e-182Initial program 41.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites50.1%
Applied rewrites64.2%
if 2.3999999999999998e-182 < d Initial program 77.0%
Applied rewrites50.6%
Applied rewrites77.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.9
Applied rewrites77.9%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6487.6
Applied rewrites87.6%
Final simplification81.0%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D)) (t_1 (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0)))
(if (<= l -1e-311)
(*
(fma (* (* (* (- D) 0.25) (/ M d)) (/ (* (* D (/ 0.5 d)) M) l)) h 1.0)
(* (pow (/ d l) (/ 1.0 2.0)) (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= l 2.6e+171)
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_1))
(* (sqrt (/ d h)) (* (/ (sqrt d) (sqrt l)) t_1))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = fma((t_0 * (-0.125 * (h / l))), t_0, 1.0);
double tmp;
if (l <= -1e-311) {
tmp = fma((((-D * 0.25) * (M / d)) * (((D * (0.5 / d)) * M) / l)), h, 1.0) * (pow((d / l), (1.0 / 2.0)) * (sqrt(-d) / sqrt(-h)));
} else if (l <= 2.6e+171) {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
} else {
tmp = sqrt((d / h)) * ((sqrt(d) / sqrt(l)) * t_1);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0) tmp = 0.0 if (l <= -1e-311) tmp = Float64(fma(Float64(Float64(Float64(Float64(-D) * 0.25) * Float64(M / d)) * Float64(Float64(Float64(D * Float64(0.5 / d)) * M) / l)), h, 1.0) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (l <= 2.6e+171) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_1)); else tmp = Float64(sqrt(Float64(d / h)) * Float64(Float64(sqrt(d) / sqrt(l)) * t_1)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(N[(N[(N[(N[((-D) * 0.25), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+171], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(-D\right) \cdot 0.25\right) \cdot \frac{M}{d}\right) \cdot \frac{\left(D \cdot \frac{0.5}{d}\right) \cdot M}{\ell}, h, 1\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+171}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 63.8%
lift-pow.f64N/A
lift-/.f64N/A
metadata-evalN/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.f6471.6
Applied rewrites71.6%
Applied rewrites76.0%
if -9.99999999999948e-312 < l < 2.6e171Initial program 74.0%
Applied rewrites50.0%
Applied rewrites74.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6486.4
Applied rewrites86.4%
if 2.6e171 < l Initial program 51.1%
Applied rewrites37.4%
Applied rewrites50.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.8
Applied rewrites75.8%
Final simplification80.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1 (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0))
(t_2 (sqrt (- d)))
(t_3 (sqrt (/ d h)))
(t_4 (sqrt (/ d l))))
(if (<= l -2.85e+163)
(* (* (* (pow (- l) -0.5) t_2) t_1) t_3)
(if (<= l -5.7e-304)
(/
(*
(* (fma (* -0.5 (/ h l)) (pow (* (/ d D) (/ 2.0 M)) -2.0) 1.0) t_4)
t_2)
(sqrt (- h)))
(if (<= l 2.6e+171)
(* (/ (sqrt d) (sqrt h)) (* t_4 t_1))
(* t_3 (* (/ (sqrt d) (sqrt l)) t_1)))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = fma((t_0 * (-0.125 * (h / l))), t_0, 1.0);
double t_2 = sqrt(-d);
double t_3 = sqrt((d / h));
double t_4 = sqrt((d / l));
double tmp;
if (l <= -2.85e+163) {
tmp = ((pow(-l, -0.5) * t_2) * t_1) * t_3;
} else if (l <= -5.7e-304) {
tmp = ((fma((-0.5 * (h / l)), pow(((d / D) * (2.0 / M)), -2.0), 1.0) * t_4) * t_2) / sqrt(-h);
} else if (l <= 2.6e+171) {
tmp = (sqrt(d) / sqrt(h)) * (t_4 * t_1);
} else {
tmp = t_3 * ((sqrt(d) / sqrt(l)) * t_1);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0) t_2 = sqrt(Float64(-d)) t_3 = sqrt(Float64(d / h)) t_4 = sqrt(Float64(d / l)) tmp = 0.0 if (l <= -2.85e+163) tmp = Float64(Float64(Float64((Float64(-l) ^ -0.5) * t_2) * t_1) * t_3); elseif (l <= -5.7e-304) tmp = Float64(Float64(Float64(fma(Float64(-0.5 * Float64(h / l)), (Float64(Float64(d / D) * Float64(2.0 / M)) ^ -2.0), 1.0) * t_4) * t_2) / sqrt(Float64(-h))); elseif (l <= 2.6e+171) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(t_4 * t_1)); else tmp = Float64(t_3 * Float64(Float64(sqrt(d) / sqrt(l)) * t_1)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[(-d)], $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[l, -2.85e+163], N[(N[(N[(N[Power[(-l), -0.5], $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$3), $MachinePrecision], If[LessEqual[l, -5.7e-304], N[(N[(N[(N[(N[(-0.5 * N[(h / l), $MachinePrecision]), $MachinePrecision] * N[Power[N[(N[(d / D), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$2), $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.6e+171], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(t$95$4 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\\
t_2 := \sqrt{-d}\\
t_3 := \sqrt{\frac{d}{h}}\\
t_4 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;\ell \leq -2.85 \cdot 10^{+163}:\\
\;\;\;\;\left(\left({\left(-\ell\right)}^{-0.5} \cdot t\_2\right) \cdot t\_1\right) \cdot t\_3\\
\mathbf{elif}\;\ell \leq -5.7 \cdot 10^{-304}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(-0.5 \cdot \frac{h}{\ell}, {\left(\frac{d}{D} \cdot \frac{2}{M}\right)}^{-2}, 1\right) \cdot t\_4\right) \cdot t\_2}{\sqrt{-h}}\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+171}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(t\_4 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -2.8499999999999999e163Initial program 33.9%
Applied rewrites30.7%
Applied rewrites33.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6439.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6439.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6439.7
Applied rewrites39.7%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-sqrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-pow2N/A
metadata-evalN/A
lower-pow.f6451.0
Applied rewrites51.0%
if -2.8499999999999999e163 < l < -5.6999999999999998e-304Initial program 76.5%
Applied rewrites86.7%
if -5.6999999999999998e-304 < l < 2.6e171Initial program 73.3%
Applied rewrites49.6%
Applied rewrites73.3%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/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
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6485.6
Applied rewrites85.6%
if 2.6e171 < l Initial program 51.1%
Applied rewrites37.4%
Applied rewrites50.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.8
Applied rewrites75.8%
Final simplification80.3%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1 (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0))
(t_2 (sqrt (/ d h))))
(if (<= l -1e-311)
(* (* (* (pow (- l) -0.5) (sqrt (- d))) t_1) t_2)
(if (<= l 2.6e+171)
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_1))
(* t_2 (* (/ (sqrt d) (sqrt l)) t_1))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = fma((t_0 * (-0.125 * (h / l))), t_0, 1.0);
double t_2 = sqrt((d / h));
double tmp;
if (l <= -1e-311) {
tmp = ((pow(-l, -0.5) * sqrt(-d)) * t_1) * t_2;
} else if (l <= 2.6e+171) {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
} else {
tmp = t_2 * ((sqrt(d) / sqrt(l)) * t_1);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1e-311) tmp = Float64(Float64(Float64((Float64(-l) ^ -0.5) * sqrt(Float64(-d))) * t_1) * t_2); elseif (l <= 2.6e+171) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_1)); else tmp = Float64(t_2 * Float64(Float64(sqrt(d) / sqrt(l)) * t_1)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(N[(N[(N[Power[(-l), -0.5], $MachinePrecision] * N[Sqrt[(-d)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, 2.6e+171], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\left({\left(-\ell\right)}^{-0.5} \cdot \sqrt{-d}\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+171}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 63.8%
Applied rewrites40.6%
Applied rewrites63.7%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6465.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-sqrt.f64N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
inv-powN/A
lift-sqrt.f64N/A
sqrt-pow2N/A
metadata-evalN/A
lower-pow.f6470.6
Applied rewrites70.6%
if -9.99999999999948e-312 < l < 2.6e171Initial program 74.0%
Applied rewrites50.0%
Applied rewrites74.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6486.4
Applied rewrites86.4%
if 2.6e171 < l Initial program 51.1%
Applied rewrites37.4%
Applied rewrites50.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.8
Applied rewrites75.8%
Final simplification77.8%
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ M d) D))
(t_1 (fma (* t_0 (* -0.125 (/ h l))) t_0 1.0))
(t_2 (sqrt (/ d h))))
(if (<= l -1e-311)
(* (* (/ (sqrt (- d)) (sqrt (- l))) t_1) t_2)
(if (<= l 2.6e+171)
(* (/ (sqrt d) (sqrt h)) (* (sqrt (/ d l)) t_1))
(* t_2 (* (/ (sqrt d) (sqrt l)) t_1))))))
double code(double d, double h, double l, double M, double D) {
double t_0 = (M / d) * D;
double t_1 = fma((t_0 * (-0.125 * (h / l))), t_0, 1.0);
double t_2 = sqrt((d / h));
double tmp;
if (l <= -1e-311) {
tmp = ((sqrt(-d) / sqrt(-l)) * t_1) * t_2;
} else if (l <= 2.6e+171) {
tmp = (sqrt(d) / sqrt(h)) * (sqrt((d / l)) * t_1);
} else {
tmp = t_2 * ((sqrt(d) / sqrt(l)) * t_1);
}
return tmp;
}
function code(d, h, l, M, D) t_0 = Float64(Float64(M / d) * D) t_1 = fma(Float64(t_0 * Float64(-0.125 * Float64(h / l))), t_0, 1.0) t_2 = sqrt(Float64(d / h)) tmp = 0.0 if (l <= -1e-311) tmp = Float64(Float64(Float64(sqrt(Float64(-d)) / sqrt(Float64(-l))) * t_1) * t_2); elseif (l <= 2.6e+171) tmp = Float64(Float64(sqrt(d) / sqrt(h)) * Float64(sqrt(Float64(d / l)) * t_1)); else tmp = Float64(t_2 * Float64(Float64(sqrt(d) / sqrt(l)) * t_1)); end return tmp end
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M / d), $MachinePrecision] * D), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(-0.125 * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1e-311], N[(N[(N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[l, 2.6e+171], N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{M}{d} \cdot D\\
t_1 := \mathsf{fma}\left(t\_0 \cdot \left(-0.125 \cdot \frac{h}{\ell}\right), t\_0, 1\right)\\
t_2 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;\ell \leq -1 \cdot 10^{-311}:\\
\;\;\;\;\left(\frac{\sqrt{-d}}{\sqrt{-\ell}} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;\ell \leq 2.6 \cdot 10^{+171}:\\
\;\;\;\;\frac{\sqrt{d}}{\sqrt{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(\frac{\sqrt{d}}{\sqrt{\ell}} \cdot t\_1\right)\\
\end{array}
\end{array}
if l < -9.99999999999948e-312Initial program 63.8%
Applied rewrites40.6%
Applied rewrites63.7%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6465.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6465.5
Applied rewrites65.5%
lift-sqrt.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-sqrt.f64N/A
lower-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6470.4
Applied rewrites70.4%
if -9.99999999999948e-312 < l < 2.6e171Initial program 74.0%
Applied rewrites50.0%
Applied rewrites74.0%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.0
Applied rewrites74.0%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6486.4
Applied rewrites86.4%
if 2.6e171 < l Initial program 51.1%
Applied rewrites37.4%
Applied rewrites50.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-pow.f64N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
metadata-evalN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6453.7
Applied rewrites53.7%
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.8
Applied rewrites75.8%
Final simplification77.7%
(FPCore (d h l M D) :precision binary64 (if (<= l 4.5e-245) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (* (sqrt l) (sqrt h)))))
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4.5e-245) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
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
real(8) :: tmp
if (l <= 4.5d-245) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 4.5e-245) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
def code(d, h, l, M, D): tmp = 0 if l <= 4.5e-245: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
function code(d, h, l, M, D) tmp = 0.0 if (l <= 4.5e-245) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
function tmp_2 = code(d, h, l, M, D) tmp = 0.0; if (l <= 4.5e-245) tmp = sqrt((1.0 / (l * h))) * -d; else tmp = d / (sqrt(l) * sqrt(h)); end tmp_2 = tmp; end
code[d_, h_, l_, M_, D_] := If[LessEqual[l, 4.5e-245], 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}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 4.5 \cdot 10^{-245}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 4.49999999999999969e-245Initial program 64.4%
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-*.f6437.7
Applied rewrites37.7%
if 4.49999999999999969e-245 < l Initial program 69.0%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.7
Applied rewrites42.7%
Applied rewrites42.9%
Applied rewrites50.5%
Final simplification43.8%
(FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
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 / sqrt((l * h))
end function
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
def code(d, h, l, M, D): return d / math.sqrt((l * h))
function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
function tmp = code(d, h, l, M, D) tmp = d / sqrt((l * h)); end
code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 66.6%
Taylor expanded in h around 0
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6427.3
Applied rewrites27.3%
Applied rewrites27.0%
herbie shell --seed 2024255
(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)))))