
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (* D_m (/ M_m (* d -2.0)))))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))
1e+277)
(*
(* (pow (/ h d) -0.5) (sqrt (/ d l)))
(- 1.0 (* t_0 (* (/ h l) (* 0.5 t_0)))))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = D_m * (M_m / (d * -2.0));
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))) <= 1e+277) {
tmp = (pow((h / d), -0.5) * sqrt((d / l))) * (1.0 - (t_0 * ((h / l) * (0.5 * t_0))));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(D_m * Float64(M_m / Float64(d * -2.0))) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) <= 1e+277) tmp = Float64(Float64((Float64(h / d) ^ -0.5) * sqrt(Float64(d / l))) * Float64(1.0 - Float64(t_0 * Float64(Float64(h / l) * Float64(0.5 * t_0))))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(D$95$m * N[(M$95$m / N[(d * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+277], N[(N[(N[Power[N[(h / d), $MachinePrecision], -0.5], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := D\_m \cdot \frac{M\_m}{d \cdot -2}\\
\mathbf{if}\;\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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 10^{+277}:\\
\;\;\;\;\left({\left(\frac{h}{d}\right)}^{-0.5} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \left(1 - t\_0 \cdot \left(\frac{h}{\ell} \cdot \left(0.5 \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < 1e277Initial program 87.4%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval87.1
Applied egg-rr87.1%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.1
Applied egg-rr87.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr87.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
Applied egg-rr87.9%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification82.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_2 -1e-84)
(*
t_0
(*
t_1
(-
1.0
(/ (* (* h 0.25) (* M_m (* M_m (* D_m D_m)))) (* (* d 2.0) (* d l))))))
(if (<= t_2 1e-170)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= t_2 2e+154)
(sqrt (* (/ d h) (/ d l)))
(if (<= t_2 1e+277)
(*
t_1
(*
t_0
(fma
(- D_m)
(/ (* 0.125 (* D_m (* h (* M_m M_m)))) (* d (* d l)))
1.0)))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l))))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_2 <= -1e-84) {
tmp = t_0 * (t_1 * (1.0 - (((h * 0.25) * (M_m * (M_m * (D_m * D_m)))) / ((d * 2.0) * (d * l)))));
} else if (t_2 <= 1e-170) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (t_2 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else if (t_2 <= 1e+277) {
tmp = t_1 * (t_0 * fma(-D_m, ((0.125 * (D_m * (h * (M_m * M_m)))) / (d * (d * l))), 1.0));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_2 <= -1e-84) tmp = Float64(t_0 * Float64(t_1 * Float64(1.0 - Float64(Float64(Float64(h * 0.25) * Float64(M_m * Float64(M_m * Float64(D_m * D_m)))) / Float64(Float64(d * 2.0) * Float64(d * l)))))); elseif (t_2 <= 1e-170) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (t_2 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); elseif (t_2 <= 1e+277) tmp = Float64(t_1 * Float64(t_0 * fma(Float64(-D_m), Float64(Float64(0.125 * Float64(D_m * Float64(h * Float64(M_m * M_m)))) / Float64(d * Float64(d * l))), 1.0))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-84], N[(t$95$0 * N[(t$95$1 * N[(1.0 - N[(N[(N[(h * 0.25), $MachinePrecision] * N[(M$95$m * N[(M$95$m * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(d * 2.0), $MachinePrecision] * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-170], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, 1e+277], N[(t$95$1 * N[(t$95$0 * N[((-D$95$m) * N[(N[(0.125 * N[(D$95$m * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-84}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \left(1 - \frac{\left(h \cdot 0.25\right) \cdot \left(M\_m \cdot \left(M\_m \cdot \left(D\_m \cdot D\_m\right)\right)\right)}{\left(d \cdot 2\right) \cdot \left(d \cdot \ell\right)}\right)\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-170}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;t\_2 \leq 10^{+277}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \mathsf{fma}\left(-D\_m, \frac{0.125 \cdot \left(D\_m \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < -1e-84Initial program 87.7%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6447.8
Applied egg-rr47.8%
Applied egg-rr70.9%
if -1e-84 < (*.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.99999999999999983e-171Initial program 49.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6422.0
Simplified22.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6454.5
Simplified54.5%
if 9.99999999999999983e-171 < (*.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)))) < 2.00000000000000007e154Initial program 99.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied egg-rr99.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6499.4
Applied egg-rr99.4%
Applied egg-rr83.3%
Taylor expanded in h around 0
Simplified99.2%
if 2.00000000000000007e154 < (*.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)))) < 1e277Initial program 99.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6472.9
Simplified72.9%
Applied egg-rr72.9%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification75.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d l)))
(t_1 (sqrt (/ d h)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
(t_3 (* d (* d l))))
(if (<= t_2 -1e-84)
(*
t_0
(* t_1 (fma (- D_m) (/ (* (* M_m (* h M_m)) (* D_m 0.125)) t_3) 1.0)))
(if (<= t_2 1e-170)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= t_2 2e+154)
(sqrt (* (/ d h) (/ d l)))
(if (<= t_2 1e+277)
(*
t_1
(*
t_0
(fma (- D_m) (/ (* 0.125 (* D_m (* h (* M_m M_m)))) t_3) 1.0)))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l))))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / l));
double t_1 = sqrt((d / h));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double t_3 = d * (d * l);
double tmp;
if (t_2 <= -1e-84) {
tmp = t_0 * (t_1 * fma(-D_m, (((M_m * (h * M_m)) * (D_m * 0.125)) / t_3), 1.0));
} else if (t_2 <= 1e-170) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (t_2 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else if (t_2 <= 1e+277) {
tmp = t_1 * (t_0 * fma(-D_m, ((0.125 * (D_m * (h * (M_m * M_m)))) / t_3), 1.0));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / l)) t_1 = sqrt(Float64(d / h)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) t_3 = Float64(d * Float64(d * l)) tmp = 0.0 if (t_2 <= -1e-84) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(-D_m), Float64(Float64(Float64(M_m * Float64(h * M_m)) * Float64(D_m * 0.125)) / t_3), 1.0))); elseif (t_2 <= 1e-170) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (t_2 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); elseif (t_2 <= 1e+277) tmp = Float64(t_1 * Float64(t_0 * fma(Float64(-D_m), Float64(Float64(0.125 * Float64(D_m * Float64(h * Float64(M_m * M_m)))) / t_3), 1.0))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-84], N[(t$95$0 * N[(t$95$1 * N[((-D$95$m) * N[(N[(N[(M$95$m * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * 0.125), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-170], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, 1e+277], N[(t$95$1 * N[(t$95$0 * N[((-D$95$m) * N[(N[(0.125 * N[(D$95$m * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{\ell}}\\
t_1 := \sqrt{\frac{d}{h}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
t_3 := d \cdot \left(d \cdot \ell\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-84}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(-D\_m, \frac{\left(M\_m \cdot \left(h \cdot M\_m\right)\right) \cdot \left(D\_m \cdot 0.125\right)}{t\_3}, 1\right)\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-170}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;t\_2 \leq 10^{+277}:\\
\;\;\;\;t\_1 \cdot \left(t\_0 \cdot \mathsf{fma}\left(-D\_m, \frac{0.125 \cdot \left(D\_m \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{t\_3}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < -1e-84Initial program 87.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6463.3
Simplified63.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6462.0
Applied egg-rr62.0%
Applied egg-rr67.0%
if -1e-84 < (*.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.99999999999999983e-171Initial program 49.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6422.0
Simplified22.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6454.5
Simplified54.5%
if 9.99999999999999983e-171 < (*.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)))) < 2.00000000000000007e154Initial program 99.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied egg-rr99.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6499.4
Applied egg-rr99.4%
Applied egg-rr83.3%
Taylor expanded in h around 0
Simplified99.2%
if 2.00000000000000007e154 < (*.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)))) < 1e277Initial program 99.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6472.9
Simplified72.9%
Applied egg-rr72.9%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification74.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ d h)))
(t_1 (sqrt (/ d l)))
(t_2
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0))))))
(t_3 (* d (* d l))))
(if (<= t_2 -1e-84)
(*
t_0
(* t_1 (fma (- D_m) (/ (* (* M_m (* h M_m)) (* D_m 0.125)) t_3) 1.0)))
(if (<= t_2 1e-170)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= t_2 2e+154)
(sqrt (* (/ d h) (/ d l)))
(if (<= t_2 1e+277)
(*
t_0
(*
t_1
(fma (- D_m) (/ (* 0.125 (* D_m (* h (* M_m M_m)))) t_3) 1.0)))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l))))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h));
double t_1 = sqrt((d / l));
double t_2 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double t_3 = d * (d * l);
double tmp;
if (t_2 <= -1e-84) {
tmp = t_0 * (t_1 * fma(-D_m, (((M_m * (h * M_m)) * (D_m * 0.125)) / t_3), 1.0));
} else if (t_2 <= 1e-170) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (t_2 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else if (t_2 <= 1e+277) {
tmp = t_0 * (t_1 * fma(-D_m, ((0.125 * (D_m * (h * (M_m * M_m)))) / t_3), 1.0));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(d / h)) t_1 = sqrt(Float64(d / l)) t_2 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) t_3 = Float64(d * Float64(d * l)) tmp = 0.0 if (t_2 <= -1e-84) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(-D_m), Float64(Float64(Float64(M_m * Float64(h * M_m)) * Float64(D_m * 0.125)) / t_3), 1.0))); elseif (t_2 <= 1e-170) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (t_2 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); elseif (t_2 <= 1e+277) tmp = Float64(t_0 * Float64(t_1 * fma(Float64(-D_m), Float64(Float64(0.125 * Float64(D_m * Float64(h * Float64(M_m * M_m)))) / t_3), 1.0))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e-84], N[(t$95$0 * N[(t$95$1 * N[((-D$95$m) * N[(N[(N[(M$95$m * N[(h * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(D$95$m * 0.125), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e-170], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$2, 1e+277], N[(t$95$0 * N[(t$95$1 * N[((-D$95$m) * N[(N[(0.125 * N[(D$95$m * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}}\\
t_1 := \sqrt{\frac{d}{\ell}}\\
t_2 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
t_3 := d \cdot \left(d \cdot \ell\right)\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-84}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(-D\_m, \frac{\left(M\_m \cdot \left(h \cdot M\_m\right)\right) \cdot \left(D\_m \cdot 0.125\right)}{t\_3}, 1\right)\right)\\
\mathbf{elif}\;t\_2 \leq 10^{-170}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;t\_2 \leq 10^{+277}:\\
\;\;\;\;t\_0 \cdot \left(t\_1 \cdot \mathsf{fma}\left(-D\_m, \frac{0.125 \cdot \left(D\_m \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{t\_3}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < -1e-84Initial program 87.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6463.3
Simplified63.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
clear-numN/A
sqrt-divN/A
metadata-evalN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-/.f6462.0
Applied egg-rr62.0%
Applied egg-rr67.0%
if -1e-84 < (*.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.99999999999999983e-171Initial program 49.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6422.0
Simplified22.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6454.5
Simplified54.5%
if 9.99999999999999983e-171 < (*.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)))) < 2.00000000000000007e154Initial program 99.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied egg-rr99.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6499.4
Applied egg-rr99.4%
Applied egg-rr83.3%
Taylor expanded in h around 0
Simplified99.2%
if 2.00000000000000007e154 < (*.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)))) < 1e277Initial program 99.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6472.9
Simplified72.9%
Applied egg-rr72.9%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification74.4%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(fma
(- D_m)
(/ (* 0.125 (* D_m (* h (* M_m M_m)))) (* d (* d l)))
1.0))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 -1e-34)
t_0
(if (<= t_1 1e-170)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= t_1 2e+154)
(sqrt (* (/ d h) (/ d l)))
(if (<= t_1 1e+277)
t_0
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l))))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((d / h)) * (sqrt((d / l)) * fma(-D_m, ((0.125 * (D_m * (h * (M_m * M_m)))) / (d * (d * l))), 1.0));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -1e-34) {
tmp = t_0;
} else if (t_1 <= 1e-170) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (t_1 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else if (t_1 <= 1e+277) {
tmp = t_0;
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(-D_m), Float64(Float64(0.125 * Float64(D_m * Float64(h * Float64(M_m * M_m)))) / Float64(d * Float64(d * l))), 1.0))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= -1e-34) tmp = t_0; elseif (t_1 <= 1e-170) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (t_1 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); elseif (t_1 <= 1e+277) tmp = t_0; else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[((-D$95$m) * N[(N[(0.125 * N[(D$95$m * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-34], t$95$0, If[LessEqual[t$95$1, 1e-170], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$1, 1e+277], t$95$0, N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(-D\_m, \frac{0.125 \cdot \left(D\_m \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}, 1\right)\right)\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-170}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;t\_1 \leq 10^{+277}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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.99999999999999928e-35 or 2.00000000000000007e154 < (*.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)))) < 1e277Initial program 89.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6465.5
Simplified65.5%
Applied egg-rr66.6%
if -9.99999999999999928e-35 < (*.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.99999999999999983e-171Initial program 51.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6421.3
Simplified21.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.6
Simplified52.6%
if 9.99999999999999983e-171 < (*.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)))) < 2.00000000000000007e154Initial program 99.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied egg-rr99.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6499.4
Applied egg-rr99.4%
Applied egg-rr83.3%
Taylor expanded in h around 0
Simplified99.2%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification73.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l)))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 -1e-34)
t_0
(if (<= t_1 1e-170)
(* d (sqrt (/ 1.0 (* h l))))
(if (<= t_1 2e+154) (sqrt (* (/ d h) (/ d l))) t_0)))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= -1e-34) {
tmp = t_0;
} else if (t_1 <= 1e-170) {
tmp = d * sqrt((1.0 / (h * l)));
} else if (t_1 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= -1e-34) tmp = t_0; elseif (t_1 <= 1e-170) tmp = Float64(d * sqrt(Float64(1.0 / Float64(h * l)))); elseif (t_1 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = t_0; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-34], t$95$0, If[LessEqual[t$95$1, 1e-170], N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-170}:\\
\;\;\;\;d \cdot \sqrt{\frac{1}{h \cdot \ell}}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < -9.99999999999999928e-35 or 2.00000000000000007e154 < (*.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 56.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval57.3
Applied egg-rr57.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6457.3
Applied egg-rr57.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr57.3%
Applied egg-rr65.8%
if -9.99999999999999928e-35 < (*.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.99999999999999983e-171Initial program 51.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6421.3
Simplified21.3%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.6
Simplified52.6%
if 9.99999999999999983e-171 < (*.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)))) < 2.00000000000000007e154Initial program 99.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval99.4
Applied egg-rr99.4%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6499.4
Applied egg-rr99.4%
Applied egg-rr83.3%
Taylor expanded in h around 0
Simplified99.2%
Final simplification72.5%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ (* M_m D_m) d))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 2e+154)
(*
(fma (/ h l) (* -0.5 (* (* t_0 t_0) 0.25)) 1.0)
(sqrt (* (/ d h) (/ d l))))
(if (<= t_1 1e+277)
(*
(sqrt (/ d h))
(*
(sqrt (/ d l))
(fma
(- D_m)
(/ (* 0.125 (* D_m (* h (* M_m M_m)))) (* d (* d l)))
1.0)))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * D_m) / d;
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= 2e+154) {
tmp = fma((h / l), (-0.5 * ((t_0 * t_0) * 0.25)), 1.0) * sqrt(((d / h) * (d / l)));
} else if (t_1 <= 1e+277) {
tmp = sqrt((d / h)) * (sqrt((d / l)) * fma(-D_m, ((0.125 * (D_m * (h * (M_m * M_m)))) / (d * (d * l))), 1.0));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * D_m) / d) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= 2e+154) tmp = Float64(fma(Float64(h / l), Float64(-0.5 * Float64(Float64(t_0 * t_0) * 0.25)), 1.0) * sqrt(Float64(Float64(d / h) * Float64(d / l)))); elseif (t_1 <= 1e+277) tmp = Float64(sqrt(Float64(d / h)) * Float64(sqrt(Float64(d / l)) * fma(Float64(-D_m), Float64(Float64(0.125 * Float64(D_m * Float64(h * Float64(M_m * M_m)))) / Float64(d * Float64(d * l))), 1.0))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+154], N[(N[(N[(h / l), $MachinePrecision] * N[(-0.5 * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+277], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[((-D$95$m) * N[(N[(0.125 * N[(D$95$m * N[(h * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m \cdot D\_m}{d}\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell}, -0.5 \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot 0.25\right), 1\right) \cdot \sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{elif}\;t\_1 \leq 10^{+277}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \mathsf{fma}\left(-D\_m, \frac{0.125 \cdot \left(D\_m \cdot \left(h \cdot \left(M\_m \cdot M\_m\right)\right)\right)}{d \cdot \left(d \cdot \ell\right)}, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < 2.00000000000000007e154Initial program 86.3%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval86.0
Applied egg-rr86.0%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6486.0
Applied egg-rr86.0%
Applied egg-rr57.3%
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
*-commutativeN/A
metadata-evalN/A
metadata-evalN/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
pow2N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
div-invN/A
metadata-evalN/A
unpow-prod-downN/A
Applied egg-rr75.3%
if 2.00000000000000007e154 < (*.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)))) < 1e277Initial program 99.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6472.9
Simplified72.9%
Applied egg-rr72.9%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification73.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0
(*
(/ (fabs d) (sqrt (* h l)))
(-
1.0
(/ (* (* 0.125 (* M_m M_m)) (* h (* D_m D_m))) (* d (* d l))))))
(t_1
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))))
(if (<= t_1 5e-201)
t_0
(if (<= t_1 2e+154) (sqrt (* (/ d h) (/ d l))) t_0))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (fabs(d) / sqrt((h * l))) * (1.0 - (((0.125 * (M_m * M_m)) * (h * (D_m * D_m))) / (d * (d * l))));
double t_1 = (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= 5e-201) {
tmp = t_0;
} else if (t_1 <= 2e+154) {
tmp = sqrt(((d / h) * (d / l)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (abs(d) / sqrt((h * l))) * (1.0d0 - (((0.125d0 * (m_m * m_m)) * (h * (d_m * d_m))) / (d * (d * l))))
t_1 = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 + ((h / l) * ((((m_m * d_m) / (d * 2.0d0)) ** 2.0d0) * ((-1.0d0) / 2.0d0))))
if (t_1 <= 5d-201) then
tmp = t_0
else if (t_1 <= 2d+154) then
tmp = sqrt(((d / h) * (d / l)))
else
tmp = t_0
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (Math.abs(d) / Math.sqrt((h * l))) * (1.0 - (((0.125 * (M_m * M_m)) * (h * (D_m * D_m))) / (d * (d * l))));
double t_1 = (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (Math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))));
double tmp;
if (t_1 <= 5e-201) {
tmp = t_0;
} else if (t_1 <= 2e+154) {
tmp = Math.sqrt(((d / h) * (d / l)));
} else {
tmp = t_0;
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = (math.fabs(d) / math.sqrt((h * l))) * (1.0 - (((0.125 * (M_m * M_m)) * (h * (D_m * D_m))) / (d * (d * l)))) t_1 = (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (math.pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0)))) tmp = 0 if t_1 <= 5e-201: tmp = t_0 elif t_1 <= 2e+154: tmp = math.sqrt(((d / h) * (d / l))) else: tmp = t_0 return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(abs(d) / sqrt(Float64(h * l))) * Float64(1.0 - Float64(Float64(Float64(0.125 * Float64(M_m * M_m)) * Float64(h * Float64(D_m * D_m))) / Float64(d * Float64(d * l))))) t_1 = Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) tmp = 0.0 if (t_1 <= 5e-201) tmp = t_0; elseif (t_1 <= 2e+154) tmp = sqrt(Float64(Float64(d / h) * Float64(d / l))); else tmp = t_0; end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = (abs(d) / sqrt((h * l))) * (1.0 - (((0.125 * (M_m * M_m)) * (h * (D_m * D_m))) / (d * (d * l))));
t_1 = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 + ((h / l) * ((((M_m * D_m) / (d * 2.0)) ^ 2.0) * (-1.0 / 2.0))));
tmp = 0.0;
if (t_1 <= 5e-201)
tmp = t_0;
elseif (t_1 <= 2e+154)
tmp = sqrt(((d / h) * (d / l)));
else
tmp = t_0;
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(0.125 * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision] * N[(h * N[(D$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d * N[(d * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-201], t$95$0, If[LessEqual[t$95$1, 2e+154], N[Sqrt[N[(N[(d / h), $MachinePrecision] * N[(d / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{\left|d\right|}{\sqrt{h \cdot \ell}} \cdot \left(1 - \frac{\left(0.125 \cdot \left(M\_m \cdot M\_m\right)\right) \cdot \left(h \cdot \left(D\_m \cdot D\_m\right)\right)}{d \cdot \left(d \cdot \ell\right)}\right)\\
t_1 := \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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right)\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-201}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+154}:\\
\;\;\;\;\sqrt{\frac{d}{h} \cdot \frac{d}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) < 4.9999999999999999e-201 or 2.00000000000000007e154 < (*.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 55.2%
Applied egg-rr51.5%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
pow1/2N/A
metadata-evalN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6426.9
Applied egg-rr26.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6426.4
Simplified26.4%
Applied egg-rr58.4%
if 4.9999999999999999e-201 < (*.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)))) < 2.00000000000000007e154Initial program 98.6%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval97.9
Applied egg-rr97.9%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6497.9
Applied egg-rr97.9%
Applied egg-rr79.6%
Taylor expanded in h around 0
Simplified94.9%
Final simplification67.7%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (/ (* M_m D_m) (* d -2.0))))
(if (<=
(*
(* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0)))
(+
1.0
(* (/ h l) (* (pow (/ (* M_m D_m) (* d 2.0)) 2.0) (/ -1.0 2.0)))))
1e+277)
(*
(* (sqrt (/ d l)) (sqrt (/ d h)))
(+ 1.0 (* (/ h l) (* (* t_0 t_0) (/ -1.0 2.0)))))
(*
(fma
-0.5
(/ (* h (* D_m (* M_m (* M_m D_m)))) (* l (* d (* d 4.0))))
1.0)
(/ (fabs d) (sqrt (* h l)))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = (M_m * D_m) / (d * -2.0);
double tmp;
if (((pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 + ((h / l) * (pow(((M_m * D_m) / (d * 2.0)), 2.0) * (-1.0 / 2.0))))) <= 1e+277) {
tmp = (sqrt((d / l)) * sqrt((d / h))) * (1.0 + ((h / l) * ((t_0 * t_0) * (-1.0 / 2.0))));
} else {
tmp = fma(-0.5, ((h * (D_m * (M_m * (M_m * D_m)))) / (l * (d * (d * 4.0)))), 1.0) * (fabs(d) / sqrt((h * l)));
}
return tmp;
}
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = Float64(Float64(M_m * D_m) / Float64(d * -2.0)) tmp = 0.0 if (Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 + Float64(Float64(h / l) * Float64((Float64(Float64(M_m * D_m) / Float64(d * 2.0)) ^ 2.0) * Float64(-1.0 / 2.0))))) <= 1e+277) tmp = Float64(Float64(sqrt(Float64(d / l)) * sqrt(Float64(d / h))) * Float64(1.0 + Float64(Float64(h / l) * Float64(Float64(t_0 * t_0) * Float64(-1.0 / 2.0))))); else tmp = Float64(fma(-0.5, Float64(Float64(h * Float64(D_m * Float64(M_m * Float64(M_m * D_m)))) / Float64(l * Float64(d * Float64(d * 4.0)))), 1.0) * Float64(abs(d) / sqrt(Float64(h * l)))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * -2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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[(h / l), $MachinePrecision] * N[(N[Power[N[(N[(M$95$m * D$95$m), $MachinePrecision] / N[(d * 2.0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+277], N[(N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(h / l), $MachinePrecision] * N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(-1.0 / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[(N[(h * N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * N[(d * N[(d * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Abs[d], $MachinePrecision] / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M\_m \cdot D\_m}{d \cdot -2}\\
\mathbf{if}\;\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 + \frac{h}{\ell} \cdot \left({\left(\frac{M\_m \cdot D\_m}{d \cdot 2}\right)}^{2} \cdot \frac{-1}{2}\right)\right) \leq 10^{+277}:\\
\;\;\;\;\left(\sqrt{\frac{d}{\ell}} \cdot \sqrt{\frac{d}{h}}\right) \cdot \left(1 + \frac{h}{\ell} \cdot \left(\left(t\_0 \cdot t\_0\right) \cdot \frac{-1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \frac{h \cdot \left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right)}{\ell \cdot \left(d \cdot \left(d \cdot 4\right)\right)}, 1\right) \cdot \frac{\left|d\right|}{\sqrt{h \cdot \ell}}\\
\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)))) < 1e277Initial program 87.4%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval87.1
Applied egg-rr87.1%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.1
Applied egg-rr87.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr87.1%
clear-numN/A
lift-/.f64N/A
inv-powN/A
pow-powN/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6487.4
Applied egg-rr87.4%
if 1e277 < (*.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 16.2%
clear-numN/A
inv-powN/A
lift-/.f64N/A
pow-powN/A
lower-pow.f64N/A
lower-/.f64N/A
lift-/.f64N/A
metadata-evalN/A
metadata-eval18.3
Applied egg-rr18.3%
lift-/.f64N/A
metadata-evalN/A
unpow1/2N/A
lower-sqrt.f6418.3
Applied egg-rr18.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
unpow2N/A
lift-/.f64N/A
frac-2negN/A
lift-/.f64N/A
distribute-frac-negN/A
frac-2negN/A
distribute-frac-negN/A
sqr-negN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
Applied egg-rr18.3%
Applied egg-rr68.7%
Final simplification81.9%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ h (* l (* l l))))))
(if (<= d -3.2e-40)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= d 8e-269)
(* (/ 0.125 d) (* (* D_m (* M_m (* M_m D_m))) t_0))
(if (<= d 4.3e-36)
(* (* D_m D_m) (/ (* t_0 (* (* M_m M_m) -0.125)) d))
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((h / (l * (l * l))));
double tmp;
if (d <= -3.2e-40) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (d <= 8e-269) {
tmp = (0.125 / d) * ((D_m * (M_m * (M_m * D_m))) * t_0);
} else if (d <= 4.3e-36) {
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h / (l * (l * l))))
if (d <= (-3.2d-40)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (d <= 8d-269) then
tmp = (0.125d0 / d) * ((d_m * (m_m * (m_m * d_m))) * t_0)
else if (d <= 4.3d-36) then
tmp = (d_m * d_m) * ((t_0 * ((m_m * m_m) * (-0.125d0))) / d)
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((h / (l * (l * l))));
double tmp;
if (d <= -3.2e-40) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (d <= 8e-269) {
tmp = (0.125 / d) * ((D_m * (M_m * (M_m * D_m))) * t_0);
} else if (d <= 4.3e-36) {
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((h / (l * (l * l)))) tmp = 0 if d <= -3.2e-40: tmp = math.sqrt((1.0 / (h * l))) * -d elif d <= 8e-269: tmp = (0.125 / d) * ((D_m * (M_m * (M_m * D_m))) * t_0) elif d <= 4.3e-36: tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(h / Float64(l * Float64(l * l)))) tmp = 0.0 if (d <= -3.2e-40) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (d <= 8e-269) tmp = Float64(Float64(0.125 / d) * Float64(Float64(D_m * Float64(M_m * Float64(M_m * D_m))) * t_0)); elseif (d <= 4.3e-36) tmp = Float64(Float64(D_m * D_m) * Float64(Float64(t_0 * Float64(Float64(M_m * M_m) * -0.125)) / d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((h / (l * (l * l))));
tmp = 0.0;
if (d <= -3.2e-40)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (d <= 8e-269)
tmp = (0.125 / d) * ((D_m * (M_m * (M_m * D_m))) * t_0);
elseif (d <= 4.3e-36)
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.2e-40], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[d, 8e-269], N[(N[(0.125 / d), $MachinePrecision] * N[(N[(D$95$m * N[(M$95$m * N[(M$95$m * D$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.3e-36], N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(t$95$0 * N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\\
\mathbf{if}\;d \leq -3.2 \cdot 10^{-40}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq 8 \cdot 10^{-269}:\\
\;\;\;\;\frac{0.125}{d} \cdot \left(\left(D\_m \cdot \left(M\_m \cdot \left(M\_m \cdot D\_m\right)\right)\right) \cdot t\_0\right)\\
\mathbf{elif}\;d \leq 4.3 \cdot 10^{-36}:\\
\;\;\;\;\left(D\_m \cdot D\_m\right) \cdot \frac{t\_0 \cdot \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -3.20000000000000002e-40Initial program 70.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6457.4
Simplified57.4%
Taylor expanded in l around -inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Simplified66.8%
if -3.20000000000000002e-40 < d < 7.9999999999999997e-269Initial program 54.5%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6434.5
Simplified34.5%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-/l*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
associate-*r*N/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Simplified42.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
Applied egg-rr48.9%
if 7.9999999999999997e-269 < d < 4.3000000000000002e-36Initial program 65.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6440.8
Simplified40.8%
Taylor expanded in d around 0
*-commutativeN/A
associate-/l*N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
Simplified41.0%
if 4.3000000000000002e-36 < d Initial program 73.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6454.1
Simplified54.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.1
Simplified59.1%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6459.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.2
Applied egg-rr59.2%
lift-*.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.0
Applied egg-rr75.0%
Final simplification59.2%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(let* ((t_0 (sqrt (/ h (* l (* l l))))))
(if (<= d -2.05e-41)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= d -1e-310)
(* t_0 (* (/ 0.125 d) (* D_m (* D_m (* M_m M_m)))))
(if (<= d 4.3e-36)
(* (* D_m D_m) (/ (* t_0 (* (* M_m M_m) -0.125)) d))
(/ d (* (sqrt l) (sqrt h))))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = sqrt((h / (l * (l * l))));
double tmp;
if (d <= -2.05e-41) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (d <= -1e-310) {
tmp = t_0 * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
} else if (d <= 4.3e-36) {
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((h / (l * (l * l))))
if (d <= (-2.05d-41)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (d <= (-1d-310)) then
tmp = t_0 * ((0.125d0 / d) * (d_m * (d_m * (m_m * m_m))))
else if (d <= 4.3d-36) then
tmp = (d_m * d_m) * ((t_0 * ((m_m * m_m) * (-0.125d0))) / d)
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double t_0 = Math.sqrt((h / (l * (l * l))));
double tmp;
if (d <= -2.05e-41) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (d <= -1e-310) {
tmp = t_0 * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
} else if (d <= 4.3e-36) {
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): t_0 = math.sqrt((h / (l * (l * l)))) tmp = 0 if d <= -2.05e-41: tmp = math.sqrt((1.0 / (h * l))) * -d elif d <= -1e-310: tmp = t_0 * ((0.125 / d) * (D_m * (D_m * (M_m * M_m)))) elif d <= 4.3e-36: tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) t_0 = sqrt(Float64(h / Float64(l * Float64(l * l)))) tmp = 0.0 if (d <= -2.05e-41) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (d <= -1e-310) tmp = Float64(t_0 * Float64(Float64(0.125 / d) * Float64(D_m * Float64(D_m * Float64(M_m * M_m))))); elseif (d <= 4.3e-36) tmp = Float64(Float64(D_m * D_m) * Float64(Float64(t_0 * Float64(Float64(M_m * M_m) * -0.125)) / d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
t_0 = sqrt((h / (l * (l * l))));
tmp = 0.0;
if (d <= -2.05e-41)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (d <= -1e-310)
tmp = t_0 * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
elseif (d <= 4.3e-36)
tmp = (D_m * D_m) * ((t_0 * ((M_m * M_m) * -0.125)) / d);
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision]
M_m = N[Abs[M], $MachinePrecision]
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M$95$m_, D$95$m_] := Block[{t$95$0 = N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -2.05e-41], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[d, -1e-310], N[(t$95$0 * N[(N[(0.125 / d), $MachinePrecision] * N[(D$95$m * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.3e-36], N[(N[(D$95$m * D$95$m), $MachinePrecision] * N[(N[(t$95$0 * N[(N[(M$95$m * M$95$m), $MachinePrecision] * -0.125), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}}\\
\mathbf{if}\;d \leq -2.05 \cdot 10^{-41}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \left(\frac{0.125}{d} \cdot \left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)\\
\mathbf{elif}\;d \leq 4.3 \cdot 10^{-36}:\\
\;\;\;\;\left(D\_m \cdot D\_m\right) \cdot \frac{t\_0 \cdot \left(\left(M\_m \cdot M\_m\right) \cdot -0.125\right)}{d}\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.05000000000000007e-41Initial program 70.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6457.4
Simplified57.4%
Taylor expanded in l around -inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Simplified66.8%
if -2.05000000000000007e-41 < d < -9.999999999999969e-311Initial program 56.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.8
Simplified36.8%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-/l*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
associate-*r*N/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Simplified45.5%
if -9.999999999999969e-311 < d < 4.3000000000000002e-36Initial program 62.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6438.0
Simplified38.0%
Taylor expanded in d around 0
*-commutativeN/A
associate-/l*N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
Simplified38.3%
if 4.3000000000000002e-36 < d Initial program 73.6%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6454.1
Simplified54.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.1
Simplified59.1%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6459.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.2
Applied egg-rr59.2%
lift-*.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6475.0
Applied egg-rr75.0%
Final simplification57.6%
D_m = (fabs.f64 D)
M_m = (fabs.f64 M)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M_m D_m)
:precision binary64
(if (<= d -2.05e-41)
(* (sqrt (/ 1.0 (* h l))) (- d))
(if (<= d -1e-310)
(* (sqrt (/ h (* l (* l l)))) (* (/ 0.125 d) (* D_m (* D_m (* M_m M_m)))))
(/ d (* (sqrt l) (sqrt h))))))D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.05e-41) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else if (d <= -1e-310) {
tmp = sqrt((h / (l * (l * l)))) * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (d <= (-2.05d-41)) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else if (d <= (-1d-310)) then
tmp = sqrt((h / (l * (l * l)))) * ((0.125d0 / d) * (d_m * (d_m * (m_m * m_m))))
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (d <= -2.05e-41) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else if (d <= -1e-310) {
tmp = Math.sqrt((h / (l * (l * l)))) * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if d <= -2.05e-41: tmp = math.sqrt((1.0 / (h * l))) * -d elif d <= -1e-310: tmp = math.sqrt((h / (l * (l * l)))) * ((0.125 / d) * (D_m * (D_m * (M_m * M_m)))) else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (d <= -2.05e-41) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); elseif (d <= -1e-310) tmp = Float64(sqrt(Float64(h / Float64(l * Float64(l * l)))) * Float64(Float64(0.125 / d) * Float64(D_m * Float64(D_m * Float64(M_m * M_m))))); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (d <= -2.05e-41)
tmp = sqrt((1.0 / (h * l))) * -d;
elseif (d <= -1e-310)
tmp = sqrt((h / (l * (l * l)))) * ((0.125 / d) * (D_m * (D_m * (M_m * M_m))));
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[d, -2.05e-41], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], If[LessEqual[d, -1e-310], N[(N[Sqrt[N[(h / N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(0.125 / d), $MachinePrecision] * N[(D$95$m * N[(D$95$m * N[(M$95$m * M$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -2.05 \cdot 10^{-41}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{elif}\;d \leq -1 \cdot 10^{-310}:\\
\;\;\;\;\sqrt{\frac{h}{\ell \cdot \left(\ell \cdot \ell\right)}} \cdot \left(\frac{0.125}{d} \cdot \left(D\_m \cdot \left(D\_m \cdot \left(M\_m \cdot M\_m\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if d < -2.05000000000000007e-41Initial program 70.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6457.4
Simplified57.4%
Taylor expanded in l around -inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.8
Simplified66.8%
if -2.05000000000000007e-41 < d < -9.999999999999969e-311Initial program 56.4%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6436.8
Simplified36.8%
Taylor expanded in h around -inf
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
associate-/l*N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
associate-*r*N/A
associate-/l*N/A
distribute-lft-neg-inN/A
metadata-evalN/A
Simplified45.5%
if -9.999999999999969e-311 < d Initial program 68.9%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6447.1
Simplified47.1%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.6
Simplified43.6%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6444.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6444.2
Applied egg-rr44.2%
lift-*.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6456.1
Applied egg-rr56.1%
Final simplification56.0%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 1.25e-226) (* (sqrt (/ 1.0 (* h l))) (- d)) (/ d (* (sqrt l) (sqrt h)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.25e-226) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else {
tmp = d / (sqrt(l) * sqrt(h));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 1.25d-226) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else
tmp = d / (sqrt(l) * sqrt(h))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 1.25e-226) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else {
tmp = d / (Math.sqrt(l) * Math.sqrt(h));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 1.25e-226: tmp = math.sqrt((1.0 / (h * l))) * -d else: tmp = d / (math.sqrt(l) * math.sqrt(h)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 1.25e-226) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(l) * sqrt(h))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 1.25e-226)
tmp = sqrt((1.0 / (h * l))) * -d;
else
tmp = d / (sqrt(l) * sqrt(h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 1.25e-226], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[h], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.25 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell} \cdot \sqrt{h}}\\
\end{array}
\end{array}
if l < 1.2499999999999999e-226Initial program 64.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6446.5
Simplified46.5%
Taylor expanded in l around -inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.5
Simplified43.5%
if 1.2499999999999999e-226 < l Initial program 68.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6447.7
Simplified47.7%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6448.0
Simplified48.0%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6448.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.6
Applied egg-rr48.6%
lift-*.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
lift-/.f64N/A
unpow-prod-downN/A
lower-*.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
lift-/.f64N/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f6461.0
Applied egg-rr61.0%
Final simplification51.4%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (if (<= l 2.35e-226) (* (sqrt (/ 1.0 (* h l))) (- d)) (/ d (sqrt (* h l)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.35e-226) {
tmp = sqrt((1.0 / (h * l))) * -d;
} else {
tmp = d / sqrt((h * l));
}
return tmp;
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
real(8) :: tmp
if (l <= 2.35d-226) then
tmp = sqrt((1.0d0 / (h * l))) * -d
else
tmp = d / sqrt((h * l))
end if
code = tmp
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
double tmp;
if (l <= 2.35e-226) {
tmp = Math.sqrt((1.0 / (h * l))) * -d;
} else {
tmp = d / Math.sqrt((h * l));
}
return tmp;
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): tmp = 0 if l <= 2.35e-226: tmp = math.sqrt((1.0 / (h * l))) * -d else: tmp = d / math.sqrt((h * l)) return tmp
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) tmp = 0.0 if (l <= 2.35e-226) tmp = Float64(sqrt(Float64(1.0 / Float64(h * l))) * Float64(-d)); else tmp = Float64(d / sqrt(Float64(h * l))); end return tmp end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp_2 = code(d, h, l, M_m, D_m)
tmp = 0.0;
if (l <= 2.35e-226)
tmp = sqrt((1.0 / (h * l))) * -d;
else
tmp = d / sqrt((h * l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := If[LessEqual[l, 2.35e-226], N[(N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.35 \cdot 10^{-226}:\\
\;\;\;\;\sqrt{\frac{1}{h \cdot \ell}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h \cdot \ell}}\\
\end{array}
\end{array}
if l < 2.34999999999999999e-226Initial program 64.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6446.5
Simplified46.5%
Taylor expanded in l around -inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
neg-mul-1N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.5
Simplified43.5%
if 2.34999999999999999e-226 < l Initial program 68.7%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6447.7
Simplified47.7%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6448.0
Simplified48.0%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6448.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6448.6
Applied egg-rr48.6%
Final simplification45.8%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (* d (sqrt (/ 1.0 (* h l)))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d * sqrt((1.0 / (h * l)));
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d * sqrt((1.0d0 / (h * l)))
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d * Math.sqrt((1.0 / (h * l)));
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d * math.sqrt((1.0 / (h * l)))
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d * sqrt(Float64(1.0 / Float64(h * l)))) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d * sqrt((1.0 / (h * l)));
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d * N[Sqrt[N[(1.0 / N[(h * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
d \cdot \sqrt{\frac{1}{h \cdot \ell}}
\end{array}
Initial program 66.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6447.0
Simplified47.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.5
Simplified26.5%
Final simplification26.5%
D_m = (fabs.f64 D) M_m = (fabs.f64 M) NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M_m D_m) :precision binary64 (/ d (sqrt (* h l))))
D_m = fabs(D);
M_m = fabs(M);
assert(d < h && h < l && l < M_m && M_m < D_m);
double code(double d, double h, double l, double M_m, double D_m) {
return d / sqrt((h * l));
}
D_m = abs(d)
M_m = abs(m)
NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m_m, d_m)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m_m
real(8), intent (in) :: d_m
code = d / sqrt((h * l))
end function
D_m = Math.abs(D);
M_m = Math.abs(M);
assert d < h && h < l && l < M_m && M_m < D_m;
public static double code(double d, double h, double l, double M_m, double D_m) {
return d / Math.sqrt((h * l));
}
D_m = math.fabs(D) M_m = math.fabs(M) [d, h, l, M_m, D_m] = sort([d, h, l, M_m, D_m]) def code(d, h, l, M_m, D_m): return d / math.sqrt((h * l))
D_m = abs(D) M_m = abs(M) d, h, l, M_m, D_m = sort([d, h, l, M_m, D_m]) function code(d, h, l, M_m, D_m) return Float64(d / sqrt(Float64(h * l))) end
D_m = abs(D);
M_m = abs(M);
d, h, l, M_m, D_m = num2cell(sort([d, h, l, M_m, D_m])){:}
function tmp = code(d, h, l, M_m, D_m)
tmp = d / sqrt((h * l));
end
D_m = N[Abs[D], $MachinePrecision] M_m = N[Abs[M], $MachinePrecision] NOTE: d, h, l, M_m, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M$95$m_, D$95$m_] := N[(d / N[Sqrt[N[(h * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
M_m = \left|M\right|
\\
[d, h, l, M_m, D_m] = \mathsf{sort}([d, h, l, M_m, D_m])\\
\\
\frac{d}{\sqrt{h \cdot \ell}}
\end{array}
Initial program 66.3%
Taylor expanded in M around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6447.0
Simplified47.0%
Taylor expanded in d around inf
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6426.5
Simplified26.5%
lift-*.f64N/A
sqrt-divN/A
metadata-evalN/A
un-div-invN/A
lower-/.f64N/A
lower-sqrt.f6426.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6426.4
Applied egg-rr26.4%
herbie shell --seed 2024208
(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)))))