
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d h l M D) :precision binary64 (* (* (pow (/ d h) (/ 1.0 2.0)) (pow (/ d l) (/ 1.0 2.0))) (- 1.0 (* (* (/ 1.0 2.0) (pow (/ (* M D) (* 2.0 d)) 2.0)) (/ h l)))))
double code(double d, double h, double l, double M, double D) {
return (pow((d / h), (1.0 / 2.0)) * pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
real(8) function code(d, h, l, m, d_1)
real(8), intent (in) :: d
real(8), intent (in) :: h
real(8), intent (in) :: l
real(8), intent (in) :: m
real(8), intent (in) :: d_1
code = (((d / h) ** (1.0d0 / 2.0d0)) * ((d / l) ** (1.0d0 / 2.0d0))) * (1.0d0 - (((1.0d0 / 2.0d0) * (((m * d_1) / (2.0d0 * d)) ** 2.0d0)) * (h / l)))
end function
public static double code(double d, double h, double l, double M, double D) {
return (Math.pow((d / h), (1.0 / 2.0)) * Math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * Math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)));
}
def code(d, h, l, M, D): return (math.pow((d / h), (1.0 / 2.0)) * math.pow((d / l), (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * math.pow(((M * D) / (2.0 * d)), 2.0)) * (h / l)))
function code(d, h, l, M, D) return Float64(Float64((Float64(d / h) ^ Float64(1.0 / 2.0)) * (Float64(d / l) ^ Float64(1.0 / 2.0))) * Float64(1.0 - Float64(Float64(Float64(1.0 / 2.0) * (Float64(Float64(M * D) / Float64(2.0 * d)) ^ 2.0)) * Float64(h / l)))) end
function tmp = code(d, h, l, M, D) tmp = (((d / h) ^ (1.0 / 2.0)) * ((d / l) ^ (1.0 / 2.0))) * (1.0 - (((1.0 / 2.0) * (((M * D) / (2.0 * d)) ^ 2.0)) * (h / l))); end
code[d_, h_, l_, M_, D_] := N[(N[(N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[(N[(N[(1.0 / 2.0), $MachinePrecision] * N[Power[N[(N[(M * D), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left({\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)}\right) \cdot \left(1 - \left(\frac{1}{2} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}\right) \cdot \frac{h}{\ell}\right)
\end{array}
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ h l) -0.5)) (t_1 (sqrt (- d))))
(if (<= h -3.5e+58)
(*
(fma
(* (* M (* D_m (/ 0.5 d))) -0.5)
(/ (* (* D_m 0.5) (* M h)) (* l d))
1.0)
(* (sqrt (/ d l)) (/ t_1 (sqrt (- h)))))
(if (<= h -1e-309)
(/
(*
(* (sqrt (/ d h)) (fma t_0 (pow (* (/ d D_m) (/ 2.0 M)) -2.0) 1.0))
t_1)
(sqrt (- l)))
(/
(*
(/
(* (sqrt d) (fma (* (pow (/ (/ d D_m) M) -2.0) 0.25) t_0 1.0))
(sqrt l))
(sqrt d))
(sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (h / l) * -0.5;
double t_1 = sqrt(-d);
double tmp;
if (h <= -3.5e+58) {
tmp = fma(((M * (D_m * (0.5 / d))) * -0.5), (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (sqrt((d / l)) * (t_1 / sqrt(-h)));
} else if (h <= -1e-309) {
tmp = ((sqrt((d / h)) * fma(t_0, pow(((d / D_m) * (2.0 / M)), -2.0), 1.0)) * t_1) / sqrt(-l);
} else {
tmp = (((sqrt(d) * fma((pow(((d / D_m) / M), -2.0) * 0.25), t_0, 1.0)) / sqrt(l)) * sqrt(d)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(h / l) * -0.5) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -3.5e+58) tmp = Float64(fma(Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5), Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(sqrt(Float64(d / l)) * Float64(t_1 / sqrt(Float64(-h))))); elseif (h <= -1e-309) tmp = Float64(Float64(Float64(sqrt(Float64(d / h)) * fma(t_0, (Float64(Float64(d / D_m) * Float64(2.0 / M)) ^ -2.0), 1.0)) * t_1) / sqrt(Float64(-l))); else tmp = Float64(Float64(Float64(Float64(sqrt(d) * fma(Float64((Float64(Float64(d / D_m) / M) ^ -2.0) * 0.25), t_0, 1.0)) / sqrt(l)) * sqrt(d)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -3.5e+58], N[(N[(N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-309], N[(N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Power[N[(N[(d / D$95$m), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[Sqrt[d], $MachinePrecision] * N[(N[(N[Power[N[(N[(d / D$95$m), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision] * 0.25), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{h}{\ell} \cdot -0.5\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -3.5 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(\left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{t\_1}{\sqrt{-h}}\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(t\_0, {\left(\frac{d}{D\_m} \cdot \frac{2}{M}\right)}^{-2}, 1\right)\right) \cdot t\_1}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\sqrt{d} \cdot \mathsf{fma}\left({\left(\frac{\frac{d}{D\_m}}{M}\right)}^{-2} \cdot 0.25, t\_0, 1\right)}{\sqrt{\ell}} \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -3.4999999999999997e58Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6461.5
Applied rewrites61.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6468.2
Applied rewrites68.2%
if -3.4999999999999997e58 < h < -1.000000000000002e-309Initial program 82.6%
Applied rewrites89.3%
if -1.000000000000002e-309 < h Initial program 69.8%
Applied rewrites79.1%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
lift-sqrt.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites83.7%
Final simplification82.9%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_0 -4e-130)
(*
(fma
(/ D_m d)
(* (* (* M -0.5) (* (/ D_m d) 0.5)) (* (* (/ h l) M) 0.5))
1.0)
(sqrt (* (/ (/ d l) h) d)))
(if (<= t_0 2e-202)
(/ (/ (- d) (sqrt (- h))) (sqrt (- l)))
(* (sqrt (/ d h)) (sqrt (/ d l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_0 <= -4e-130) {
tmp = fma((D_m / d), (((M * -0.5) * ((D_m / d) * 0.5)) * (((h / l) * M) * 0.5)), 1.0) * sqrt((((d / l) / h) * d));
} else if (t_0 <= 2e-202) {
tmp = (-d / sqrt(-h)) / sqrt(-l);
} else {
tmp = sqrt((d / h)) * sqrt((d / l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_0 <= -4e-130) tmp = Float64(fma(Float64(D_m / d), Float64(Float64(Float64(M * -0.5) * Float64(Float64(D_m / d) * 0.5)) * Float64(Float64(Float64(h / l) * M) * 0.5)), 1.0) * sqrt(Float64(Float64(Float64(d / l) / h) * d))); elseif (t_0 <= 2e-202) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(-h))) / sqrt(Float64(-l))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-130], N[(N[(N[(D$95$m / d), $MachinePrecision] * N[(N[(N[(M * -0.5), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-202], N[(N[((-d) / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-130}:\\
\;\;\;\;\mathsf{fma}\left(\frac{D\_m}{d}, \left(\left(M \cdot -0.5\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right)\right) \cdot \left(\left(\frac{h}{\ell} \cdot M\right) \cdot 0.5\right), 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-202}:\\
\;\;\;\;\frac{\frac{-d}{\sqrt{-h}}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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)))) < -4.0000000000000003e-130Initial program 89.9%
Applied rewrites79.1%
Applied rewrites78.0%
if -4.0000000000000003e-130 < (*.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.0000000000000001e-202Initial program 24.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.8
Applied rewrites24.8%
Applied rewrites41.6%
Applied rewrites53.5%
if 2.0000000000000001e-202 < (*.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 65.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.2
Applied rewrites31.2%
Applied rewrites72.3%
Final simplification73.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ D_m d) 0.5))
(t_1
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))))
(if (<= t_1 -4e-130)
(*
(fma (* (/ h l) M) (* (* t_0 M) (* t_0 -0.5)) 1.0)
(sqrt (* (/ (/ d l) h) d)))
(if (<= t_1 2e-202)
(/ (/ (- d) (sqrt (- h))) (sqrt (- l)))
(* (sqrt (/ d h)) (sqrt (/ d l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (D_m / d) * 0.5;
double t_1 = (1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)));
double tmp;
if (t_1 <= -4e-130) {
tmp = fma(((h / l) * M), ((t_0 * M) * (t_0 * -0.5)), 1.0) * sqrt((((d / l) / h) * d));
} else if (t_1 <= 2e-202) {
tmp = (-d / sqrt(-h)) / sqrt(-l);
} else {
tmp = sqrt((d / h)) * sqrt((d / l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(D_m / d) * 0.5) t_1 = Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) tmp = 0.0 if (t_1 <= -4e-130) tmp = Float64(fma(Float64(Float64(h / l) * M), Float64(Float64(t_0 * M) * Float64(t_0 * -0.5)), 1.0) * sqrt(Float64(Float64(Float64(d / l) / h) * d))); elseif (t_1 <= 2e-202) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(-h))) / sqrt(Float64(-l))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-130], N[(N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(t$95$0 * M), $MachinePrecision] * N[(t$95$0 * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-202], N[(N[((-d) / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{D\_m}{d} \cdot 0.5\\
t_1 := \left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-130}:\\
\;\;\;\;\mathsf{fma}\left(\frac{h}{\ell} \cdot M, \left(t\_0 \cdot M\right) \cdot \left(t\_0 \cdot -0.5\right), 1\right) \cdot \sqrt{\frac{\frac{d}{\ell}}{h} \cdot d}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-202}:\\
\;\;\;\;\frac{\frac{-d}{\sqrt{-h}}}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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)))) < -4.0000000000000003e-130Initial program 89.9%
Applied rewrites79.1%
Applied rewrites78.0%
if -4.0000000000000003e-130 < (*.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.0000000000000001e-202Initial program 24.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.8
Applied rewrites24.8%
Applied rewrites41.6%
Applied rewrites53.5%
if 2.0000000000000001e-202 < (*.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 65.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.2
Applied rewrites31.2%
Applied rewrites72.3%
Final simplification73.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
INFINITY)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(fma
(* (* M (* D_m (/ 0.5 d))) -0.5)
(* (* (/ h l) M) (* (/ D_m d) 0.5))
1.0))
(*
(sqrt (* (/ (/ d l) h) d))
(/ (fma (/ (* -0.125 (* (* M M) h)) d) (/ (* D_m D_m) d) l) l))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= ((double) INFINITY)) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * fma(((M * (D_m * (0.5 / d))) * -0.5), (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
} else {
tmp = sqrt((((d / l) / h) * d)) * (fma(((-0.125 * ((M * M) * h)) / d), ((D_m * D_m) / d), l) / l);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= Inf) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * fma(Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5), Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0)); else tmp = Float64(sqrt(Float64(Float64(Float64(d / l) / h) * d)) * Float64(fma(Float64(Float64(-0.125 * Float64(Float64(M * M) * h)) / d), Float64(Float64(D_m * D_m) / d), l) / l)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(-0.125 * N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq \infty:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(\left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d} \cdot \frac{\mathsf{fma}\left(\frac{-0.125 \cdot \left(\left(M \cdot M\right) \cdot h\right)}{d}, \frac{D\_m \cdot D\_m}{d}, \ell\right)}{\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)))) < +inf.0Initial program 87.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites86.8%
lift-/.f64N/A
metadata-eval86.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6486.8
Applied rewrites86.8%
lift-/.f64N/A
metadata-eval86.8
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6486.8
Applied rewrites86.8%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Applied rewrites4.3%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites27.0%
Final simplification76.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
INFINITY)
(*
(fma (* -0.25 (/ (* M D_m) d)) (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0)
(* (sqrt (/ d h)) (sqrt (/ d l))))
(*
(sqrt (* (/ (/ d l) h) d))
(/ (fma (/ (* -0.125 (* (* M M) h)) d) (/ (* D_m D_m) d) l) l))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= ((double) INFINITY)) {
tmp = fma((-0.25 * ((M * D_m) / d)), (((h / l) * M) * ((D_m / d) * 0.5)), 1.0) * (sqrt((d / h)) * sqrt((d / l)));
} else {
tmp = sqrt((((d / l) / h) * d)) * (fma(((-0.125 * ((M * M) * h)) / d), ((D_m * D_m) / d), l) / l);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= Inf) tmp = Float64(fma(Float64(-0.25 * Float64(Float64(M * D_m) / d)), Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) * Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l)))); else tmp = Float64(sqrt(Float64(Float64(Float64(d / l) / h) * d)) * Float64(fma(Float64(Float64(-0.125 * Float64(Float64(M * M) * h)) / d), Float64(Float64(D_m * D_m) / d), l) / l)); end return tmp end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(-0.25 * N[(N[(M * D$95$m), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(N[(d / l), $MachinePrecision] / h), $MachinePrecision] * d), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(N[(-0.125 * N[(N[(M * M), $MachinePrecision] * h), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision] * N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] + l), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-0.25 \cdot \frac{M \cdot D\_m}{d}, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right) \cdot \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\frac{d}{\ell}}{h} \cdot d} \cdot \frac{\mathsf{fma}\left(\frac{-0.125 \cdot \left(\left(M \cdot M\right) \cdot h\right)}{d}, \frac{D\_m \cdot D\_m}{d}, \ell\right)}{\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)))) < +inf.0Initial program 87.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites86.8%
lift-/.f64N/A
metadata-eval86.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6486.8
Applied rewrites86.8%
lift-/.f64N/A
metadata-eval86.8
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6486.8
Applied rewrites86.8%
Taylor expanded in d around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6486.4
Applied rewrites86.4%
if +inf.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 0.0%
Applied rewrites4.3%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites27.0%
Final simplification75.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
0.0)
(* (/ (sqrt (/ h l)) l) (* (* (/ (* D_m D_m) d) -0.125) (* M M)))
(* (sqrt (/ d h)) (sqrt (/ d l)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= 0.0) {
tmp = (sqrt((h / l)) / l) * ((((D_m * D_m) / d) * -0.125) * (M * M));
} else {
tmp = sqrt((d / h)) * sqrt((d / l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (((1.0d0 - (((((m * d_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))) <= 0.0d0) then
tmp = (sqrt((h / l)) / l) * ((((d_m * d_m) / d) * (-0.125d0)) * (m * m))
else
tmp = sqrt((d / h)) * sqrt((d / l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((Math.pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)))) <= 0.0) {
tmp = (Math.sqrt((h / l)) / l) * ((((D_m * D_m) / d) * -0.125) * (M * M));
} else {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if ((1.0 - ((math.pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))) <= 0.0: tmp = (math.sqrt((h / l)) / l) * ((((D_m * D_m) / d) * -0.125) * (M * M)) else: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= 0.0) tmp = Float64(Float64(sqrt(Float64(h / l)) / l) * Float64(Float64(Float64(Float64(D_m * D_m) / d) * -0.125) * Float64(M * M))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (((1.0 - (((((M * D_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)))) <= 0.0)
tmp = (sqrt((h / l)) / l) * ((((D_m * D_m) / d) * -0.125) * (M * M));
else
tmp = sqrt((d / h)) * sqrt((d / l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[Sqrt[N[(h / l), $MachinePrecision]], $MachinePrecision] / l), $MachinePrecision] * N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * -0.125), $MachinePrecision] * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq 0:\\
\;\;\;\;\frac{\sqrt{\frac{h}{\ell}}}{\ell} \cdot \left(\left(\frac{D\_m \cdot D\_m}{d} \cdot -0.125\right) \cdot \left(M \cdot M\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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)))) < 0.0Initial program 79.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6416.6
Applied rewrites16.6%
Taylor expanded in d around 0
associate-*l/N/A
*-commutativeN/A
associate-*r*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites26.0%
Applied rewrites64.2%
if 0.0 < (*.f64 (*.f64 (pow.f64 (/.f64 d h) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64))) (pow.f64 (/.f64 d l) (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)))) (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) #s(literal 2 binary64)) (pow.f64 (/.f64 (*.f64 M D) (*.f64 #s(literal 2 binary64) d)) #s(literal 2 binary64))) (/.f64 h l)))) Initial program 66.0%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Applied rewrites72.4%
Final simplification69.2%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<=
(*
(- 1.0 (* (* (pow (/ (* M D_m) (* 2.0 d)) 2.0) (/ 1.0 2.0)) (/ h l)))
(* (pow (/ d l) (/ 1.0 2.0)) (pow (/ d h) (/ 1.0 2.0))))
-4e-130)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(* (sqrt (/ d h)) (sqrt (/ d l)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (pow((d / l), (1.0 / 2.0)) * pow((d / h), (1.0 / 2.0)))) <= -4e-130) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else {
tmp = sqrt((d / h)) * sqrt((d / l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (((1.0d0 - (((((m * d_m) / (2.0d0 * d)) ** 2.0d0) * (1.0d0 / 2.0d0)) * (h / l))) * (((d / l) ** (1.0d0 / 2.0d0)) * ((d / h) ** (1.0d0 / 2.0d0)))) <= (-4d-130)) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else
tmp = sqrt((d / h)) * sqrt((d / l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (((1.0 - ((Math.pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (Math.pow((d / l), (1.0 / 2.0)) * Math.pow((d / h), (1.0 / 2.0)))) <= -4e-130) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else {
tmp = Math.sqrt((d / h)) * Math.sqrt((d / l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if ((1.0 - ((math.pow(((M * D_m) / (2.0 * d)), 2.0) * (1.0 / 2.0)) * (h / l))) * (math.pow((d / l), (1.0 / 2.0)) * math.pow((d / h), (1.0 / 2.0)))) <= -4e-130: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) else: tmp = math.sqrt((d / h)) * math.sqrt((d / l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (Float64(Float64(1.0 - Float64(Float64((Float64(Float64(M * D_m) / Float64(2.0 * d)) ^ 2.0) * Float64(1.0 / 2.0)) * Float64(h / l))) * Float64((Float64(d / l) ^ Float64(1.0 / 2.0)) * (Float64(d / h) ^ Float64(1.0 / 2.0)))) <= -4e-130) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (((1.0 - (((((M * D_m) / (2.0 * d)) ^ 2.0) * (1.0 / 2.0)) * (h / l))) * (((d / l) ^ (1.0 / 2.0)) * ((d / h) ^ (1.0 / 2.0)))) <= -4e-130)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
else
tmp = sqrt((d / h)) * sqrt((d / l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[N[(N[(1.0 - N[(N[(N[Power[N[(N[(M * D$95$m), $MachinePrecision] / N[(2.0 * d), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[(1.0 / 2.0), $MachinePrecision]), $MachinePrecision] * N[(h / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[(d / l), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Power[N[(d / h), $MachinePrecision], N[(1.0 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -4e-130], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(1 - \left({\left(\frac{M \cdot D\_m}{2 \cdot d}\right)}^{2} \cdot \frac{1}{2}\right) \cdot \frac{h}{\ell}\right) \cdot \left({\left(\frac{d}{\ell}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(\frac{d}{h}\right)}^{\left(\frac{1}{2}\right)}\right) \leq -4 \cdot 10^{-130}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\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)))) < -4.0000000000000003e-130Initial program 89.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6415.0
Applied rewrites15.0%
Applied rewrites15.0%
Applied rewrites20.7%
if -4.0000000000000003e-130 < (*.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 62.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6430.7
Applied rewrites30.7%
Applied rewrites68.1%
Final simplification52.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ h l) -0.5)) (t_1 (sqrt (- d))))
(if (<= h -3.5e+58)
(*
(fma
(* (* M (* D_m (/ 0.5 d))) -0.5)
(/ (* (* D_m 0.5) (* M h)) (* l d))
1.0)
(* (sqrt (/ d l)) (/ t_1 (sqrt (- h)))))
(if (<= h -1e-309)
(/
(*
(* (sqrt (/ d h)) (fma t_0 (pow (* (/ d D_m) (/ 2.0 M)) -2.0) 1.0))
t_1)
(sqrt (- l)))
(/
(* (/ d (sqrt l)) (fma (* (pow (/ (/ d D_m) M) -2.0) 0.25) t_0 1.0))
(sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (h / l) * -0.5;
double t_1 = sqrt(-d);
double tmp;
if (h <= -3.5e+58) {
tmp = fma(((M * (D_m * (0.5 / d))) * -0.5), (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (sqrt((d / l)) * (t_1 / sqrt(-h)));
} else if (h <= -1e-309) {
tmp = ((sqrt((d / h)) * fma(t_0, pow(((d / D_m) * (2.0 / M)), -2.0), 1.0)) * t_1) / sqrt(-l);
} else {
tmp = ((d / sqrt(l)) * fma((pow(((d / D_m) / M), -2.0) * 0.25), t_0, 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(h / l) * -0.5) t_1 = sqrt(Float64(-d)) tmp = 0.0 if (h <= -3.5e+58) tmp = Float64(fma(Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5), Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(sqrt(Float64(d / l)) * Float64(t_1 / sqrt(Float64(-h))))); elseif (h <= -1e-309) tmp = Float64(Float64(Float64(sqrt(Float64(d / h)) * fma(t_0, (Float64(Float64(d / D_m) * Float64(2.0 / M)) ^ -2.0), 1.0)) * t_1) / sqrt(Float64(-l))); else tmp = Float64(Float64(Float64(d / sqrt(l)) * fma(Float64((Float64(Float64(d / D_m) / M) ^ -2.0) * 0.25), t_0, 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[(-d)], $MachinePrecision]}, If[LessEqual[h, -3.5e+58], N[(N[(N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[h, -1e-309], N[(N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 * N[Power[N[(N[(d / D$95$m), $MachinePrecision] * N[(2.0 / M), $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(N[(d / D$95$m), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision] * 0.25), $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{h}{\ell} \cdot -0.5\\
t_1 := \sqrt{-d}\\
\mathbf{if}\;h \leq -3.5 \cdot 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(\left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{t\_1}{\sqrt{-h}}\right)\\
\mathbf{elif}\;h \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\left(\sqrt{\frac{d}{h}} \cdot \mathsf{fma}\left(t\_0, {\left(\frac{d}{D\_m} \cdot \frac{2}{M}\right)}^{-2}, 1\right)\right) \cdot t\_1}{\sqrt{-\ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}} \cdot \mathsf{fma}\left({\left(\frac{\frac{d}{D\_m}}{M}\right)}^{-2} \cdot 0.25, t\_0, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if h < -3.4999999999999997e58Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6461.5
Applied rewrites61.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6468.2
Applied rewrites68.2%
if -3.4999999999999997e58 < h < -1.000000000000002e-309Initial program 82.6%
Applied rewrites89.3%
if -1.000000000000002e-309 < h Initial program 69.8%
Applied rewrites79.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites83.0%
Final simplification82.6%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* M (* D_m (/ 0.5 d))) -0.5)))
(if (<= d -1.6e-129)
(*
(fma t_0 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0)
(* (sqrt (/ d l)) (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= d -4e-310)
(*
(fma t_0 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0)
(/ (- d) (sqrt (* l h))))
(/
(*
(/ d (sqrt l))
(fma (* (pow (/ (/ d D_m) M) -2.0) 0.25) (* (/ h l) -0.5) 1.0))
(sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M * (D_m * (0.5 / d))) * -0.5;
double tmp;
if (d <= -1.6e-129) {
tmp = fma(t_0, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (sqrt((d / l)) * (sqrt(-d) / sqrt(-h)));
} else if (d <= -4e-310) {
tmp = fma(t_0, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0) * (-d / sqrt((l * h)));
} else {
tmp = ((d / sqrt(l)) * fma((pow(((d / D_m) / M), -2.0) * 0.25), ((h / l) * -0.5), 1.0)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) tmp = 0.0 if (d <= -1.6e-129) tmp = Float64(fma(t_0, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (d <= -4e-310) tmp = Float64(fma(t_0, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(Float64(d / sqrt(l)) * fma(Float64((Float64(Float64(d / D_m) / M) ^ -2.0) * 0.25), Float64(Float64(h / l) * -0.5), 1.0)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, If[LessEqual[d, -1.6e-129], N[(N[(t$95$0 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Power[N[(N[(d / D$95$m), $MachinePrecision] / M), $MachinePrecision], -2.0], $MachinePrecision] * 0.25), $MachinePrecision] * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
\mathbf{if}\;d \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right) \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}} \cdot \mathsf{fma}\left({\left(\frac{\frac{d}{D\_m}}{M}\right)}^{-2} \cdot 0.25, \frac{h}{\ell} \cdot -0.5, 1\right)}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.6000000000000001e-129Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6482.3
Applied rewrites82.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6487.6
Applied rewrites87.6%
if -1.6000000000000001e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d Initial program 69.8%
Applied rewrites79.1%
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-pow.f64N/A
metadata-evalN/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites83.0%
Final simplification81.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (/ M (/ d D_m)) 0.5))
(t_1 (* (* M (* D_m (/ 0.5 d))) -0.5))
(t_2 (sqrt (/ d l))))
(if (<= d -1.6e-129)
(*
(fma t_1 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0)
(* t_2 (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= d -4e-310)
(*
(fma t_1 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0)
(/ (- d) (sqrt (* l h))))
(/
(* (* (fma t_0 (* t_0 (* (/ h l) -0.5)) 1.0) t_2) (sqrt d))
(sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M / (d / D_m)) * 0.5;
double t_1 = (M * (D_m * (0.5 / d))) * -0.5;
double t_2 = sqrt((d / l));
double tmp;
if (d <= -1.6e-129) {
tmp = fma(t_1, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (t_2 * (sqrt(-d) / sqrt(-h)));
} else if (d <= -4e-310) {
tmp = fma(t_1, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0) * (-d / sqrt((l * h)));
} else {
tmp = ((fma(t_0, (t_0 * ((h / l) * -0.5)), 1.0) * t_2) * sqrt(d)) / sqrt(h);
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M / Float64(d / D_m)) * 0.5) t_1 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.6e-129) tmp = Float64(fma(t_1, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(t_2 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (d <= -4e-310) tmp = Float64(fma(t_1, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(Float64(fma(t_0, Float64(t_0 * Float64(Float64(h / l) * -0.5)), 1.0) * t_2) * sqrt(d)) / sqrt(h)); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M / N[(d / D$95$m), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.6e-129], N[(N[(t$95$1 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(t$95$2 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(N[(t$95$1 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t$95$0 * N[(t$95$0 * N[(N[(h / l), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * t$95$2), $MachinePrecision] * N[Sqrt[d], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \frac{M}{\frac{d}{D\_m}} \cdot 0.5\\
t_1 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(t\_2 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right) \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(t\_0, t\_0 \cdot \left(\frac{h}{\ell} \cdot -0.5\right), 1\right) \cdot t\_2\right) \cdot \sqrt{d}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.6000000000000001e-129Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6482.3
Applied rewrites82.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6487.6
Applied rewrites87.6%
if -1.6000000000000001e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d Initial program 69.8%
Applied rewrites79.1%
lift-fma.f64N/A
*-commutativeN/A
lift-pow.f64N/A
metadata-evalN/A
pow-powN/A
inv-powN/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
clear-numN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
Applied rewrites80.8%
Final simplification80.5%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* M (* D_m (/ 0.5 d))) -0.5))
(t_1 (fma t_0 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0))
(t_2 (sqrt (/ d l))))
(if (<= d -1.6e-129)
(*
(fma t_0 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0)
(* t_2 (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= d -4e-310)
(* t_1 (/ (- d) (sqrt (* l h))))
(* (* (/ (sqrt d) (sqrt h)) t_2) t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M * (D_m * (0.5 / d))) * -0.5;
double t_1 = fma(t_0, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
double t_2 = sqrt((d / l));
double tmp;
if (d <= -1.6e-129) {
tmp = fma(t_0, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (t_2 * (sqrt(-d) / sqrt(-h)));
} else if (d <= -4e-310) {
tmp = t_1 * (-d / sqrt((l * h)));
} else {
tmp = ((sqrt(d) / sqrt(h)) * t_2) * t_1;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) t_1 = fma(t_0, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) t_2 = sqrt(Float64(d / l)) tmp = 0.0 if (d <= -1.6e-129) tmp = Float64(fma(t_0, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(t_2 * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (d <= -4e-310) tmp = Float64(t_1 * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(Float64(sqrt(d) / sqrt(h)) * t_2) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -1.6e-129], N[(N[(t$95$0 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(t$95$2 * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(t$95$1 * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[Sqrt[d], $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
t_1 := \mathsf{fma}\left(t\_0, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
t_2 := \sqrt{\frac{d}{\ell}}\\
\mathbf{if}\;d \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(t\_2 \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\sqrt{d}}{\sqrt{h}} \cdot t\_2\right) \cdot t\_1\\
\end{array}
\end{array}
if d < -1.6000000000000001e-129Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6482.3
Applied rewrites82.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6487.6
Applied rewrites87.6%
if -1.6000000000000001e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d Initial program 69.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6470.5
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
lower-/.f64N/A
pow1/2N/A
lower-sqrt.f64N/A
lower-sqrt.f6477.9
Applied rewrites77.9%
Final simplification79.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* M (* D_m (/ 0.5 d))) -0.5))
(t_1 (fma t_0 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0)))
(if (<= d -1.6e-129)
(*
(fma t_0 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0)
(* (sqrt (/ d l)) (/ (sqrt (- d)) (sqrt (- h)))))
(if (<= d -4e-310)
(* t_1 (/ (- d) (sqrt (* l h))))
(* (/ (/ d (sqrt h)) (sqrt l)) t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M * (D_m * (0.5 / d))) * -0.5;
double t_1 = fma(t_0, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
double tmp;
if (d <= -1.6e-129) {
tmp = fma(t_0, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0) * (sqrt((d / l)) * (sqrt(-d) / sqrt(-h)));
} else if (d <= -4e-310) {
tmp = t_1 * (-d / sqrt((l * h)));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * t_1;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) t_1 = fma(t_0, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) tmp = 0.0 if (d <= -1.6e-129) tmp = Float64(fma(t_0, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0) * Float64(sqrt(Float64(d / l)) * Float64(sqrt(Float64(-d)) / sqrt(Float64(-h))))); elseif (d <= -4e-310) tmp = Float64(t_1 * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -1.6e-129], N[(N[(t$95$0 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[(-d)], $MachinePrecision] / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(t$95$1 * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
t_1 := \mathsf{fma}\left(t\_0, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
\mathbf{if}\;d \leq -1.6 \cdot 10^{-129}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right) \cdot \left(\sqrt{\frac{d}{\ell}} \cdot \frac{\sqrt{-d}}{\sqrt{-h}}\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot t\_1\\
\end{array}
\end{array}
if d < -1.6000000000000001e-129Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
unpow1/2N/A
lift-/.f64N/A
frac-2negN/A
sqrt-divN/A
lower-/.f64N/A
lower-sqrt.f64N/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-neg.f6482.3
Applied rewrites82.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6487.6
Applied rewrites87.6%
if -1.6000000000000001e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d Initial program 69.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6470.5
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6470.5
Applied rewrites70.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lift-sqrt.f64N/A
rem-exp-logN/A
unpow1/2N/A
pow-prod-downN/A
rem-exp-logN/A
rem-square-sqrtN/A
sqrt-unprodN/A
sqr-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-*.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
Applied rewrites76.3%
Final simplification78.4%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* M (* D_m (/ 0.5 d))) -0.5))
(t_1 (fma t_0 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0))
(t_2
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(fma t_0 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0)))
(t_3 (sqrt (* l h))))
(if (<= d -3.6e-129)
t_2
(if (<= d -4e-310)
(* t_1 (/ (- d) t_3))
(if (<= d 3.2e-153) (* (/ d t_3) t_1) t_2)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M * (D_m * (0.5 / d))) * -0.5;
double t_1 = fma(t_0, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
double t_2 = (sqrt((d / h)) * sqrt((d / l))) * fma(t_0, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0);
double t_3 = sqrt((l * h));
double tmp;
if (d <= -3.6e-129) {
tmp = t_2;
} else if (d <= -4e-310) {
tmp = t_1 * (-d / t_3);
} else if (d <= 3.2e-153) {
tmp = (d / t_3) * t_1;
} else {
tmp = t_2;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) t_1 = fma(t_0, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) t_2 = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * fma(t_0, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0)) t_3 = sqrt(Float64(l * h)) tmp = 0.0 if (d <= -3.6e-129) tmp = t_2; elseif (d <= -4e-310) tmp = Float64(t_1 * Float64(Float64(-d) / t_3)); elseif (d <= 3.2e-153) tmp = Float64(Float64(d / t_3) * t_1); else tmp = t_2; end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[d, -3.6e-129], t$95$2, If[LessEqual[d, -4e-310], N[(t$95$1 * N[((-d) / t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.2e-153], N[(N[(d / t$95$3), $MachinePrecision] * t$95$1), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
t_1 := \mathsf{fma}\left(t\_0, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
t_2 := \left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(t\_0, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right)\\
t_3 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{-129}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \frac{-d}{t\_3}\\
\mathbf{elif}\;d \leq 3.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{d}{t\_3} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if d < -3.6e-129 or 3.1999999999999999e-153 < d Initial program 80.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites79.4%
lift-/.f64N/A
metadata-eval79.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6479.4
Applied rewrites79.4%
lift-/.f64N/A
metadata-eval79.4
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6479.4
Applied rewrites79.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6482.3
Applied rewrites82.3%
if -3.6e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d < 3.1999999999999999e-153Initial program 44.7%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites47.8%
lift-/.f64N/A
metadata-eval47.8
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6447.8
Applied rewrites47.8%
lift-/.f64N/A
metadata-eval47.8
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6447.8
Applied rewrites47.8%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lower-/.f6461.9
Applied rewrites61.9%
Final simplification76.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0 (* (* M (* D_m (/ 0.5 d))) -0.5))
(t_1 (fma t_0 (* (* (/ h l) M) (* (/ D_m d) 0.5)) 1.0)))
(if (<= d -3.6e-129)
(*
(* (sqrt (/ d h)) (sqrt (/ d l)))
(fma t_0 (/ (* (* D_m 0.5) (* M h)) (* l d)) 1.0))
(if (<= d -4e-310)
(* t_1 (/ (- d) (sqrt (* l h))))
(* (/ (/ d (sqrt h)) (sqrt l)) t_1)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = (M * (D_m * (0.5 / d))) * -0.5;
double t_1 = fma(t_0, (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
double tmp;
if (d <= -3.6e-129) {
tmp = (sqrt((d / h)) * sqrt((d / l))) * fma(t_0, (((D_m * 0.5) * (M * h)) / (l * d)), 1.0);
} else if (d <= -4e-310) {
tmp = t_1 * (-d / sqrt((l * h)));
} else {
tmp = ((d / sqrt(h)) / sqrt(l)) * t_1;
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5) t_1 = fma(t_0, Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) tmp = 0.0 if (d <= -3.6e-129) tmp = Float64(Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))) * fma(t_0, Float64(Float64(Float64(D_m * 0.5) * Float64(M * h)) / Float64(l * d)), 1.0)); elseif (d <= -4e-310) tmp = Float64(t_1 * Float64(Float64(-d) / sqrt(Float64(l * h)))); else tmp = Float64(Float64(Float64(d / sqrt(h)) / sqrt(l)) * t_1); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[d, -3.6e-129], N[(N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * N[(N[(N[(D$95$m * 0.5), $MachinePrecision] * N[(M * h), $MachinePrecision]), $MachinePrecision] / N[(l * d), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(t$95$1 * N[((-d) / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d / N[Sqrt[h], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5\\
t_1 := \mathsf{fma}\left(t\_0, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
\mathbf{if}\;d \leq -3.6 \cdot 10^{-129}:\\
\;\;\;\;\left(\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\right) \cdot \mathsf{fma}\left(t\_0, \frac{\left(D\_m \cdot 0.5\right) \cdot \left(M \cdot h\right)}{\ell \cdot d}, 1\right)\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;t\_1 \cdot \frac{-d}{\sqrt{\ell \cdot h}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{h}}}{\sqrt{\ell}} \cdot t\_1\\
\end{array}
\end{array}
if d < -3.6e-129Initial program 81.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6480.4
Applied rewrites80.4%
lift-/.f64N/A
metadata-eval80.4
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6480.4
Applied rewrites80.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6485.7
Applied rewrites85.7%
if -3.6e-129 < d < -3.999999999999988e-310Initial program 52.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6452.6
Applied rewrites52.6%
lift-/.f64N/A
metadata-eval52.6
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6452.6
Applied rewrites52.6%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6463.1
Applied rewrites63.1%
if -3.999999999999988e-310 < d Initial program 69.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6470.5
Applied rewrites70.5%
lift-/.f64N/A
metadata-eval70.5
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6470.5
Applied rewrites70.5%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-/.f64N/A
sqrt-divN/A
pow1/2N/A
associate-*r/N/A
lift-sqrt.f64N/A
rem-exp-logN/A
unpow1/2N/A
pow-prod-downN/A
rem-exp-logN/A
rem-square-sqrtN/A
sqrt-unprodN/A
sqr-negN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-*.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
Applied rewrites76.3%
Final simplification77.7%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(let* ((t_0
(fma
(* (* M (* D_m (/ 0.5 d))) -0.5)
(* (* (/ h l) M) (* (/ D_m d) 0.5))
1.0))
(t_1 (sqrt (* l h))))
(if (<= l -5e-310)
(* t_0 (/ (- d) t_1))
(if (<= l 1.1e+203)
(* (/ d t_1) t_0)
(* (sqrt (/ d h)) (sqrt (/ d l)))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double t_0 = fma(((M * (D_m * (0.5 / d))) * -0.5), (((h / l) * M) * ((D_m / d) * 0.5)), 1.0);
double t_1 = sqrt((l * h));
double tmp;
if (l <= -5e-310) {
tmp = t_0 * (-d / t_1);
} else if (l <= 1.1e+203) {
tmp = (d / t_1) * t_0;
} else {
tmp = sqrt((d / h)) * sqrt((d / l));
}
return tmp;
}
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) t_0 = fma(Float64(Float64(M * Float64(D_m * Float64(0.5 / d))) * -0.5), Float64(Float64(Float64(h / l) * M) * Float64(Float64(D_m / d) * 0.5)), 1.0) t_1 = sqrt(Float64(l * h)) tmp = 0.0 if (l <= -5e-310) tmp = Float64(t_0 * Float64(Float64(-d) / t_1)); elseif (l <= 1.1e+203) tmp = Float64(Float64(d / t_1) * t_0); else tmp = Float64(sqrt(Float64(d / h)) * sqrt(Float64(d / l))); end return tmp end
D_m = N[Abs[D], $MachinePrecision]
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
code[d_, h_, l_, M_, D$95$m_] := Block[{t$95$0 = N[(N[(N[(M * N[(D$95$m * N[(0.5 / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * N[(N[(N[(h / l), $MachinePrecision] * M), $MachinePrecision] * N[(N[(D$95$m / d), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -5e-310], N[(t$95$0 * N[((-d) / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.1e+203], N[(N[(d / t$95$1), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Sqrt[N[(d / h), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(d / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\left(M \cdot \left(D\_m \cdot \frac{0.5}{d}\right)\right) \cdot -0.5, \left(\frac{h}{\ell} \cdot M\right) \cdot \left(\frac{D\_m}{d} \cdot 0.5\right), 1\right)\\
t_1 := \sqrt{\ell \cdot h}\\
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_0 \cdot \frac{-d}{t\_1}\\
\mathbf{elif}\;\ell \leq 1.1 \cdot 10^{+203}:\\
\;\;\;\;\frac{d}{t\_1} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{d}{h}} \cdot \sqrt{\frac{d}{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 72.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites72.0%
lift-/.f64N/A
metadata-eval72.0
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6472.0
Applied rewrites72.0%
lift-/.f64N/A
metadata-eval72.0
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6472.0
Applied rewrites72.0%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
frac-2negN/A
lift-neg.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lift-neg.f64N/A
lift-neg.f64N/A
sqr-negN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lower-/.f64N/A
lower-neg.f6472.5
Applied rewrites72.5%
if -4.999999999999985e-310 < l < 1.10000000000000002e203Initial program 68.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift-pow.f64N/A
unpow2N/A
associate-*l*N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites68.3%
lift-/.f64N/A
metadata-eval68.3
lift-pow.f64N/A
pow1/2N/A
lift-sqrt.f6468.3
Applied rewrites68.3%
lift-/.f64N/A
metadata-eval68.3
lift-pow.f64N/A
unpow1/2N/A
lower-sqrt.f6468.3
Applied rewrites68.3%
lift-*.f64N/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
sqrt-unprodN/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
*-commutativeN/A
lift-*.f64N/A
sqrt-divN/A
sqrt-unprodN/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lower-/.f6470.6
Applied rewrites70.6%
if 1.10000000000000002e203 < l Initial program 79.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6424.7
Applied rewrites24.7%
Applied rewrites58.9%
Final simplification71.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -1.06e-206)
(/ (/ (- d) (sqrt (- h))) (sqrt (- l)))
(if (<= d -4e-310)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(if (<= d 1.75e+14)
(/ (* (* -0.125 M) (* (* (* (/ D_m d) D_m) (sqrt (* l h))) M)) (* l l))
(/ (/ d (sqrt l)) (sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / sqrt(-h)) / sqrt(-l);
} else if (d <= -4e-310) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else if (d <= 1.75e+14) {
tmp = ((-0.125 * M) * ((((D_m / d) * D_m) * sqrt((l * h))) * M)) / (l * l);
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.06d-206)) then
tmp = (-d / sqrt(-h)) / sqrt(-l)
else if (d <= (-4d-310)) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else if (d <= 1.75d+14) then
tmp = (((-0.125d0) * m) * ((((d_m / d) * d_m) * sqrt((l * h))) * m)) / (l * l)
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / Math.sqrt(-h)) / Math.sqrt(-l);
} else if (d <= -4e-310) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else if (d <= 1.75e+14) {
tmp = ((-0.125 * M) * ((((D_m / d) * D_m) * Math.sqrt((l * h))) * M)) / (l * l);
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.06e-206: tmp = (-d / math.sqrt(-h)) / math.sqrt(-l) elif d <= -4e-310: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) elif d <= 1.75e+14: tmp = ((-0.125 * M) * ((((D_m / d) * D_m) * math.sqrt((l * h))) * M)) / (l * l) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.06e-206) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(-h))) / sqrt(Float64(-l))); elseif (d <= -4e-310) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); elseif (d <= 1.75e+14) tmp = Float64(Float64(Float64(-0.125 * M) * Float64(Float64(Float64(Float64(D_m / d) * D_m) * sqrt(Float64(l * h))) * M)) / Float64(l * l)); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.06e-206)
tmp = (-d / sqrt(-h)) / sqrt(-l);
elseif (d <= -4e-310)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
elseif (d <= 1.75e+14)
tmp = ((-0.125 * M) * ((((D_m / d) * D_m) * sqrt((l * h))) * M)) / (l * l);
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.06e-206], N[(N[((-d) / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e+14], N[(N[(N[(-0.125 * M), $MachinePrecision] * N[(N[(N[(N[(D$95$m / d), $MachinePrecision] * D$95$m), $MachinePrecision] * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * M), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.06 \cdot 10^{-206}:\\
\;\;\;\;\frac{\frac{-d}{\sqrt{-h}}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{elif}\;d \leq 1.75 \cdot 10^{+14}:\\
\;\;\;\;\frac{\left(-0.125 \cdot M\right) \cdot \left(\left(\left(\frac{D\_m}{d} \cdot D\_m\right) \cdot \sqrt{\ell \cdot h}\right) \cdot M\right)}{\ell \cdot \ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.06e-206Initial program 77.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.0
Applied rewrites9.0%
Applied rewrites50.6%
Applied rewrites61.7%
if -1.06e-206 < d < -3.999999999999988e-310Initial program 46.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.1
Applied rewrites25.1%
Applied rewrites25.1%
Applied rewrites29.5%
if -3.999999999999988e-310 < d < 1.75e14Initial program 59.5%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites35.5%
Taylor expanded in d around 0
Applied rewrites34.1%
Applied rewrites47.5%
if 1.75e14 < d Initial program 79.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
Applied rewrites76.2%
Final simplification59.1%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -1.06e-206)
(/ (/ (- d) (sqrt (- h))) (sqrt (- l)))
(if (<= d 9.2e-291)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(if (<= d 1.75e+14)
(/ (* (* (/ (* D_m D_m) d) (sqrt (* l h))) (* -0.125 (* M M))) (* l l))
(/ (/ d (sqrt l)) (sqrt h))))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / sqrt(-h)) / sqrt(-l);
} else if (d <= 9.2e-291) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else if (d <= 1.75e+14) {
tmp = ((((D_m * D_m) / d) * sqrt((l * h))) * (-0.125 * (M * M))) / (l * l);
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.06d-206)) then
tmp = (-d / sqrt(-h)) / sqrt(-l)
else if (d <= 9.2d-291) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else if (d <= 1.75d+14) then
tmp = ((((d_m * d_m) / d) * sqrt((l * h))) * ((-0.125d0) * (m * m))) / (l * l)
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / Math.sqrt(-h)) / Math.sqrt(-l);
} else if (d <= 9.2e-291) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else if (d <= 1.75e+14) {
tmp = ((((D_m * D_m) / d) * Math.sqrt((l * h))) * (-0.125 * (M * M))) / (l * l);
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.06e-206: tmp = (-d / math.sqrt(-h)) / math.sqrt(-l) elif d <= 9.2e-291: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) elif d <= 1.75e+14: tmp = ((((D_m * D_m) / d) * math.sqrt((l * h))) * (-0.125 * (M * M))) / (l * l) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.06e-206) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(-h))) / sqrt(Float64(-l))); elseif (d <= 9.2e-291) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); elseif (d <= 1.75e+14) tmp = Float64(Float64(Float64(Float64(Float64(D_m * D_m) / d) * sqrt(Float64(l * h))) * Float64(-0.125 * Float64(M * M))) / Float64(l * l)); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.06e-206)
tmp = (-d / sqrt(-h)) / sqrt(-l);
elseif (d <= 9.2e-291)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
elseif (d <= 1.75e+14)
tmp = ((((D_m * D_m) / d) * sqrt((l * h))) * (-0.125 * (M * M))) / (l * l);
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.06e-206], N[(N[((-d) / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-291], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.75e+14], N[(N[(N[(N[(N[(D$95$m * D$95$m), $MachinePrecision] / d), $MachinePrecision] * N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-0.125 * N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(l * l), $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.06 \cdot 10^{-206}:\\
\;\;\;\;\frac{\frac{-d}{\sqrt{-h}}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq 9.2 \cdot 10^{-291}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{elif}\;d \leq 1.75 \cdot 10^{+14}:\\
\;\;\;\;\frac{\left(\frac{D\_m \cdot D\_m}{d} \cdot \sqrt{\ell \cdot h}\right) \cdot \left(-0.125 \cdot \left(M \cdot M\right)\right)}{\ell \cdot \ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.06e-206Initial program 77.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.0
Applied rewrites9.0%
Applied rewrites50.6%
Applied rewrites61.7%
if -1.06e-206 < d < 9.2000000000000003e-291Initial program 47.2%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6421.6
Applied rewrites21.6%
Applied rewrites21.6%
Applied rewrites25.3%
if 9.2000000000000003e-291 < d < 1.75e14Initial program 60.2%
Taylor expanded in l around 0
lower-/.f64N/A
Applied rewrites38.1%
Taylor expanded in d around 0
Applied rewrites36.6%
if 1.75e14 < d Initial program 79.9%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
Applied rewrites76.2%
Final simplification56.0%
D_m = (fabs.f64 D)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
(FPCore (d h l M D_m)
:precision binary64
(if (<= d -1.06e-206)
(/ (/ (- d) (sqrt (- h))) (sqrt (- l)))
(if (<= d -4e-310)
(/ d (sqrt (sqrt (* (* l h) (* l h)))))
(/ (/ d (sqrt l)) (sqrt h)))))D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / sqrt(-h)) / sqrt(-l);
} else if (d <= -4e-310) {
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.06d-206)) then
tmp = (-d / sqrt(-h)) / sqrt(-l)
else if (d <= (-4d-310)) then
tmp = d / sqrt(sqrt(((l * h) * (l * h))))
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = (-d / Math.sqrt(-h)) / Math.sqrt(-l);
} else if (d <= -4e-310) {
tmp = d / Math.sqrt(Math.sqrt(((l * h) * (l * h))));
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.06e-206: tmp = (-d / math.sqrt(-h)) / math.sqrt(-l) elif d <= -4e-310: tmp = d / math.sqrt(math.sqrt(((l * h) * (l * h)))) else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.06e-206) tmp = Float64(Float64(Float64(-d) / sqrt(Float64(-h))) / sqrt(Float64(-l))); elseif (d <= -4e-310) tmp = Float64(d / sqrt(sqrt(Float64(Float64(l * h) * Float64(l * h))))); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.06e-206)
tmp = (-d / sqrt(-h)) / sqrt(-l);
elseif (d <= -4e-310)
tmp = d / sqrt(sqrt(((l * h) * (l * h))));
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.06e-206], N[(N[((-d) / N[Sqrt[(-h)], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -4e-310], N[(d / N[Sqrt[N[Sqrt[N[(N[(l * h), $MachinePrecision] * N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.06 \cdot 10^{-206}:\\
\;\;\;\;\frac{\frac{-d}{\sqrt{-h}}}{\sqrt{-\ell}}\\
\mathbf{elif}\;d \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\frac{d}{\sqrt{\sqrt{\left(\ell \cdot h\right) \cdot \left(\ell \cdot h\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < -1.06e-206Initial program 77.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f649.0
Applied rewrites9.0%
Applied rewrites50.6%
Applied rewrites61.7%
if -1.06e-206 < d < -3.999999999999988e-310Initial program 46.4%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.1
Applied rewrites25.1%
Applied rewrites25.1%
Applied rewrites29.5%
if -3.999999999999988e-310 < d Initial program 69.8%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
Applied rewrites51.8%
Final simplification54.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= d 4.2e-179) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ (/ d (sqrt l)) (sqrt h))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 4.2e-179) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = (d / sqrt(l)) / sqrt(h);
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= 4.2d-179) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = (d / sqrt(l)) / sqrt(h)
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 4.2e-179) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = (d / Math.sqrt(l)) / Math.sqrt(h);
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= 4.2e-179: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = (d / math.sqrt(l)) / math.sqrt(h) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= 4.2e-179) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(Float64(d / sqrt(l)) / sqrt(h)); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= 4.2e-179)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = (d / sqrt(l)) / sqrt(h);
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, 4.2e-179], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(N[(d / N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[h], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.2 \cdot 10^{-179}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{d}{\sqrt{\ell}}}{\sqrt{h}}\\
\end{array}
\end{array}
if d < 4.1999999999999997e-179Initial program 67.9%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.4
Applied rewrites43.4%
if 4.1999999999999997e-179 < d Initial program 77.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Applied rewrites62.9%
Final simplification50.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= d 4.2e-179) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (* (sqrt h) (sqrt l)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 4.2e-179) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (sqrt(h) * sqrt(l));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= 4.2d-179) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / (sqrt(h) * sqrt(l))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= 4.2e-179) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / (Math.sqrt(h) * Math.sqrt(l));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= 4.2e-179: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / (math.sqrt(h) * math.sqrt(l)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= 4.2e-179) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / Float64(sqrt(h) * sqrt(l))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= 4.2e-179)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / (sqrt(h) * sqrt(l));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, 4.2e-179], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[(N[Sqrt[h], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq 4.2 \cdot 10^{-179}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{h} \cdot \sqrt{\ell}}\\
\end{array}
\end{array}
if d < 4.1999999999999997e-179Initial program 67.9%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6443.4
Applied rewrites43.4%
if 4.1999999999999997e-179 < d Initial program 77.5%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Applied rewrites53.4%
Applied rewrites62.8%
Final simplification50.3%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (if (<= d -1.06e-206) (* (sqrt (/ 1.0 (* l h))) (- d)) (/ d (sqrt (* l h)))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / sqrt((l * h));
}
return tmp;
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
real(8) :: tmp
if (d <= (-1.06d-206)) then
tmp = sqrt((1.0d0 / (l * h))) * -d
else
tmp = d / sqrt((l * h))
end if
code = tmp
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
double tmp;
if (d <= -1.06e-206) {
tmp = Math.sqrt((1.0 / (l * h))) * -d;
} else {
tmp = d / Math.sqrt((l * h));
}
return tmp;
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): tmp = 0 if d <= -1.06e-206: tmp = math.sqrt((1.0 / (l * h))) * -d else: tmp = d / math.sqrt((l * h)) return tmp
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) tmp = 0.0 if (d <= -1.06e-206) tmp = Float64(sqrt(Float64(1.0 / Float64(l * h))) * Float64(-d)); else tmp = Float64(d / sqrt(Float64(l * h))); end return tmp end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp_2 = code(d, h, l, M, D_m)
tmp = 0.0;
if (d <= -1.06e-206)
tmp = sqrt((1.0 / (l * h))) * -d;
else
tmp = d / sqrt((l * h));
end
tmp_2 = tmp;
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := If[LessEqual[d, -1.06e-206], N[(N[Sqrt[N[(1.0 / N[(l * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-d)), $MachinePrecision], N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.06 \cdot 10^{-206}:\\
\;\;\;\;\sqrt{\frac{1}{\ell \cdot h}} \cdot \left(-d\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{d}{\sqrt{\ell \cdot h}}\\
\end{array}
\end{array}
if d < -1.06e-206Initial program 77.5%
Taylor expanded in l around -inf
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.1
Applied rewrites56.1%
if -1.06e-206 < d Initial program 66.1%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6439.4
Applied rewrites39.4%
Applied rewrites40.0%
Final simplification47.4%
D_m = (fabs.f64 D) NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. (FPCore (d h l M D_m) :precision binary64 (/ d (sqrt (* l h))))
D_m = fabs(D);
assert(d < h && h < l && l < M && M < D_m);
double code(double d, double h, double l, double M, double D_m) {
return d / sqrt((l * h));
}
D_m = abs(d)
NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function.
real(8) function code(d, h, l, m, d_m)
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_m
code = d / sqrt((l * h))
end function
D_m = Math.abs(D);
assert d < h && h < l && l < M && M < D_m;
public static double code(double d, double h, double l, double M, double D_m) {
return d / Math.sqrt((l * h));
}
D_m = math.fabs(D) [d, h, l, M, D_m] = sort([d, h, l, M, D_m]) def code(d, h, l, M, D_m): return d / math.sqrt((l * h))
D_m = abs(D) d, h, l, M, D_m = sort([d, h, l, M, D_m]) function code(d, h, l, M, D_m) return Float64(d / sqrt(Float64(l * h))) end
D_m = abs(D);
d, h, l, M, D_m = num2cell(sort([d, h, l, M, D_m])){:}
function tmp = code(d, h, l, M, D_m)
tmp = d / sqrt((l * h));
end
D_m = N[Abs[D], $MachinePrecision] NOTE: d, h, l, M, and D_m should be sorted in increasing order before calling this function. code[d_, h_, l_, M_, D$95$m_] := N[(d / N[Sqrt[N[(l * h), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
D_m = \left|D\right|
\\
[d, h, l, M, D_m] = \mathsf{sort}([d, h, l, M, D_m])\\
\\
\frac{d}{\sqrt{\ell \cdot h}}
\end{array}
Initial program 71.3%
Taylor expanded in d around inf
*-commutativeN/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6425.5
Applied rewrites25.5%
Applied rewrites25.8%
herbie shell --seed 2024295
(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)))))