
(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 18 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}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l))))
(t_1 (/ (* M D) d))
(t_2 (* (/ (* D M) d) 0.5))
(t_3
(*
(* (pow (sqrt (/ h d)) -1.0) (sqrt (/ d l)))
(fma (* (/ t_2 -1.0) (/ (* t_2 0.5) l)) h 1.0))))
(if (<= d -2.1e+107)
(*
(* (- d) (sqrt (pow (* l h) -1.0)))
(fma (/ (* -0.5 (pow (* (/ d M) (/ 2.0 D)) -2.0)) l) h 1.0))
(if (<= d -1.02e-47)
t_3
(if (<= d 1.1e-272)
(/
(* (sqrt (/ h l)) (fma (/ h l) (/ (* -0.125 (pow (* M D) 2.0)) d) d))
h)
(if (<= d 6.3e-86)
(fma (* t_0 (* -0.5 t_1)) (* h (/ (* 0.25 t_1) l)) t_0)
t_3))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((h * l));
double t_1 = (M * D) / d;
double t_2 = ((D * M) / d) * 0.5;
double t_3 = (pow(sqrt((h / d)), -1.0) * sqrt((d / l))) * fma(((t_2 / -1.0) * ((t_2 * 0.5) / l)), h, 1.0);
double tmp;
if (d <= -2.1e+107) {
tmp = (-d * sqrt(pow((l * h), -1.0))) * fma(((-0.5 * pow(((d / M) * (2.0 / D)), -2.0)) / l), h, 1.0);
} else if (d <= -1.02e-47) {
tmp = t_3;
} else if (d <= 1.1e-272) {
tmp = (sqrt((h / l)) * fma((h / l), ((-0.125 * pow((M * D), 2.0)) / d), d)) / h;
} else if (d <= 6.3e-86) {
tmp = fma((t_0 * (-0.5 * t_1)), (h * ((0.25 * t_1) / l)), t_0);
} else {
tmp = t_3;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(h * l))) t_1 = Float64(Float64(M * D) / d) t_2 = Float64(Float64(Float64(D * M) / d) * 0.5) t_3 = Float64(Float64((sqrt(Float64(h / d)) ^ -1.0) * sqrt(Float64(d / l))) * fma(Float64(Float64(t_2 / -1.0) * Float64(Float64(t_2 * 0.5) / l)), h, 1.0)) tmp = 0.0 if (d <= -2.1e+107) tmp = Float64(Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))) * fma(Float64(Float64(-0.5 * (Float64(Float64(d / M) * Float64(2.0 / D)) ^ -2.0)) / l), h, 1.0)); elseif (d <= -1.02e-47) tmp = t_3; elseif (d <= 1.1e-272) tmp = Float64(Float64(sqrt(Float64(h / l)) * fma(Float64(h / l), Float64(Float64(-0.125 * (Float64(M * D) ^ 2.0)) / d), d)) / h); elseif (d <= 6.3e-86) tmp = fma(Float64(t_0 * Float64(-0.5 * t_1)), Float64(h * Float64(Float64(0.25 * t_1) / l)), t_0); else tmp = t_3; end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$2 / -1.0), $MachinePrecision] * N[(N[(t$95$2 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.1e+107], N[(N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[Power[N[(N[(d / M), $MachinePrecision] * N[(2.0 / D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.02e-47], t$95$3, If[LessEqual[d, 1.1e-272], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[(-0.125 * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 6.3e-86], N[(N[(t$95$0 * N[(-0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$1), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], t$95$3]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_1 := \frac{M \cdot D}{d}\\
t_2 := \frac{D \cdot M}{d} \cdot 0.5\\
t_3 := \left({\left(\sqrt{\frac{h}{d}}\right)}^{-1} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_2}{-1} \cdot \frac{t\_2 \cdot 0.5}{\ell}, h, 1\right)\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{+107}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \mathsf{fma}\left(\frac{-0.5 \cdot {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}}{\ell}, h, 1\right)\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-272}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h}\\
\mathbf{elif}\;d \leq 6.3 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(-0.5 \cdot t\_1\right), h \cdot \frac{0.25 \cdot t\_1}{\ell}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if d < -2.1e107Initial program 67.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites77.9%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6477.9
Applied rewrites77.9%
Taylor expanded in h 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-*.f6492.2
Applied rewrites92.2%
if -2.1e107 < d < -1.02000000000000002e-47 or 6.2999999999999999e-86 < d Initial program 81.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites86.2%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6486.2
Applied rewrites86.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites87.1%
lift-/.f64N/A
metadata-eval87.1
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6488.7
Applied rewrites88.7%
if -1.02000000000000002e-47 < d < 1.09999999999999994e-272Initial program 46.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites44.7%
Applied rewrites50.7%
Applied rewrites75.7%
if 1.09999999999999994e-272 < d < 6.2999999999999999e-86Initial program 37.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites37.6%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6437.6
Applied rewrites37.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites37.9%
Applied rewrites76.9%
Final simplification84.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (* D M) d) 0.5))
(t_1
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (sqrt (/ h l)))
(t_3 (* t_2 d))
(t_4 (sqrt (/ d l)))
(t_5 (sqrt (/ d h))))
(if (<= t_1 (- INFINITY))
(* (* (/ (fma (/ M d) (* (/ M d) (* (* (* D D) -0.125) h)) l) l) t_4) t_5)
(if (<= t_1 -5e-89)
(* (fma t_0 (* t_0 (* (/ h l) -0.5)) 1.0) (sqrt (* (/ (/ d l) h) d)))
(if (<= t_1 0.0)
(/ d (sqrt (* l h)))
(if (<= t_1 5e+253)
(* t_4 t_5)
(if (<= t_1 INFINITY)
(/ t_3 h)
(/
(fma (* (* (/ (* D D) d) M) (* -0.125 M)) (* (/ h l) t_2) t_3)
h))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = ((D * M) / d) * 0.5;
double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = sqrt((h / l));
double t_3 = t_2 * d;
double t_4 = sqrt((d / l));
double t_5 = sqrt((d / h));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = ((fma((M / d), ((M / d) * (((D * D) * -0.125) * h)), l) / l) * t_4) * t_5;
} else if (t_1 <= -5e-89) {
tmp = fma(t_0, (t_0 * ((h / l) * -0.5)), 1.0) * sqrt((((d / l) / h) * d));
} else if (t_1 <= 0.0) {
tmp = d / sqrt((l * h));
} else if (t_1 <= 5e+253) {
tmp = t_4 * t_5;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_3 / h;
} else {
tmp = fma(((((D * D) / d) * M) * (-0.125 * M)), ((h / l) * t_2), t_3) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(Float64(D * M) / d) * 0.5) t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = sqrt(Float64(h / l)) t_3 = Float64(t_2 * d) t_4 = sqrt(Float64(d / l)) t_5 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(fma(Float64(M / d), Float64(Float64(M / d) * Float64(Float64(Float64(D * D) * -0.125) * h)), l) / l) * t_4) * t_5); elseif (t_1 <= -5e-89) tmp = Float64(fma(t_0, Float64(t_0 * Float64(Float64(h / l) * -0.5)), 1.0) * sqrt(Float64(Float64(Float64(d / l) / h) * d))); elseif (t_1 <= 0.0) tmp = Float64(d / sqrt(Float64(l * h))); elseif (t_1 <= 5e+253) tmp = Float64(t_4 * t_5); elseif (t_1 <= Inf) tmp = Float64(t_3 / h); else tmp = Float64(fma(Float64(Float64(Float64(Float64(D * D) / d) * M) * Float64(-0.125 * M)), Float64(Float64(h / l) * t_2), t_3) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * d), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$5), $MachinePrecision], If[LessEqual[t$95$1, -5e-89], N[(N[(t$95$0 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+253], N[(t$95$4 * t$95$5), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$3 / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] + t$95$3), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D \cdot M}{d} \cdot 0.5\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{h}{\ell}}\\
t_3 := t\_2 \cdot d\\
t_4 := \sqrt{\frac{d}{\ell}}\\
t_5 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{M}{d}, \frac{M}{d} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot h\right), \ell\right)}{\ell} \cdot t\_4\right) \cdot t\_5\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;t\_4 \cdot t\_5\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{t\_3}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot \left(-0.125 \cdot M\right), \frac{h}{\ell} \cdot t\_2, t\_3\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0Initial program 84.6%
Applied rewrites40.5%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6435.6
Applied rewrites35.6%
Applied rewrites73.0%
Applied rewrites79.6%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999967e-89Initial program 98.4%
Applied rewrites67.3%
lift-fma.f64N/A
*-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*l*N/A
Applied rewrites67.8%
if -4.99999999999999967e-89 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 39.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Applied rewrites57.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e253Initial program 98.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied rewrites38.3%
Applied rewrites98.4%
if 4.9999999999999997e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 50.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites37.0%
Taylor expanded in d around inf
Applied rewrites70.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.0%
Applied rewrites18.1%
Applied rewrites20.4%
Final simplification69.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (sqrt (/ h l)))
(t_4 (* t_3 d)))
(if (<= t_0 -5e-89)
(* (* (/ (fma (/ M d) (* (/ M d) (* (* (* D D) -0.125) h)) l) l) t_1) t_2)
(if (<= t_0 0.0)
(/ d (sqrt (* l h)))
(if (<= t_0 5e+253)
(* t_1 t_2)
(if (<= t_0 INFINITY)
(/ t_4 h)
(/
(fma (* (* (/ (* D D) d) M) (* -0.125 M)) (* (/ h l) t_3) t_4)
h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = sqrt((h / l));
double t_4 = t_3 * d;
double tmp;
if (t_0 <= -5e-89) {
tmp = ((fma((M / d), ((M / d) * (((D * D) * -0.125) * h)), l) / l) * t_1) * t_2;
} else if (t_0 <= 0.0) {
tmp = d / sqrt((l * h));
} else if (t_0 <= 5e+253) {
tmp = t_1 * t_2;
} else if (t_0 <= ((double) INFINITY)) {
tmp = t_4 / h;
} else {
tmp = fma(((((D * D) / d) * M) * (-0.125 * M)), ((h / l) * t_3), t_4) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = sqrt(Float64(h / l)) t_4 = Float64(t_3 * d) tmp = 0.0 if (t_0 <= -5e-89) tmp = Float64(Float64(Float64(fma(Float64(M / d), Float64(Float64(M / d) * Float64(Float64(Float64(D * D) * -0.125) * h)), l) / l) * t_1) * t_2); elseif (t_0 <= 0.0) tmp = Float64(d / sqrt(Float64(l * h))); elseif (t_0 <= 5e+253) tmp = Float64(t_1 * t_2); elseif (t_0 <= Inf) tmp = Float64(t_4 / h); else tmp = Float64(fma(Float64(Float64(Float64(Float64(D * D) / d) * M) * Float64(-0.125 * M)), Float64(Float64(h / l) * t_3), t_4) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * d), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-89], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+253], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(t$95$4 / h), $MachinePrecision], N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$3), $MachinePrecision] + t$95$4), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{\frac{h}{\ell}}\\
t_4 := t\_3 \cdot d\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-89}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{M}{d}, \frac{M}{d} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot h\right), \ell\right)}{\ell} \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{t\_4}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot \left(-0.125 \cdot M\right), \frac{h}{\ell} \cdot t\_3, t\_4\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -4.99999999999999967e-89Initial program 87.6%
Applied rewrites42.0%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6432.1
Applied rewrites32.1%
Applied rewrites66.5%
Applied rewrites71.7%
if -4.99999999999999967e-89 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 39.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6457.4
Applied rewrites57.4%
Applied rewrites57.5%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e253Initial program 98.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied rewrites38.3%
Applied rewrites98.4%
if 4.9999999999999997e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 50.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites37.0%
Taylor expanded in d around inf
Applied rewrites70.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.0%
Applied rewrites18.1%
Applied rewrites20.4%
Final simplification67.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (* D D) d))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (* -0.125 (* M M)))
(t_4 (sqrt (/ h l)))
(t_5 (* (/ h l) t_4))
(t_6
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_7 (* t_4 d)))
(if (<= t_6 (- INFINITY))
(* (* (* (/ h (* l d)) (* t_3 t_0)) t_1) t_2)
(if (<= t_6 1e-264)
(/ (fma (* D (* (/ D d) t_3)) t_5 t_7) h)
(if (<= t_6 5e+253)
(* t_1 t_2)
(if (<= t_6 INFINITY)
(/ t_7 h)
(/ (fma (* (* t_0 M) (* -0.125 M)) t_5 t_7) h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (D * D) / d;
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = -0.125 * (M * M);
double t_4 = sqrt((h / l));
double t_5 = (h / l) * t_4;
double t_6 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_7 = t_4 * d;
double tmp;
if (t_6 <= -((double) INFINITY)) {
tmp = (((h / (l * d)) * (t_3 * t_0)) * t_1) * t_2;
} else if (t_6 <= 1e-264) {
tmp = fma((D * ((D / d) * t_3)), t_5, t_7) / h;
} else if (t_6 <= 5e+253) {
tmp = t_1 * t_2;
} else if (t_6 <= ((double) INFINITY)) {
tmp = t_7 / h;
} else {
tmp = fma(((t_0 * M) * (-0.125 * M)), t_5, t_7) / h;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(D * D) / d) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = Float64(-0.125 * Float64(M * M)) t_4 = sqrt(Float64(h / l)) t_5 = Float64(Float64(h / l) * t_4) t_6 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_7 = Float64(t_4 * d) tmp = 0.0 if (t_6 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(h / Float64(l * d)) * Float64(t_3 * t_0)) * t_1) * t_2); elseif (t_6 <= 1e-264) tmp = Float64(fma(Float64(D * Float64(Float64(D / d) * t_3)), t_5, t_7) / h); elseif (t_6 <= 5e+253) tmp = Float64(t_1 * t_2); elseif (t_6 <= Inf) tmp = Float64(t_7 / h); else tmp = Float64(fma(Float64(Float64(t_0 * M) * Float64(-0.125 * M)), t_5, t_7) / h); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(D * D), $MachinePrecision] / d), $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[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(h / l), $MachinePrecision] * t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$4 * d), $MachinePrecision]}, If[LessEqual[t$95$6, (-Infinity)], N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$6, 1e-264], N[(N[(N[(D * N[(N[(D / d), $MachinePrecision] * t$95$3), $MachinePrecision]), $MachinePrecision] * t$95$5 + t$95$7), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[t$95$6, 5e+253], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$6, Infinity], N[(t$95$7 / h), $MachinePrecision], N[(N[(N[(N[(t$95$0 * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * t$95$5 + t$95$7), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D \cdot D}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := -0.125 \cdot \left(M \cdot M\right)\\
t_4 := \sqrt{\frac{h}{\ell}}\\
t_5 := \frac{h}{\ell} \cdot t\_4\\
t_6 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_7 := t\_4 \cdot d\\
\mathbf{if}\;t\_6 \leq -\infty:\\
\;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(t\_3 \cdot t\_0\right)\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_6 \leq 10^{-264}:\\
\;\;\;\;\frac{\mathsf{fma}\left(D \cdot \left(\frac{D}{d} \cdot t\_3\right), t\_5, t\_7\right)}{h}\\
\mathbf{elif}\;t\_6 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_6 \leq \infty:\\
\;\;\;\;\frac{t\_7}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(t\_0 \cdot M\right) \cdot \left(-0.125 \cdot M\right), t\_5, t\_7\right)}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -inf.0Initial program 84.6%
Applied rewrites40.5%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6435.6
Applied rewrites35.6%
Applied rewrites73.0%
Taylor expanded in d around 0
associate-*r*N/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
Applied rewrites70.0%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e-264Initial program 67.2%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites31.4%
Applied rewrites39.1%
Applied rewrites49.5%
if 1e-264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e253Initial program 98.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites98.4%
if 4.9999999999999997e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 50.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites37.0%
Taylor expanded in d around inf
Applied rewrites70.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.0%
Applied rewrites18.1%
Applied rewrites20.4%
Final simplification65.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ d h)))
(t_3 (sqrt (/ h l))))
(if (<= t_0 -1e-77)
(* (* (* (/ h (* l d)) (* (* -0.125 (* M M)) (/ (* D D) d))) t_1) t_2)
(if (<= t_0 0.0)
(/ d (sqrt (* l h)))
(if (<= t_0 5e+253)
(* t_1 t_2)
(if (<= t_0 INFINITY) (/ (* t_3 d) h) (/ (* (- d) t_3) h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = sqrt((d / l));
double t_2 = sqrt((d / h));
double t_3 = sqrt((h / l));
double tmp;
if (t_0 <= -1e-77) {
tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
} else if (t_0 <= 0.0) {
tmp = d / sqrt((l * h));
} else if (t_0 <= 5e+253) {
tmp = t_1 * t_2;
} else if (t_0 <= ((double) INFINITY)) {
tmp = (t_3 * d) / h;
} else {
tmp = (-d * t_3) / h;
}
return tmp;
}
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double t_0 = (Math.pow((d / h), Math.pow(2.0, -1.0)) * Math.pow((d / l), Math.pow(2.0, -1.0))) * (1.0 - ((Math.pow(2.0, -1.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_1 = Math.sqrt((d / l));
double t_2 = Math.sqrt((d / h));
double t_3 = Math.sqrt((h / l));
double tmp;
if (t_0 <= -1e-77) {
tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
} else if (t_0 <= 0.0) {
tmp = d / Math.sqrt((l * h));
} else if (t_0 <= 5e+253) {
tmp = t_1 * t_2;
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (t_3 * d) / h;
} else {
tmp = (-d * t_3) / h;
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): t_0 = (math.pow((d / h), math.pow(2.0, -1.0)) * math.pow((d / l), math.pow(2.0, -1.0))) * (1.0 - ((math.pow(2.0, -1.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l))) t_1 = math.sqrt((d / l)) t_2 = math.sqrt((d / h)) t_3 = math.sqrt((h / l)) tmp = 0 if t_0 <= -1e-77: tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2 elif t_0 <= 0.0: tmp = d / math.sqrt((l * h)) elif t_0 <= 5e+253: tmp = t_1 * t_2 elif t_0 <= math.inf: tmp = (t_3 * d) / h else: tmp = (-d * t_3) / h return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(d / h)) t_3 = sqrt(Float64(h / l)) tmp = 0.0 if (t_0 <= -1e-77) tmp = Float64(Float64(Float64(Float64(h / Float64(l * d)) * Float64(Float64(-0.125 * Float64(M * M)) * Float64(Float64(D * D) / d))) * t_1) * t_2); elseif (t_0 <= 0.0) tmp = Float64(d / sqrt(Float64(l * h))); elseif (t_0 <= 5e+253) tmp = Float64(t_1 * t_2); elseif (t_0 <= Inf) tmp = Float64(Float64(t_3 * d) / h); else tmp = Float64(Float64(Float64(-d) * t_3) / h); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
t_0 = (((d / h) ^ (2.0 ^ -1.0)) * ((d / l) ^ (2.0 ^ -1.0))) * (1.0 - (((2.0 ^ -1.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l)));
t_1 = sqrt((d / l));
t_2 = sqrt((d / h));
t_3 = sqrt((h / l));
tmp = 0.0;
if (t_0 <= -1e-77)
tmp = (((h / (l * d)) * ((-0.125 * (M * M)) * ((D * D) / d))) * t_1) * t_2;
elseif (t_0 <= 0.0)
tmp = d / sqrt((l * h));
elseif (t_0 <= 5e+253)
tmp = t_1 * t_2;
elseif (t_0 <= Inf)
tmp = (t_3 * d) / h;
else
tmp = (-d * t_3) / h;
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, -1e-77], N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+253], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(t$95$3 * d), $MachinePrecision] / h), $MachinePrecision], N[(N[((-d) * t$95$3), $MachinePrecision] / h), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{d}{h}}\\
t_3 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-77}:\\
\;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot \frac{D \cdot D}{d}\right)\right) \cdot t\_1\right) \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+253}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{t\_3 \cdot d}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-d\right) \cdot t\_3}{h}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -9.9999999999999993e-78Initial program 87.5%
Applied rewrites41.3%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6432.4
Applied rewrites32.4%
Applied rewrites66.1%
Taylor expanded in d around 0
associate-*r*N/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
Applied rewrites61.4%
if -9.9999999999999993e-78 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 0.0Initial program 41.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6454.8
Applied rewrites54.8%
Applied rewrites54.9%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e253Initial program 98.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied rewrites38.3%
Applied rewrites98.4%
if 4.9999999999999997e253 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < +inf.0Initial program 50.1%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites37.0%
Taylor expanded in d around inf
Applied rewrites70.7%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites18.0%
Taylor expanded in l around -inf
Applied rewrites17.5%
Final simplification63.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* -0.125 (* M M)))
(t_1
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (pow (/ d l) (pow 2.0 -1.0)))
(-
1.0
(* (* (pow 2.0 -1.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
(t_2 (sqrt (/ h l)))
(t_3 (sqrt (/ d l)))
(t_4 (sqrt (/ d h))))
(if (<= t_1 (- INFINITY))
(* (* (* (/ h (* l d)) (* t_0 (/ (* D D) d))) t_3) t_4)
(if (or (<= t_1 1e-264) (not (<= t_1 5e+253)))
(/ (fma (* D (* (/ D d) t_0)) (* (/ h l) t_2) (* t_2 d)) h)
(* t_3 t_4)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = -0.125 * (M * M);
double t_1 = (pow((d / h), pow(2.0, -1.0)) * pow((d / l), pow(2.0, -1.0))) * (1.0 - ((pow(2.0, -1.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
double t_2 = sqrt((h / l));
double t_3 = sqrt((d / l));
double t_4 = sqrt((d / h));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (((h / (l * d)) * (t_0 * ((D * D) / d))) * t_3) * t_4;
} else if ((t_1 <= 1e-264) || !(t_1 <= 5e+253)) {
tmp = fma((D * ((D / d) * t_0)), ((h / l) * t_2), (t_2 * d)) / h;
} else {
tmp = t_3 * t_4;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(-0.125 * Float64(M * M)) t_1 = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * (Float64(d / l) ^ (2.0 ^ -1.0))) * Float64(1.0 - Float64(Float64((2.0 ^ -1.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) t_2 = sqrt(Float64(h / l)) t_3 = sqrt(Float64(d / l)) t_4 = sqrt(Float64(d / h)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(h / Float64(l * d)) * Float64(t_0 * Float64(Float64(D * D) / d))) * t_3) * t_4); elseif ((t_1 <= 1e-264) || !(t_1 <= 5e+253)) tmp = Float64(fma(Float64(D * Float64(Float64(D / d) * t_0)), Float64(Float64(h / l) * t_2), Float64(t_2 * d)) / h); else tmp = Float64(t_3 * t_4); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[Power[2.0, -1.0], $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(h / N[(l * d), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision] * t$95$4), $MachinePrecision], If[Or[LessEqual[t$95$1, 1e-264], N[Not[LessEqual[t$95$1, 5e+253]], $MachinePrecision]], N[(N[(N[(D * N[(N[(D / d), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$2 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(t$95$3 * t$95$4), $MachinePrecision]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := -0.125 \cdot \left(M \cdot M\right)\\
t_1 := \left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left({2}^{-1}\right)}\right) \cdot \left(1 - \left({2}^{-1} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)\\
t_2 := \sqrt{\frac{h}{\ell}}\\
t_3 := \sqrt{\frac{d}{\ell}}\\
t_4 := \sqrt{\frac{d}{h}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(\left(\frac{h}{\ell \cdot d} \cdot \left(t\_0 \cdot \frac{D \cdot D}{d}\right)\right) \cdot t\_3\right) \cdot t\_4\\
\mathbf{elif}\;t\_1 \leq 10^{-264} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+253}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(D \cdot \left(\frac{D}{d} \cdot t\_0\right), \frac{h}{\ell} \cdot t\_2, t\_2 \cdot d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot 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)))) < -inf.0Initial program 84.6%
Applied rewrites40.5%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6435.6
Applied rewrites35.6%
Applied rewrites73.0%
Taylor expanded in d around 0
associate-*r*N/A
associate-*l/N/A
associate-*l*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
times-fracN/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
Applied rewrites70.0%
if -inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 1e-264 or 4.9999999999999997e253 < (*.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 33.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites27.0%
Applied rewrites32.8%
Applied rewrites37.0%
if 1e-264 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999997e253Initial program 98.6%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites98.4%
Final simplification62.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (* D M) d) 0.5)))
(if (<= d -9.5e-71)
(*
(* (pow (/ d h) (pow 2.0 -1.0)) (/ (sqrt (- d)) (sqrt (- l))))
(fma (* (/ t_0 -1.0) (/ (* t_0 0.5) l)) h 1.0))
(if (<= d 7.5e-189)
(/
(* (sqrt (/ h l)) (fma (/ h l) (/ (* -0.125 (pow (* M D) 2.0)) d) d))
h)
(/
(*
(fma (* (/ h l) -0.5) (* 0.25 (pow (/ d (* D M)) -2.0)) 1.0)
(/ d (sqrt l)))
(sqrt h))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = ((D * M) / d) * 0.5;
double tmp;
if (d <= -9.5e-71) {
tmp = (pow((d / h), pow(2.0, -1.0)) * (sqrt(-d) / sqrt(-l))) * fma(((t_0 / -1.0) * ((t_0 * 0.5) / l)), h, 1.0);
} else if (d <= 7.5e-189) {
tmp = (sqrt((h / l)) * fma((h / l), ((-0.125 * pow((M * D), 2.0)) / d), d)) / h;
} else {
tmp = (fma(((h / l) * -0.5), (0.25 * pow((d / (D * M)), -2.0)), 1.0) * (d / sqrt(l))) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(Float64(D * M) / d) * 0.5) tmp = 0.0 if (d <= -9.5e-71) tmp = Float64(Float64((Float64(d / h) ^ (2.0 ^ -1.0)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-l)))) * fma(Float64(Float64(t_0 / -1.0) * Float64(Float64(t_0 * 0.5) / l)), h, 1.0)); elseif (d <= 7.5e-189) tmp = Float64(Float64(sqrt(Float64(h / l)) * fma(Float64(h / l), Float64(Float64(-0.125 * (Float64(M * D) ^ 2.0)) / d), d)) / h); else tmp = Float64(Float64(fma(Float64(Float64(h / l) * -0.5), Float64(0.25 * (Float64(d / Float64(D * M)) ^ -2.0)), 1.0) * Float64(d / sqrt(l))) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[d, -9.5e-71], N[(N[(N[Power[N[(d / h), $MachinePrecision], N[Power[2.0, -1.0], $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 / -1.0), $MachinePrecision] * N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e-189], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[(-0.125 * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[(0.25 * N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D \cdot M}{d} \cdot 0.5\\
\mathbf{if}\;d \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;\left({\left(\frac{d}{h}\right)}^{\left({2}^{-1}\right)} \cdot \frac{\sqrt{-d}}{\sqrt{-\ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_0}{-1} \cdot \frac{t\_0 \cdot 0.5}{\ell}, h, 1\right)\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, 0.25 \cdot {\left(\frac{d}{D \cdot M}\right)}^{-2}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -9.4999999999999994e-71Initial program 74.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites82.7%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6482.7
Applied rewrites82.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites82.8%
lift-sqrt.f64N/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.f6489.3
Applied rewrites89.3%
if -9.4999999999999994e-71 < d < 7.50000000000000042e-189Initial program 40.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites40.1%
Applied rewrites45.4%
Applied rewrites73.6%
if 7.50000000000000042e-189 < d Initial program 74.8%
Applied rewrites81.9%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites86.6%
Final simplification83.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (* D M) d) 0.5)))
(if (<= d -2.1e+107)
(*
(* (- d) (sqrt (pow (* l h) -1.0)))
(fma (/ (* -0.5 (pow (* (/ d M) (/ 2.0 D)) -2.0)) l) h 1.0))
(if (<= d -1.02e-47)
(*
(* (pow (sqrt (/ h d)) -1.0) (sqrt (/ d l)))
(fma (* (/ t_0 -1.0) (/ (* t_0 0.5) l)) h 1.0))
(if (<= d 7.5e-189)
(/
(* (sqrt (/ h l)) (fma (/ h l) (/ (* -0.125 (pow (* M D) 2.0)) d) d))
h)
(/
(*
(fma (* (/ h l) -0.5) (* 0.25 (pow (/ d (* D M)) -2.0)) 1.0)
(/ d (sqrt l)))
(sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = ((D * M) / d) * 0.5;
double tmp;
if (d <= -2.1e+107) {
tmp = (-d * sqrt(pow((l * h), -1.0))) * fma(((-0.5 * pow(((d / M) * (2.0 / D)), -2.0)) / l), h, 1.0);
} else if (d <= -1.02e-47) {
tmp = (pow(sqrt((h / d)), -1.0) * sqrt((d / l))) * fma(((t_0 / -1.0) * ((t_0 * 0.5) / l)), h, 1.0);
} else if (d <= 7.5e-189) {
tmp = (sqrt((h / l)) * fma((h / l), ((-0.125 * pow((M * D), 2.0)) / d), d)) / h;
} else {
tmp = (fma(((h / l) * -0.5), (0.25 * pow((d / (D * M)), -2.0)), 1.0) * (d / sqrt(l))) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(Float64(D * M) / d) * 0.5) tmp = 0.0 if (d <= -2.1e+107) tmp = Float64(Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))) * fma(Float64(Float64(-0.5 * (Float64(Float64(d / M) * Float64(2.0 / D)) ^ -2.0)) / l), h, 1.0)); elseif (d <= -1.02e-47) tmp = Float64(Float64((sqrt(Float64(h / d)) ^ -1.0) * sqrt(Float64(d / l))) * fma(Float64(Float64(t_0 / -1.0) * Float64(Float64(t_0 * 0.5) / l)), h, 1.0)); elseif (d <= 7.5e-189) tmp = Float64(Float64(sqrt(Float64(h / l)) * fma(Float64(h / l), Float64(Float64(-0.125 * (Float64(M * D) ^ 2.0)) / d), d)) / h); else tmp = Float64(Float64(fma(Float64(Float64(h / l) * -0.5), Float64(0.25 * (Float64(d / Float64(D * M)) ^ -2.0)), 1.0) * Float64(d / sqrt(l))) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[d, -2.1e+107], N[(N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.5 * N[Power[N[(N[(d / M), $MachinePrecision] * N[(2.0 / D), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] / l), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.02e-47], N[(N[(N[Power[N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$0 / -1.0), $MachinePrecision] * N[(N[(t$95$0 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 7.5e-189], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[(-0.125 * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * N[(0.25 * N[Power[N[(d / N[(D * M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D \cdot M}{d} \cdot 0.5\\
\mathbf{if}\;d \leq -2.1 \cdot 10^{+107}:\\
\;\;\;\;\left(\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\right) \cdot \mathsf{fma}\left(\frac{-0.5 \cdot {\left(\frac{d}{M} \cdot \frac{2}{D}\right)}^{-2}}{\ell}, h, 1\right)\\
\mathbf{elif}\;d \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;\left({\left(\sqrt{\frac{h}{d}}\right)}^{-1} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_0}{-1} \cdot \frac{t\_0 \cdot 0.5}{\ell}, h, 1\right)\\
\mathbf{elif}\;d \leq 7.5 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{h}{\ell} \cdot -0.5, 0.25 \cdot {\left(\frac{d}{D \cdot M}\right)}^{-2}, 1\right) \cdot \frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.1e107Initial program 67.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites77.9%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6477.9
Applied rewrites77.9%
Taylor expanded in h 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-*.f6492.2
Applied rewrites92.2%
if -2.1e107 < d < -1.02000000000000002e-47Initial program 77.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites85.4%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6485.4
Applied rewrites85.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites87.8%
lift-/.f64N/A
metadata-eval87.8
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6487.9
Applied rewrites87.9%
if -1.02000000000000002e-47 < d < 7.50000000000000042e-189Initial program 44.4%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites40.1%
Applied rewrites47.6%
Applied rewrites75.3%
if 7.50000000000000042e-189 < d Initial program 74.8%
Applied rewrites81.9%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
lift-pow.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites86.6%
Final simplification84.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l))))
(t_1 (* (/ (* D M) d) 0.5))
(t_2 (/ (* M D) d))
(t_3
(*
(* (pow (sqrt (/ h d)) -1.0) (sqrt (/ d l)))
(fma (* (/ t_1 -1.0) (/ (* t_1 0.5) l)) h 1.0))))
(if (<= d -1.02e-47)
t_3
(if (<= d 1.1e-272)
(/
(* (sqrt (/ h l)) (fma (/ h l) (/ (* -0.125 (pow (* M D) 2.0)) d) d))
h)
(if (<= d 6.3e-86)
(fma (* t_0 (* -0.5 t_2)) (* h (/ (* 0.25 t_2) l)) t_0)
t_3)))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((h * l));
double t_1 = ((D * M) / d) * 0.5;
double t_2 = (M * D) / d;
double t_3 = (pow(sqrt((h / d)), -1.0) * sqrt((d / l))) * fma(((t_1 / -1.0) * ((t_1 * 0.5) / l)), h, 1.0);
double tmp;
if (d <= -1.02e-47) {
tmp = t_3;
} else if (d <= 1.1e-272) {
tmp = (sqrt((h / l)) * fma((h / l), ((-0.125 * pow((M * D), 2.0)) / d), d)) / h;
} else if (d <= 6.3e-86) {
tmp = fma((t_0 * (-0.5 * t_2)), (h * ((0.25 * t_2) / l)), t_0);
} else {
tmp = t_3;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(h * l))) t_1 = Float64(Float64(Float64(D * M) / d) * 0.5) t_2 = Float64(Float64(M * D) / d) t_3 = Float64(Float64((sqrt(Float64(h / d)) ^ -1.0) * sqrt(Float64(d / l))) * fma(Float64(Float64(t_1 / -1.0) * Float64(Float64(t_1 * 0.5) / l)), h, 1.0)) tmp = 0.0 if (d <= -1.02e-47) tmp = t_3; elseif (d <= 1.1e-272) tmp = Float64(Float64(sqrt(Float64(h / l)) * fma(Float64(h / l), Float64(Float64(-0.125 * (Float64(M * D) ^ 2.0)) / d), d)) / h); elseif (d <= 6.3e-86) tmp = fma(Float64(t_0 * Float64(-0.5 * t_2)), Float64(h * Float64(Float64(0.25 * t_2) / l)), t_0); else tmp = t_3; end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Power[N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(t$95$1 / -1.0), $MachinePrecision] * N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.02e-47], t$95$3, If[LessEqual[d, 1.1e-272], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * N[(N[(-0.125 * N[Power[N[(M * D), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] + d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 6.3e-86], N[(N[(t$95$0 * N[(-0.5 * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$2), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_1 := \frac{D \cdot M}{d} \cdot 0.5\\
t_2 := \frac{M \cdot D}{d}\\
t_3 := \left({\left(\sqrt{\frac{h}{d}}\right)}^{-1} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\frac{t\_1}{-1} \cdot \frac{t\_1 \cdot 0.5}{\ell}, h, 1\right)\\
\mathbf{if}\;d \leq -1.02 \cdot 10^{-47}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;d \leq 1.1 \cdot 10^{-272}:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}} \cdot \mathsf{fma}\left(\frac{h}{\ell}, \frac{-0.125 \cdot {\left(M \cdot D\right)}^{2}}{d}, d\right)}{h}\\
\mathbf{elif}\;d \leq 6.3 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(-0.5 \cdot t\_2\right), h \cdot \frac{0.25 \cdot t\_2}{\ell}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if d < -1.02000000000000002e-47 or 6.2999999999999999e-86 < d Initial program 77.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites84.1%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6484.1
Applied rewrites84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites84.2%
lift-/.f64N/A
metadata-eval84.2
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6485.5
Applied rewrites85.5%
if -1.02000000000000002e-47 < d < 1.09999999999999994e-272Initial program 46.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites44.7%
Applied rewrites50.7%
Applied rewrites75.7%
if 1.09999999999999994e-272 < d < 6.2999999999999999e-86Initial program 37.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites37.6%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6437.6
Applied rewrites37.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites37.9%
Applied rewrites76.9%
Final simplification81.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l))))
(t_1 (* (/ (* D M) d) 0.5))
(t_2 (fma (* (/ t_1 -1.0) (/ (* t_1 0.5) l)) h 1.0))
(t_3 (/ (* M D) d))
(t_4 (sqrt (/ h l)))
(t_5 (sqrt (/ d l))))
(if (<= d -2.6e-178)
(* (* (sqrt (/ d h)) t_5) t_2)
(if (<= d 2.3e-273)
(/
(fma (* (* (/ (* D D) d) M) (* -0.125 M)) (* (/ h l) t_4) (* t_4 d))
h)
(if (<= d 6.3e-86)
(fma (* t_0 (* -0.5 t_3)) (* h (/ (* 0.25 t_3) l)) t_0)
(* (* (pow (sqrt (/ h d)) -1.0) t_5) t_2))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((h * l));
double t_1 = ((D * M) / d) * 0.5;
double t_2 = fma(((t_1 / -1.0) * ((t_1 * 0.5) / l)), h, 1.0);
double t_3 = (M * D) / d;
double t_4 = sqrt((h / l));
double t_5 = sqrt((d / l));
double tmp;
if (d <= -2.6e-178) {
tmp = (sqrt((d / h)) * t_5) * t_2;
} else if (d <= 2.3e-273) {
tmp = fma(((((D * D) / d) * M) * (-0.125 * M)), ((h / l) * t_4), (t_4 * d)) / h;
} else if (d <= 6.3e-86) {
tmp = fma((t_0 * (-0.5 * t_3)), (h * ((0.25 * t_3) / l)), t_0);
} else {
tmp = (pow(sqrt((h / d)), -1.0) * t_5) * t_2;
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(h * l))) t_1 = Float64(Float64(Float64(D * M) / d) * 0.5) t_2 = fma(Float64(Float64(t_1 / -1.0) * Float64(Float64(t_1 * 0.5) / l)), h, 1.0) t_3 = Float64(Float64(M * D) / d) t_4 = sqrt(Float64(h / l)) t_5 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -2.6e-178) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_5) * t_2); elseif (d <= 2.3e-273) tmp = Float64(fma(Float64(Float64(Float64(Float64(D * D) / d) * M) * Float64(-0.125 * M)), Float64(Float64(h / l) * t_4), Float64(t_4 * d)) / h); elseif (d <= 6.3e-86) tmp = fma(Float64(t_0 * Float64(-0.5 * t_3)), Float64(h * Float64(Float64(0.25 * t_3) / l)), t_0); else tmp = Float64(Float64((sqrt(Float64(h / d)) ^ -1.0) * t_5) * t_2); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t$95$1 / -1.0), $MachinePrecision] * N[(N[(t$95$1 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.6e-178], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$5), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[d, 2.3e-273], N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(t$95$4 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 6.3e-86], N[(N[(t$95$0 * N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$3), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[Power[N[Sqrt[N[(h / d), $MachinePrecision]], $MachinePrecision], -1.0], $MachinePrecision] * t$95$5), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_1 := \frac{D \cdot M}{d} \cdot 0.5\\
t_2 := \mathsf{fma}\left(\frac{t\_1}{-1} \cdot \frac{t\_1 \cdot 0.5}{\ell}, h, 1\right)\\
t_3 := \frac{M \cdot D}{d}\\
t_4 := \sqrt{\frac{h}{\ell}}\\
t_5 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2.6 \cdot 10^{-178}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_5\right) \cdot t\_2\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{-273}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot \left(-0.125 \cdot M\right), \frac{h}{\ell} \cdot t\_4, t\_4 \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 6.3 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(-0.5 \cdot t\_3\right), h \cdot \frac{0.25 \cdot t\_3}{\ell}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left({\left(\sqrt{\frac{h}{d}}\right)}^{-1} \cdot t\_5\right) \cdot t\_2\\
\end{array}
\end{array}
if d < -2.59999999999999998e-178Initial program 71.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites78.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6478.3
Applied rewrites78.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites79.3%
lift-/.f64N/A
metadata-eval79.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6479.3
Applied rewrites79.3%
if -2.59999999999999998e-178 < d < 2.29999999999999981e-273Initial program 36.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.7%
Applied rewrites51.1%
Applied rewrites53.9%
if 2.29999999999999981e-273 < d < 6.2999999999999999e-86Initial program 37.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites37.6%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6437.6
Applied rewrites37.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites37.9%
Applied rewrites76.9%
if 6.2999999999999999e-86 < d Initial program 82.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites86.6%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6486.6
Applied rewrites86.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites86.7%
lift-/.f64N/A
metadata-eval86.7
lift-pow.f64N/A
pow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6489.1
Applied rewrites89.1%
Final simplification77.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (/ d (sqrt (* h l))))
(t_2 (* (* D (/ 0.5 d)) M))
(t_3 (/ (* M D) d))
(t_4 (sqrt (/ h l))))
(if (<= d -3.6e+103)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -7.9e-109)
(*
(* (/ (fma (/ M d) (* (/ M d) (* (* (* D D) -0.125) h)) l) l) t_0)
(sqrt (/ d h)))
(if (<= d 2.3e-273)
(/
(fma (* (* (/ (* D D) d) M) (* -0.125 M)) (* (/ h l) t_4) (* t_4 d))
h)
(if (<= d 7.2e-107)
(fma (* t_1 (* -0.5 t_3)) (* h (/ (* 0.25 t_3) l)) t_1)
(/
(* (* (fma (* (* (/ h l) -0.5) t_2) t_2 1.0) t_0) (sqrt d))
(sqrt h))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = sqrt((d / l));
double t_1 = d / sqrt((h * l));
double t_2 = (D * (0.5 / d)) * M;
double t_3 = (M * D) / d;
double t_4 = sqrt((h / l));
double tmp;
if (d <= -3.6e+103) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -7.9e-109) {
tmp = ((fma((M / d), ((M / d) * (((D * D) * -0.125) * h)), l) / l) * t_0) * sqrt((d / h));
} else if (d <= 2.3e-273) {
tmp = fma(((((D * D) / d) * M) * (-0.125 * M)), ((h / l) * t_4), (t_4 * d)) / h;
} else if (d <= 7.2e-107) {
tmp = fma((t_1 * (-0.5 * t_3)), (h * ((0.25 * t_3) / l)), t_1);
} else {
tmp = ((fma((((h / l) * -0.5) * t_2), t_2, 1.0) * t_0) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = sqrt(Float64(d / l)) t_1 = Float64(d / sqrt(Float64(h * l))) t_2 = Float64(Float64(D * Float64(0.5 / d)) * M) t_3 = Float64(Float64(M * D) / d) t_4 = sqrt(Float64(h / l)) tmp = 0.0 if (d <= -3.6e+103) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -7.9e-109) tmp = Float64(Float64(Float64(fma(Float64(M / d), Float64(Float64(M / d) * Float64(Float64(Float64(D * D) * -0.125) * h)), l) / l) * t_0) * sqrt(Float64(d / h))); elseif (d <= 2.3e-273) tmp = Float64(fma(Float64(Float64(Float64(Float64(D * D) / d) * M) * Float64(-0.125 * M)), Float64(Float64(h / l) * t_4), Float64(t_4 * d)) / h); elseif (d <= 7.2e-107) tmp = fma(Float64(t_1 * Float64(-0.5 * t_3)), Float64(h * Float64(Float64(0.25 * t_3) / l)), t_1); else tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_2), t_2, 1.0) * t_0) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$3 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.6e+103], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -7.9e-109], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e-273], N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(t$95$4 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 7.2e-107], N[(N[(t$95$1 * N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$3), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$2 + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_2 := \left(D \cdot \frac{0.5}{d}\right) \cdot M\\
t_3 := \frac{M \cdot D}{d}\\
t_4 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{+103}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -7.9 \cdot 10^{-109}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{M}{d}, \frac{M}{d} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot h\right), \ell\right)}{\ell} \cdot t\_0\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{-273}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot \left(-0.125 \cdot M\right), \frac{h}{\ell} \cdot t\_4, t\_4 \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(t\_1 \cdot \left(-0.5 \cdot t\_3\right), h \cdot \frac{0.25 \cdot t\_3}{\ell}, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_2, t\_2, 1\right) \cdot t\_0\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -3.60000000000000017e103Initial program 69.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.4
Applied rewrites68.4%
if -3.60000000000000017e103 < d < -7.8999999999999997e-109Initial program 77.2%
Applied rewrites0.0%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f640.0
Applied rewrites0.0%
Applied rewrites69.3%
Applied rewrites69.7%
if -7.8999999999999997e-109 < d < 2.29999999999999981e-273Initial program 39.5%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites49.1%
Applied rewrites51.1%
Applied rewrites53.4%
if 2.29999999999999981e-273 < d < 7.19999999999999953e-107Initial program 34.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites34.9%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6434.9
Applied rewrites34.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites35.0%
Applied rewrites79.2%
if 7.19999999999999953e-107 < d Initial program 80.3%
Applied rewrites86.0%
lift-fma.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites87.2%
Final simplification73.1%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ d (sqrt (* h l))))
(t_1 (* (* D (/ 0.5 d)) M))
(t_2 (* (/ (* D M) d) 0.5))
(t_3 (/ (* M D) d))
(t_4 (sqrt (/ h l)))
(t_5 (sqrt (/ d l))))
(if (<= d -2.6e-178)
(* (* (sqrt (/ d h)) t_5) (fma (* (/ t_2 -1.0) (/ (* t_2 0.5) l)) h 1.0))
(if (<= d 2.3e-273)
(/
(fma (* (* (/ (* D D) d) M) (* -0.125 M)) (* (/ h l) t_4) (* t_4 d))
h)
(if (<= d 7.2e-107)
(fma (* t_0 (* -0.5 t_3)) (* h (/ (* 0.25 t_3) l)) t_0)
(/
(* (* (fma (* (* (/ h l) -0.5) t_1) t_1 1.0) t_5) (sqrt d))
(sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = d / sqrt((h * l));
double t_1 = (D * (0.5 / d)) * M;
double t_2 = ((D * M) / d) * 0.5;
double t_3 = (M * D) / d;
double t_4 = sqrt((h / l));
double t_5 = sqrt((d / l));
double tmp;
if (d <= -2.6e-178) {
tmp = (sqrt((d / h)) * t_5) * fma(((t_2 / -1.0) * ((t_2 * 0.5) / l)), h, 1.0);
} else if (d <= 2.3e-273) {
tmp = fma(((((D * D) / d) * M) * (-0.125 * M)), ((h / l) * t_4), (t_4 * d)) / h;
} else if (d <= 7.2e-107) {
tmp = fma((t_0 * (-0.5 * t_3)), (h * ((0.25 * t_3) / l)), t_0);
} else {
tmp = ((fma((((h / l) * -0.5) * t_1), t_1, 1.0) * t_5) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(d / sqrt(Float64(h * l))) t_1 = Float64(Float64(D * Float64(0.5 / d)) * M) t_2 = Float64(Float64(Float64(D * M) / d) * 0.5) t_3 = Float64(Float64(M * D) / d) t_4 = sqrt(Float64(h / l)) t_5 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -2.6e-178) tmp = Float64(Float64(sqrt(Float64(d / h)) * t_5) * fma(Float64(Float64(t_2 / -1.0) * Float64(Float64(t_2 * 0.5) / l)), h, 1.0)); elseif (d <= 2.3e-273) tmp = Float64(fma(Float64(Float64(Float64(Float64(D * D) / d) * M) * Float64(-0.125 * M)), Float64(Float64(h / l) * t_4), Float64(t_4 * d)) / h); elseif (d <= 7.2e-107) tmp = fma(Float64(t_0 * Float64(-0.5 * t_3)), Float64(h * Float64(Float64(0.25 * t_3) / l)), t_0); else tmp = Float64(Float64(Float64(fma(Float64(Float64(Float64(h / l) * -0.5) * t_1), t_1, 1.0) * t_5) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(D * N[(0.5 / d), $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$3 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.6e-178], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * t$95$5), $MachinePrecision] * N[(N[(N[(t$95$2 / -1.0), $MachinePrecision] * N[(N[(t$95$2 * 0.5), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] * h + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.3e-273], N[(N[(N[(N[(N[(N[(D * D), $MachinePrecision] / d), $MachinePrecision] * M), $MachinePrecision] * N[(-0.125 * M), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$4), $MachinePrecision] + N[(t$95$4 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[d, 7.2e-107], N[(N[(t$95$0 * N[(-0.5 * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$3), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(N[(N[(N[(N[(N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1 + 1.0), $MachinePrecision] * t$95$5), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{d}{\sqrt{h \cdot \ell}}\\
t_1 := \left(D \cdot \frac{0.5}{d}\right) \cdot M\\
t_2 := \frac{D \cdot M}{d} \cdot 0.5\\
t_3 := \frac{M \cdot D}{d}\\
t_4 := \sqrt{\frac{h}{\ell}}\\
t_5 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -2.6 \cdot 10^{-178}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot t\_5\right) \cdot \mathsf{fma}\left(\frac{t\_2}{-1} \cdot \frac{t\_2 \cdot 0.5}{\ell}, h, 1\right)\\
\mathbf{elif}\;d \leq 2.3 \cdot 10^{-273}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\frac{D \cdot D}{d} \cdot M\right) \cdot \left(-0.125 \cdot M\right), \frac{h}{\ell} \cdot t\_4, t\_4 \cdot d\right)}{h}\\
\mathbf{elif}\;d \leq 7.2 \cdot 10^{-107}:\\
\;\;\;\;\mathsf{fma}\left(t\_0 \cdot \left(-0.5 \cdot t\_3\right), h \cdot \frac{0.25 \cdot t\_3}{\ell}, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(\left(\frac{h}{\ell} \cdot -0.5\right) \cdot t\_1, t\_1, 1\right) \cdot t\_5\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -2.59999999999999998e-178Initial program 71.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites78.3%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6478.3
Applied rewrites78.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites79.3%
lift-/.f64N/A
metadata-eval79.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6479.3
Applied rewrites79.3%
if -2.59999999999999998e-178 < d < 2.29999999999999981e-273Initial program 36.7%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites48.7%
Applied rewrites51.1%
Applied rewrites53.9%
if 2.29999999999999981e-273 < d < 7.19999999999999953e-107Initial program 34.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites34.9%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6434.9
Applied rewrites34.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites35.0%
Applied rewrites79.2%
if 7.19999999999999953e-107 < d Initial program 80.3%
Applied rewrites86.0%
lift-fma.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites87.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (/ (* M D) d))
(t_1 (sqrt (/ d l)))
(t_2 (sqrt (/ h l)))
(t_3 (* (/ (* D M) d) 0.5))
(t_4 (/ d (sqrt (* h l)))))
(if (<= h -190000000.0)
(*
(* (/ (fma (/ M d) (* (/ M d) (* (* (* D D) -0.125) h)) l) l) t_1)
(sqrt (/ d h)))
(if (<= h -7.8e-104)
(/
(fma (* (* (* -0.125 (* M M)) D) (/ D d)) (* (/ h l) t_2) (* t_2 d))
h)
(if (<= h 5.5e-102)
(* (fma t_3 (* t_3 (* (/ h l) -0.5)) 1.0) (sqrt (* (/ (/ d l) h) d)))
(if (<= h 1.4e+138)
(fma (* t_4 (* -0.5 t_0)) (* h (/ (* 0.25 t_0) l)) t_4)
(/
(*
(* (/ (fma (* -0.125 (* D D)) (* (/ (* h M) d) (/ M d)) l) l) t_1)
(sqrt d))
(sqrt h))))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = (M * D) / d;
double t_1 = sqrt((d / l));
double t_2 = sqrt((h / l));
double t_3 = ((D * M) / d) * 0.5;
double t_4 = d / sqrt((h * l));
double tmp;
if (h <= -190000000.0) {
tmp = ((fma((M / d), ((M / d) * (((D * D) * -0.125) * h)), l) / l) * t_1) * sqrt((d / h));
} else if (h <= -7.8e-104) {
tmp = fma((((-0.125 * (M * M)) * D) * (D / d)), ((h / l) * t_2), (t_2 * d)) / h;
} else if (h <= 5.5e-102) {
tmp = fma(t_3, (t_3 * ((h / l) * -0.5)), 1.0) * sqrt((((d / l) / h) * d));
} else if (h <= 1.4e+138) {
tmp = fma((t_4 * (-0.5 * t_0)), (h * ((0.25 * t_0) / l)), t_4);
} else {
tmp = (((fma((-0.125 * (D * D)), (((h * M) / d) * (M / d)), l) / l) * t_1) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(M * D) / d) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(h / l)) t_3 = Float64(Float64(Float64(D * M) / d) * 0.5) t_4 = Float64(d / sqrt(Float64(h * l))) tmp = 0.0 if (h <= -190000000.0) tmp = Float64(Float64(Float64(fma(Float64(M / d), Float64(Float64(M / d) * Float64(Float64(Float64(D * D) * -0.125) * h)), l) / l) * t_1) * sqrt(Float64(d / h))); elseif (h <= -7.8e-104) tmp = Float64(fma(Float64(Float64(Float64(-0.125 * Float64(M * M)) * D) * Float64(D / d)), Float64(Float64(h / l) * t_2), Float64(t_2 * d)) / h); elseif (h <= 5.5e-102) tmp = Float64(fma(t_3, Float64(t_3 * Float64(Float64(h / l) * -0.5)), 1.0) * sqrt(Float64(Float64(Float64(d / l) / h) * d))); elseif (h <= 1.4e+138) tmp = fma(Float64(t_4 * Float64(-0.5 * t_0)), Float64(h * Float64(Float64(0.25 * t_0) / l)), t_4); else tmp = Float64(Float64(Float64(Float64(fma(Float64(-0.125 * Float64(D * D)), Float64(Float64(Float64(h * M) / d) * Float64(M / d)), l) / l) * t_1) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(M * D), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$4 = N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[h, -190000000.0], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -7.8e-104], N[(N[(N[(N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$2 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[h, 5.5e-102], N[(N[(t$95$3 * N[(t$95$3 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, 1.4e+138], N[(N[(t$95$4 * N[(-0.5 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(h * N[(N[(0.25 * t$95$0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision] + t$95$4), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{M \cdot D}{d}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{h}{\ell}}\\
t_3 := \frac{D \cdot M}{d} \cdot 0.5\\
t_4 := \frac{d}{\sqrt{h \cdot \ell}}\\
\mathbf{if}\;h \leq -190000000:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{M}{d}, \frac{M}{d} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot h\right), \ell\right)}{\ell} \cdot t\_1\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -7.8 \cdot 10^{-104}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot \frac{D}{d}, \frac{h}{\ell} \cdot t\_2, t\_2 \cdot d\right)}{h}\\
\mathbf{elif}\;h \leq 5.5 \cdot 10^{-102}:\\
\;\;\;\;\mathsf{fma}\left(t\_3, t\_3 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{elif}\;h \leq 1.4 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(t\_4 \cdot \left(-0.5 \cdot t\_0\right), h \cdot \frac{0.25 \cdot t\_0}{\ell}, t\_4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), \frac{h \cdot M}{d} \cdot \frac{M}{d}, \ell\right)}{\ell} \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -1.9e8Initial program 58.3%
Applied rewrites0.0%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f640.0
Applied rewrites0.0%
Applied rewrites52.0%
Applied rewrites57.1%
if -1.9e8 < h < -7.8000000000000004e-104Initial program 70.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites53.7%
Applied rewrites67.2%
Applied rewrites70.4%
if -7.8000000000000004e-104 < h < 5.4999999999999997e-102Initial program 64.3%
Applied rewrites63.1%
lift-fma.f64N/A
*-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*l*N/A
Applied rewrites65.9%
if 5.4999999999999997e-102 < h < 1.4e138Initial program 71.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift-/.f64N/A
clear-numN/A
associate-*r/N/A
div-invN/A
times-fracN/A
clear-numN/A
/-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites73.4%
lift-/.f64N/A
lift-pow.f64N/A
metadata-evalN/A
pow1/2N/A
lift-sqrt.f6473.4
Applied rewrites73.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
times-fracN/A
Applied rewrites73.7%
Applied rewrites88.9%
if 1.4e138 < h Initial program 63.0%
Applied rewrites78.9%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6468.6
Applied rewrites68.6%
Taylor expanded in d around 0
Applied rewrites65.9%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(let* ((t_0 (* (/ (* D M) d) 0.5)) (t_1 (sqrt (/ d l))) (t_2 (sqrt (/ h l))))
(if (<= h -190000000.0)
(*
(* (/ (fma (/ M d) (* (/ M d) (* (* (* D D) -0.125) h)) l) l) t_1)
(sqrt (/ d h)))
(if (<= h -7.8e-104)
(/
(fma (* (* (* -0.125 (* M M)) D) (/ D d)) (* (/ h l) t_2) (* t_2 d))
h)
(if (<= h 3.5e+15)
(* (fma t_0 (* t_0 (* (/ h l) -0.5)) 1.0) (sqrt (* (/ (/ d l) h) d)))
(/
(*
(* (/ (fma (* -0.125 (* D D)) (* (/ (* h M) d) (/ M d)) l) l) t_1)
(sqrt d))
(sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double t_0 = ((D * M) / d) * 0.5;
double t_1 = sqrt((d / l));
double t_2 = sqrt((h / l));
double tmp;
if (h <= -190000000.0) {
tmp = ((fma((M / d), ((M / d) * (((D * D) * -0.125) * h)), l) / l) * t_1) * sqrt((d / h));
} else if (h <= -7.8e-104) {
tmp = fma((((-0.125 * (M * M)) * D) * (D / d)), ((h / l) * t_2), (t_2 * d)) / h;
} else if (h <= 3.5e+15) {
tmp = fma(t_0, (t_0 * ((h / l) * -0.5)), 1.0) * sqrt((((d / l) / h) * d));
} else {
tmp = (((fma((-0.125 * (D * D)), (((h * M) / d) * (M / d)), l) / l) * t_1) * sqrt(d)) / sqrt(h);
}
return tmp;
}
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) t_0 = Float64(Float64(Float64(D * M) / d) * 0.5) t_1 = sqrt(Float64(d / l)) t_2 = sqrt(Float64(h / l)) tmp = 0.0 if (h <= -190000000.0) tmp = Float64(Float64(Float64(fma(Float64(M / d), Float64(Float64(M / d) * Float64(Float64(Float64(D * D) * -0.125) * h)), l) / l) * t_1) * sqrt(Float64(d / h))); elseif (h <= -7.8e-104) tmp = Float64(fma(Float64(Float64(Float64(-0.125 * Float64(M * M)) * D) * Float64(D / d)), Float64(Float64(h / l) * t_2), Float64(t_2 * d)) / h); elseif (h <= 3.5e+15) tmp = Float64(fma(t_0, Float64(t_0 * Float64(Float64(h / l) * -0.5)), 1.0) * sqrt(Float64(Float64(Float64(d / l) / h) * d))); else tmp = Float64(Float64(Float64(Float64(fma(Float64(-0.125 * Float64(D * D)), Float64(Float64(Float64(h * M) / d) * Float64(M / d)), l) / l) * t_1) * sqrt(d)) / sqrt(h)); end return tmp end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D_] := Block[{t$95$0 = N[(N[(N[(D * M), $MachinePrecision] / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[h, -190000000.0], N[(N[(N[(N[(N[(M / d), $MachinePrecision] * N[(N[(M / d), $MachinePrecision] * N[(N[(N[(D * D), $MachinePrecision] * -0.125), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -7.8e-104], N[(N[(N[(N[(N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision] * D), $MachinePrecision] * N[(D / d), $MachinePrecision]), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * t$95$2), $MachinePrecision] + N[(t$95$2 * d), $MachinePrecision]), $MachinePrecision] / h), $MachinePrecision], If[LessEqual[h, 3.5e+15], N[(N[(t$95$0 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(-0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h * M), $MachinePrecision] / d), $MachinePrecision] * N[(M / d), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
t_0 := \frac{D \cdot M}{d} \cdot 0.5\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \sqrt{\frac{h}{\ell}}\\
\mathbf{if}\;h \leq -190000000:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{M}{d}, \frac{M}{d} \cdot \left(\left(\left(D \cdot D\right) \cdot -0.125\right) \cdot h\right), \ell\right)}{\ell} \cdot t\_1\right) \cdot \sqrt{\frac{d}{h}}\\
\mathbf{elif}\;h \leq -7.8 \cdot 10^{-104}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\left(-0.125 \cdot \left(M \cdot M\right)\right) \cdot D\right) \cdot \frac{D}{d}, \frac{h}{\ell} \cdot t\_2, t\_2 \cdot d\right)}{h}\\
\mathbf{elif}\;h \leq 3.5 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{\mathsf{fma}\left(-0.125 \cdot \left(D \cdot D\right), \frac{h \cdot M}{d} \cdot \frac{M}{d}, \ell\right)}{\ell} \cdot t\_1\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -1.9e8Initial program 58.3%
Applied rewrites0.0%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f640.0
Applied rewrites0.0%
Applied rewrites52.0%
Applied rewrites57.1%
if -1.9e8 < h < -7.8000000000000004e-104Initial program 70.8%
Taylor expanded in h around 0
lower-/.f64N/A
Applied rewrites53.7%
Applied rewrites67.2%
Applied rewrites70.4%
if -7.8000000000000004e-104 < h < 3.5e15Initial program 68.9%
Applied rewrites67.5%
lift-fma.f64N/A
*-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
metadata-evalN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
clear-numN/A
unpow2N/A
associate-*l*N/A
Applied rewrites70.5%
if 3.5e15 < h Initial program 62.0%
Applied rewrites74.9%
Taylor expanded in l around 0
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6464.0
Applied rewrites64.0%
Taylor expanded in d around 0
Applied rewrites64.0%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
(FPCore (d h l M D)
:precision binary64
(if (<= d -1.26e+51)
(* (- d) (sqrt (pow (* l h) -1.0)))
(if (<= d -3.2e-167)
(/ (sqrt (* (/ (- d) l) d)) (sqrt (- h)))
(if (<= d -1e-310)
(* (* (* 0.125 (* D D)) (/ (* M M) d)) (/ (sqrt (/ h l)) (fabs l)))
(/ d (* (sqrt l) (sqrt h)))))))assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.26e+51) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else if (d <= -3.2e-167) {
tmp = sqrt(((-d / l) * d)) / sqrt(-h);
} else if (d <= -1e-310) {
tmp = ((0.125 * (D * D)) * ((M * M) / d)) * (sqrt((h / l)) / fabs(l));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 (d <= (-1.26d+51)) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else if (d <= (-3.2d-167)) then
tmp = sqrt(((-d / l) * d)) / sqrt(-h)
else if (d <= (-1d-310)) then
tmp = ((0.125d0 * (d_1 * d_1)) * ((m * m) / d)) * (sqrt((h / l)) / abs(l))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (d <= -1.26e+51) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else if (d <= -3.2e-167) {
tmp = Math.sqrt(((-d / l) * d)) / Math.sqrt(-h);
} else if (d <= -1e-310) {
tmp = ((0.125 * (D * D)) * ((M * M) / d)) * (Math.sqrt((h / l)) / Math.abs(l));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if d <= -1.26e+51: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) elif d <= -3.2e-167: tmp = math.sqrt(((-d / l) * d)) / math.sqrt(-h) elif d <= -1e-310: tmp = ((0.125 * (D * D)) * ((M * M) / d)) * (math.sqrt((h / l)) / math.fabs(l)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (d <= -1.26e+51) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); elseif (d <= -3.2e-167) tmp = Float64(sqrt(Float64(Float64(Float64(-d) / l) * d)) / sqrt(Float64(-h))); elseif (d <= -1e-310) tmp = Float64(Float64(Float64(0.125 * Float64(D * D)) * Float64(Float64(M * M) / d)) * Float64(sqrt(Float64(h / l)) / abs(l))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (d <= -1.26e+51)
tmp = -d * sqrt(((l * h) ^ -1.0));
elseif (d <= -3.2e-167)
tmp = sqrt(((-d / l) * d)) / sqrt(-h);
elseif (d <= -1e-310)
tmp = ((0.125 * (D * D)) * ((M * M) / d)) * (sqrt((h / l)) / abs(l));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[d, -1.26e+51], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -3.2e-167], N[(N[Sqrt[N[(N[((-d) / l), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[(N[(0.125 * N[(D * D), $MachinePrecision]), $MachinePrecision] * N[(N[(M * M), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / N[Abs[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.26 \cdot 10^{+51}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{elif}\;d \leq -3.2 \cdot 10^{-167}:\\
\;\;\;\;\frac{\sqrt{\frac{-d}{\ell} \cdot d}}{\sqrt{-h}}\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(0.125 \cdot \left(D \cdot D\right)\right) \cdot \frac{M \cdot M}{d}\right) \cdot \frac{\sqrt{\frac{h}{\ell}}}{\left|\ell\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -1.25999999999999997e51Initial program 67.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6463.2
Applied rewrites63.2%
if -1.25999999999999997e51 < d < -3.2000000000000002e-167Initial program 81.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6410.4
Applied rewrites10.4%
Applied rewrites53.0%
if -3.2000000000000002e-167 < d < -9.999999999999969e-311Initial program 36.6%
Taylor expanded in h around -inf
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites33.6%
Applied rewrites56.3%
if -9.999999999999969e-311 < d Initial program 65.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6440.9
Applied rewrites40.9%
Applied rewrites41.3%
Applied rewrites49.8%
Final simplification54.2%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 2.2e-284) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (* (sqrt l) (sqrt h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.2e-284) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= 2.2d-284) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.2e-284) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.2e-284: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.2e-284) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 2.2e-284)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.2e-284], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.2 \cdot 10^{-284}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 2.2000000000000001e-284Initial program 65.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.0
Applied rewrites47.0%
if 2.2000000000000001e-284 < l Initial program 64.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.3
Applied rewrites43.3%
Applied rewrites43.7%
Applied rewrites52.7%
Final simplification49.7%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (if (<= l 2.35e-284) (* (- d) (sqrt (pow (* l h) -1.0))) (/ d (sqrt (* l h)))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.35e-284) {
tmp = -d * sqrt(pow((l * h), -1.0));
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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 <= 2.35d-284) then
tmp = -d * sqrt(((l * h) ** (-1.0d0)))
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
double tmp;
if (l <= 2.35e-284) {
tmp = -d * Math.sqrt(Math.pow((l * h), -1.0));
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): tmp = 0 if l <= 2.35e-284: tmp = -d * math.sqrt(math.pow((l * h), -1.0)) else: tmp = d / math.sqrt((l * h)) return tmp
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) tmp = 0.0 if (l <= 2.35e-284) tmp = Float64(Float64(-d) * sqrt((Float64(l * h) ^ -1.0))); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp_2 = code(d, h, l, M, D)
tmp = 0.0;
if (l <= 2.35e-284)
tmp = -d * sqrt(((l * h) ^ -1.0));
else
tmp = d / sqrt((l * h));
end
tmp_2 = tmp;
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := If[LessEqual[l, 2.35e-284], N[((-d) * N[Sqrt[N[Power[N[(l * h), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.35 \cdot 10^{-284}:\\
\;\;\;\;\left(-d\right) \cdot \sqrt{{\left(\ell \cdot h\right)}^{-1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if l < 2.35000000000000011e-284Initial program 65.3%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6447.0
Applied rewrites47.0%
if 2.35000000000000011e-284 < l Initial program 64.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.3
Applied rewrites43.3%
Applied rewrites43.7%
Final simplification45.5%
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. (FPCore (d h l M D) :precision binary64 (/ d (sqrt (* l h))))
assert(d < h && h < l && l < M && M < D);
double code(double d, double h, double l, double M, double D) {
return d / sqrt((l * h));
}
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function.
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
assert d < h && h < l && l < M && M < D;
public static double code(double d, double h, double l, double M, double D) {
return d / Math.sqrt((l * h));
}
[d, h, l, M, D] = sort([d, h, l, M, D]) def code(d, h, l, M, D): return d / math.sqrt((l * h))
d, h, l, M, D = sort([d, h, l, M, D]) function code(d, h, l, M, D) return Float64(d / sqrt(Float64(l * h))) end
d, h, l, M, D = num2cell(sort([d, h, l, M, D])){:}
function tmp = code(d, h, l, M, D)
tmp = d / sqrt((l * h));
end
NOTE: d, h, l, M, and D should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[d, h, l, M, D] = \mathsf{sort}([d, h, l, M, D])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 64.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.9
Applied rewrites24.9%
Applied rewrites25.1%
herbie shell --seed 2024340
(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)))))