
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 19 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= (/ (* a_m (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+124)
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m (hypot 1.0 k)))
(/ a_m (fma 10.0 (/ k (pow k m)) (/ 1.0 (pow k m)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (((a_m * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+124) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / hypot(1.0, k));
} else {
tmp = a_m / fma(10.0, (k / pow(k, m)), (1.0 / pow(k, m)));
}
return a_s * tmp;
}
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (Float64(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+124) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / hypot(1.0, k))); else tmp = Float64(a_m / fma(10.0, Float64(k / (k ^ m)), Float64(1.0 / (k ^ m)))); end return Float64(a_s * tmp) end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+124], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a$95$m / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(10.0 * N[(k / N[Power[k, m], $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{a\_m \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a\_m}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(10, \frac{k}{{k}^{m}}, \frac{1}{{k}^{m}}\right)}\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999999e124Initial program 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in k around 0 95.8%
*-commutative95.8%
add-sqr-sqrt95.8%
times-frac95.2%
hypot-1-def95.2%
hypot-1-def99.1%
Applied egg-rr99.1%
if 1.9999999999999999e124 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 64.5%
associate-/l*64.5%
sqr-neg64.5%
associate-+l+64.5%
+-commutative64.5%
sqr-neg64.5%
distribute-rgt-out64.5%
fma-def64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in k around 0 100.0%
fma-def100.0%
Simplified100.0%
Final simplification99.3%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= (/ (* a_m (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+124)
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m (hypot 1.0 k)))
(/ a_m (pow k (- m))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (((a_m * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+124) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / hypot(1.0, k));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (((a_m * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+124) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a_m / Math.hypot(1.0, k));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if ((a_m * math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+124: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a_m / math.hypot(1.0, k)) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (Float64(Float64(a_m * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+124) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / hypot(1.0, k))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (((a_m * (k ^ m)) / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+124) tmp = ((k ^ m) / hypot(1.0, k)) * (a_m / hypot(1.0, k)); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+124], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a$95$m / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{a\_m \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+124}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a\_m}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999999e124Initial program 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in k around 0 95.8%
*-commutative95.8%
add-sqr-sqrt95.8%
times-frac95.2%
hypot-1-def95.2%
hypot-1-def99.1%
Applied egg-rr99.1%
if 1.9999999999999999e124 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 64.5%
associate-/l*64.5%
sqr-neg64.5%
associate-+l+64.5%
+-commutative64.5%
sqr-neg64.5%
distribute-rgt-out64.5%
fma-def64.5%
+-commutative64.5%
Simplified64.5%
Taylor expanded in m around inf 64.5%
Taylor expanded in k around 0 99.8%
exp-to-pow69.2%
*-commutative69.2%
exp-neg69.2%
distribute-lft-neg-out69.2%
*-commutative69.2%
exp-to-pow99.8%
Simplified99.8%
Final simplification99.3%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k 5.4e-6)
(/ a_m (pow k (- m)))
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m k)))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 5.4e-6) {
tmp = a_m / pow(k, -m);
} else {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / k);
}
return a_s * tmp;
}
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 5.4e-6) {
tmp = a_m / Math.pow(k, -m);
} else {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a_m / k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if k <= 5.4e-6: tmp = a_m / math.pow(k, -m) else: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a_m / k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (k <= 5.4e-6) tmp = Float64(a_m / (k ^ Float64(-m))); else tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (k <= 5.4e-6) tmp = a_m / (k ^ -m); else tmp = ((k ^ m) / hypot(1.0, k)) * (a_m / k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[k, 5.4e-6], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 5.4 \cdot 10^{-6}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a\_m}{k}\\
\end{array}
\end{array}
if k < 5.39999999999999997e-6Initial program 95.5%
associate-/l*95.5%
sqr-neg95.5%
associate-+l+95.5%
+-commutative95.5%
sqr-neg95.5%
distribute-rgt-out95.5%
fma-def95.5%
+-commutative95.5%
Simplified95.5%
Taylor expanded in m around inf 95.5%
Taylor expanded in k around 0 99.7%
exp-to-pow54.8%
*-commutative54.8%
exp-neg54.8%
distribute-lft-neg-out54.8%
*-commutative54.8%
exp-to-pow99.7%
Simplified99.7%
if 5.39999999999999997e-6 < k Initial program 77.4%
*-commutative77.4%
Simplified77.4%
Taylor expanded in k around 0 77.2%
*-commutative77.2%
add-sqr-sqrt77.2%
times-frac74.2%
hypot-1-def74.2%
hypot-1-def93.7%
Applied egg-rr93.7%
Taylor expanded in k around inf 93.7%
Final simplification97.3%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 1.1e-7)
(* (pow k m) (/ a_m (+ 1.0 (* k (+ k 10.0)))))
(/ a_m (pow k (- m))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1.1e-7) {
tmp = pow(k, m) * (a_m / (1.0 + (k * (k + 10.0))));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.1d-7) then
tmp = (k ** m) * (a_m / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a_m / (k ** -m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1.1e-7) {
tmp = Math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.0))));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 1.1e-7: tmp = math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.0)))) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 1.1e-7) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 1.1e-7) tmp = (k ^ m) * (a_m / (1.0 + (k * (k + 10.0)))); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 1.1e-7], N[(N[Power[k, m], $MachinePrecision] * N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{-7}:\\
\;\;\;\;{k}^{m} \cdot \frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 1.1000000000000001e-7Initial program 95.7%
associate-*l/95.7%
sqr-neg95.7%
associate-+l+95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
Simplified95.7%
if 1.1000000000000001e-7 < m Initial program 72.1%
associate-/l*72.2%
sqr-neg72.2%
associate-+l+72.2%
+-commutative72.2%
sqr-neg72.2%
distribute-rgt-out72.2%
fma-def72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in m around inf 72.2%
Taylor expanded in k around 0 100.0%
exp-to-pow58.2%
*-commutative58.2%
exp-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
exp-to-pow100.0%
Simplified100.0%
Final simplification97.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -1.1e-9)
(* a_m (pow k m))
(if (<= m 1.05e-10)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(/ a_m (pow k (- m)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.1e-9) {
tmp = a_m * pow(k, m);
} else if (m <= 1.05e-10) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.1d-9)) then
tmp = a_m * (k ** m)
else if (m <= 1.05d-10) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m / (k ** -m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.1e-9) {
tmp = a_m * Math.pow(k, m);
} else if (m <= 1.05e-10) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -1.1e-9: tmp = a_m * math.pow(k, m) elif m <= 1.05e-10: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -1.1e-9) tmp = Float64(a_m * (k ^ m)); elseif (m <= 1.05e-10) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -1.1e-9) tmp = a_m * (k ^ m); elseif (m <= 1.05e-10) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -1.1e-9], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.05e-10], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.1 \cdot 10^{-9}:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{elif}\;m \leq 1.05 \cdot 10^{-10}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < -1.0999999999999999e-9Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 99.9%
if -1.0999999999999999e-9 < m < 1.05e-10Initial program 90.4%
associate-*l/90.4%
sqr-neg90.4%
associate-+l+90.4%
sqr-neg90.4%
distribute-rgt-out90.4%
Simplified90.4%
Taylor expanded in m around 0 89.9%
if 1.05e-10 < m Initial program 72.1%
associate-/l*72.2%
sqr-neg72.2%
associate-+l+72.2%
+-commutative72.2%
sqr-neg72.2%
distribute-rgt-out72.2%
fma-def72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in m around inf 72.2%
Taylor expanded in k around 0 100.0%
exp-to-pow58.2%
*-commutative58.2%
exp-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
exp-to-pow100.0%
Simplified100.0%
Final simplification96.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -1.25e-9)
(* (pow k m) (/ a_m (+ 1.0 (* k 10.0))))
(if (<= m 1.06e-7)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(/ a_m (pow k (- m)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.25e-9) {
tmp = pow(k, m) * (a_m / (1.0 + (k * 10.0)));
} else if (m <= 1.06e-7) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.25d-9)) then
tmp = (k ** m) * (a_m / (1.0d0 + (k * 10.0d0)))
else if (m <= 1.06d-7) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m / (k ** -m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.25e-9) {
tmp = Math.pow(k, m) * (a_m / (1.0 + (k * 10.0)));
} else if (m <= 1.06e-7) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -1.25e-9: tmp = math.pow(k, m) * (a_m / (1.0 + (k * 10.0))) elif m <= 1.06e-7: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -1.25e-9) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 1.06e-7) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -1.25e-9) tmp = (k ^ m) * (a_m / (1.0 + (k * 10.0))); elseif (m <= 1.06e-7) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -1.25e-9], N[(N[Power[k, m], $MachinePrecision] * N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.06e-7], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.25 \cdot 10^{-9}:\\
\;\;\;\;{k}^{m} \cdot \frac{a\_m}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 1.06 \cdot 10^{-7}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < -1.25e-9Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative21.0%
Simplified100.0%
if -1.25e-9 < m < 1.06e-7Initial program 90.4%
associate-*l/90.4%
sqr-neg90.4%
associate-+l+90.4%
sqr-neg90.4%
distribute-rgt-out90.4%
Simplified90.4%
Taylor expanded in m around 0 89.9%
if 1.06e-7 < m Initial program 72.1%
associate-/l*72.2%
sqr-neg72.2%
associate-+l+72.2%
+-commutative72.2%
sqr-neg72.2%
distribute-rgt-out72.2%
fma-def72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in m around inf 72.2%
Taylor expanded in k around 0 100.0%
exp-to-pow58.2%
*-commutative58.2%
exp-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
exp-to-pow100.0%
Simplified100.0%
Final simplification96.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -5.5e-11)
(/ a_m (/ (+ 1.0 (* k 10.0)) (pow k m)))
(if (<= m 9e-8) (/ a_m (+ 1.0 (* k (+ k 10.0)))) (/ a_m (pow k (- m)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.5e-11) {
tmp = a_m / ((1.0 + (k * 10.0)) / pow(k, m));
} else if (m <= 9e-8) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-5.5d-11)) then
tmp = a_m / ((1.0d0 + (k * 10.0d0)) / (k ** m))
else if (m <= 9d-8) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a_m / (k ** -m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.5e-11) {
tmp = a_m / ((1.0 + (k * 10.0)) / Math.pow(k, m));
} else if (m <= 9e-8) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -5.5e-11: tmp = a_m / ((1.0 + (k * 10.0)) / math.pow(k, m)) elif m <= 9e-8: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -5.5e-11) tmp = Float64(a_m / Float64(Float64(1.0 + Float64(k * 10.0)) / (k ^ m))); elseif (m <= 9e-8) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -5.5e-11) tmp = a_m / ((1.0 + (k * 10.0)) / (k ^ m)); elseif (m <= 9e-8) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -5.5e-11], N[(a$95$m / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9e-8], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -5.5 \cdot 10^{-11}:\\
\;\;\;\;\frac{a\_m}{\frac{1 + k \cdot 10}{{k}^{m}}}\\
\mathbf{elif}\;m \leq 9 \cdot 10^{-8}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < -5.49999999999999975e-11Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
Taylor expanded in k around 0 100.0%
*-commutative21.0%
Simplified100.0%
if -5.49999999999999975e-11 < m < 8.99999999999999986e-8Initial program 90.4%
associate-*l/90.4%
sqr-neg90.4%
associate-+l+90.4%
sqr-neg90.4%
distribute-rgt-out90.4%
Simplified90.4%
Taylor expanded in m around 0 89.9%
if 8.99999999999999986e-8 < m Initial program 72.1%
associate-/l*72.2%
sqr-neg72.2%
associate-+l+72.2%
+-commutative72.2%
sqr-neg72.2%
distribute-rgt-out72.2%
fma-def72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in m around inf 72.2%
Taylor expanded in k around 0 100.0%
exp-to-pow58.2%
*-commutative58.2%
exp-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
exp-to-pow100.0%
Simplified100.0%
Final simplification96.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 1.1e-7)
(/ (* a_m (pow k m)) (+ 1.0 (* k k)))
(/ a_m (pow k (- m))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1.1e-7) {
tmp = (a_m * pow(k, m)) / (1.0 + (k * k));
} else {
tmp = a_m / pow(k, -m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.1d-7) then
tmp = (a_m * (k ** m)) / (1.0d0 + (k * k))
else
tmp = a_m / (k ** -m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1.1e-7) {
tmp = (a_m * Math.pow(k, m)) / (1.0 + (k * k));
} else {
tmp = a_m / Math.pow(k, -m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 1.1e-7: tmp = (a_m * math.pow(k, m)) / (1.0 + (k * k)) else: tmp = a_m / math.pow(k, -m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 1.1e-7) tmp = Float64(Float64(a_m * (k ^ m)) / Float64(1.0 + Float64(k * k))); else tmp = Float64(a_m / (k ^ Float64(-m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 1.1e-7) tmp = (a_m * (k ^ m)) / (1.0 + (k * k)); else tmp = a_m / (k ^ -m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 1.1e-7], N[(N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{-7}:\\
\;\;\;\;\frac{a\_m \cdot {k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 1.1000000000000001e-7Initial program 95.7%
*-commutative95.7%
Simplified95.7%
Taylor expanded in k around 0 95.3%
if 1.1000000000000001e-7 < m Initial program 72.1%
associate-/l*72.2%
sqr-neg72.2%
associate-+l+72.2%
+-commutative72.2%
sqr-neg72.2%
distribute-rgt-out72.2%
fma-def72.2%
+-commutative72.2%
Simplified72.2%
Taylor expanded in m around inf 72.2%
Taylor expanded in k around 0 100.0%
exp-to-pow58.2%
*-commutative58.2%
exp-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
exp-to-pow100.0%
Simplified100.0%
Final simplification96.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= m -3.5e-9) (not (<= m 6.6e-8)))
(* a_m (pow k m))
(/ a_m (+ 1.0 (* k (+ k 10.0)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((m <= -3.5e-9) || !(m <= 6.6e-8)) {
tmp = a_m * pow(k, m);
} else {
tmp = a_m / (1.0 + (k * (k + 10.0)));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-3.5d-9)) .or. (.not. (m <= 6.6d-8))) then
tmp = a_m * (k ** m)
else
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((m <= -3.5e-9) || !(m <= 6.6e-8)) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = a_m / (1.0 + (k * (k + 10.0)));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (m <= -3.5e-9) or not (m <= 6.6e-8): tmp = a_m * math.pow(k, m) else: tmp = a_m / (1.0 + (k * (k + 10.0))) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((m <= -3.5e-9) || !(m <= 6.6e-8)) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((m <= -3.5e-9) || ~((m <= 6.6e-8))) tmp = a_m * (k ^ m); else tmp = a_m / (1.0 + (k * (k + 10.0))); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[m, -3.5e-9], N[Not[LessEqual[m, 6.6e-8]], $MachinePrecision]], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -3.5 \cdot 10^{-9} \lor \neg \left(m \leq 6.6 \cdot 10^{-8}\right):\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.4999999999999999e-9 or 6.59999999999999954e-8 < m Initial program 87.6%
associate-*l/84.2%
sqr-neg84.2%
associate-+l+84.2%
sqr-neg84.2%
distribute-rgt-out84.2%
Simplified84.2%
Taylor expanded in k around 0 99.9%
if -3.4999999999999999e-9 < m < 6.59999999999999954e-8Initial program 90.4%
associate-*l/90.4%
sqr-neg90.4%
associate-+l+90.4%
sqr-neg90.4%
distribute-rgt-out90.4%
Simplified90.4%
Taylor expanded in m around 0 89.9%
Final simplification96.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (+ 1.0 (* k (+ k 10.0)))))
(*
a_s
(if (<= m -0.13)
(/ 1.0 (/ (+ t_0 -1.0) a_m))
(if (<= m 1.85e+49)
(/ a_m t_0)
(+ (* a_m -0.01) (+ (* 0.001 (* a_m k)) (* (/ a_m k) 0.1))))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -0.13) {
tmp = 1.0 / ((t_0 + -1.0) / a_m);
} else if (m <= 1.85e+49) {
tmp = a_m / t_0;
} else {
tmp = (a_m * -0.01) + ((0.001 * (a_m * k)) + ((a_m / k) * 0.1));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (k * (k + 10.0d0))
if (m <= (-0.13d0)) then
tmp = 1.0d0 / ((t_0 + (-1.0d0)) / a_m)
else if (m <= 1.85d+49) then
tmp = a_m / t_0
else
tmp = (a_m * (-0.01d0)) + ((0.001d0 * (a_m * k)) + ((a_m / k) * 0.1d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -0.13) {
tmp = 1.0 / ((t_0 + -1.0) / a_m);
} else if (m <= 1.85e+49) {
tmp = a_m / t_0;
} else {
tmp = (a_m * -0.01) + ((0.001 * (a_m * k)) + ((a_m / k) * 0.1));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = 1.0 + (k * (k + 10.0)) tmp = 0 if m <= -0.13: tmp = 1.0 / ((t_0 + -1.0) / a_m) elif m <= 1.85e+49: tmp = a_m / t_0 else: tmp = (a_m * -0.01) + ((0.001 * (a_m * k)) + ((a_m / k) * 0.1)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(1.0 + Float64(k * Float64(k + 10.0))) tmp = 0.0 if (m <= -0.13) tmp = Float64(1.0 / Float64(Float64(t_0 + -1.0) / a_m)); elseif (m <= 1.85e+49) tmp = Float64(a_m / t_0); else tmp = Float64(Float64(a_m * -0.01) + Float64(Float64(0.001 * Float64(a_m * k)) + Float64(Float64(a_m / k) * 0.1))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = 1.0 + (k * (k + 10.0)); tmp = 0.0; if (m <= -0.13) tmp = 1.0 / ((t_0 + -1.0) / a_m); elseif (m <= 1.85e+49) tmp = a_m / t_0; else tmp = (a_m * -0.01) + ((0.001 * (a_m * k)) + ((a_m / k) * 0.1)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -0.13], N[(1.0 / N[(N[(t$95$0 + -1.0), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.85e+49], N[(a$95$m / t$95$0), $MachinePrecision], N[(N[(a$95$m * -0.01), $MachinePrecision] + N[(N[(0.001 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision] + N[(N[(a$95$m / k), $MachinePrecision] * 0.1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := 1 + k \cdot \left(k + 10\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -0.13:\\
\;\;\;\;\frac{1}{\frac{t\_0 + -1}{a\_m}}\\
\mathbf{elif}\;m \leq 1.85 \cdot 10^{+49}:\\
\;\;\;\;\frac{a\_m}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot -0.01 + \left(0.001 \cdot \left(a\_m \cdot k\right) + \frac{a\_m}{k} \cdot 0.1\right)\\
\end{array}
\end{array}
\end{array}
if m < -0.13Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.5%
clear-num42.1%
inv-pow42.1%
+-commutative42.1%
+-commutative42.1%
fma-udef42.1%
Applied egg-rr42.1%
unpow-142.1%
Simplified42.1%
Taylor expanded in k around inf 45.8%
+-commutative45.8%
unpow245.8%
distribute-rgt-in45.8%
Simplified45.8%
expm1-log1p-u45.8%
expm1-udef78.2%
log1p-udef78.2%
add-exp-log78.2%
Applied egg-rr78.2%
if -0.13 < m < 1.85000000000000009e49Initial program 89.6%
associate-*l/87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 78.0%
if 1.85000000000000009e49 < m Initial program 70.1%
associate-*l/64.2%
sqr-neg64.2%
associate-+l+64.2%
sqr-neg64.2%
distribute-rgt-out64.2%
Simplified64.2%
Taylor expanded in m around 0 2.6%
clear-num2.6%
inv-pow2.6%
+-commutative2.6%
+-commutative2.6%
fma-udef2.6%
Applied egg-rr2.6%
unpow-12.6%
Simplified2.6%
Taylor expanded in k around inf 2.1%
+-commutative2.1%
unpow22.1%
distribute-rgt-in2.1%
Simplified2.1%
Taylor expanded in k around 0 12.7%
Final simplification61.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k 2.1e-302)
(/ a_m (* k (+ k 10.0)))
(if (<= k 25000000000000.0)
(/ a_m (+ 1.0 (* k 10.0)))
(/ 1.0 (* (+ k 10.0) (/ k a_m)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 2.1e-302) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 25000000000000.0) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / ((k + 10.0) * (k / a_m));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 2.1d-302) then
tmp = a_m / (k * (k + 10.0d0))
else if (k <= 25000000000000.0d0) then
tmp = a_m / (1.0d0 + (k * 10.0d0))
else
tmp = 1.0d0 / ((k + 10.0d0) * (k / a_m))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 2.1e-302) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 25000000000000.0) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / ((k + 10.0) * (k / a_m));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if k <= 2.1e-302: tmp = a_m / (k * (k + 10.0)) elif k <= 25000000000000.0: tmp = a_m / (1.0 + (k * 10.0)) else: tmp = 1.0 / ((k + 10.0) * (k / a_m)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (k <= 2.1e-302) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); elseif (k <= 25000000000000.0) tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(1.0 / Float64(Float64(k + 10.0) * Float64(k / a_m))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (k <= 2.1e-302) tmp = a_m / (k * (k + 10.0)); elseif (k <= 25000000000000.0) tmp = a_m / (1.0 + (k * 10.0)); else tmp = 1.0 / ((k + 10.0) * (k / a_m)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[k, 2.1e-302], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 25000000000000.0], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(k + 10.0), $MachinePrecision] * N[(k / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{-302}:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 25000000000000:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(k + 10\right) \cdot \frac{k}{a\_m}}\\
\end{array}
\end{array}
if k < 2.10000000000000013e-302Initial program 90.3%
associate-*l/87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 27.7%
clear-num27.7%
inv-pow27.7%
+-commutative27.7%
+-commutative27.7%
fma-udef27.7%
Applied egg-rr27.7%
unpow-127.7%
Simplified27.7%
Taylor expanded in k around inf 28.0%
+-commutative28.0%
unpow228.0%
distribute-rgt-in28.0%
Simplified28.0%
Taylor expanded in a around 0 28.0%
associate-/r*22.8%
+-commutative22.8%
associate-/r*28.0%
Simplified28.0%
if 2.10000000000000013e-302 < k < 2.5e13Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 46.4%
Taylor expanded in k around 0 46.4%
*-commutative46.4%
Simplified46.4%
if 2.5e13 < k Initial program 75.9%
associate-*l/71.7%
sqr-neg71.7%
associate-+l+71.7%
sqr-neg71.7%
distribute-rgt-out71.7%
Simplified71.7%
Taylor expanded in m around 0 55.8%
clear-num56.1%
inv-pow56.1%
+-commutative56.1%
+-commutative56.1%
fma-udef56.1%
Applied egg-rr56.1%
unpow-156.1%
Simplified56.1%
Taylor expanded in k around inf 56.1%
+-commutative56.1%
unpow256.1%
distribute-rgt-in56.1%
Simplified56.1%
Taylor expanded in a around 0 56.1%
associate-/l*58.5%
+-commutative58.5%
associate-/r/58.6%
Simplified58.6%
Final simplification45.7%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (+ 1.0 (* k (+ k 10.0))))) (* a_s (if (<= m -1.05) (/ 1.0 (/ (+ t_0 -1.0) a_m)) (/ a_m t_0)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -1.05) {
tmp = 1.0 / ((t_0 + -1.0) / a_m);
} else {
tmp = a_m / t_0;
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (k * (k + 10.0d0))
if (m <= (-1.05d0)) then
tmp = 1.0d0 / ((t_0 + (-1.0d0)) / a_m)
else
tmp = a_m / t_0
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -1.05) {
tmp = 1.0 / ((t_0 + -1.0) / a_m);
} else {
tmp = a_m / t_0;
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = 1.0 + (k * (k + 10.0)) tmp = 0 if m <= -1.05: tmp = 1.0 / ((t_0 + -1.0) / a_m) else: tmp = a_m / t_0 return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(1.0 + Float64(k * Float64(k + 10.0))) tmp = 0.0 if (m <= -1.05) tmp = Float64(1.0 / Float64(Float64(t_0 + -1.0) / a_m)); else tmp = Float64(a_m / t_0); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = 1.0 + (k * (k + 10.0)); tmp = 0.0; if (m <= -1.05) tmp = 1.0 / ((t_0 + -1.0) / a_m); else tmp = a_m / t_0; end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -1.05], N[(1.0 / N[(N[(t$95$0 + -1.0), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m / t$95$0), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := 1 + k \cdot \left(k + 10\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.05:\\
\;\;\;\;\frac{1}{\frac{t\_0 + -1}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{t\_0}\\
\end{array}
\end{array}
\end{array}
if m < -1.05000000000000004Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.5%
clear-num42.1%
inv-pow42.1%
+-commutative42.1%
+-commutative42.1%
fma-udef42.1%
Applied egg-rr42.1%
unpow-142.1%
Simplified42.1%
Taylor expanded in k around inf 45.8%
+-commutative45.8%
unpow245.8%
distribute-rgt-in45.8%
Simplified45.8%
expm1-log1p-u45.8%
expm1-udef78.2%
log1p-udef78.2%
add-exp-log78.2%
Applied egg-rr78.2%
if -1.05000000000000004 < m Initial program 81.5%
associate-*l/77.7%
sqr-neg77.7%
associate-+l+77.7%
sqr-neg77.7%
distribute-rgt-out77.7%
Simplified77.7%
Taylor expanded in m around 0 46.4%
Final simplification58.4%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= k 6.5e-301) (not (<= k 5.4e-6)))
(/ a_m (* k (+ k 10.0)))
(+ a_m (* (* a_m k) -10.0)))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 6.5e-301) || !(k <= 5.4e-6)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m + ((a_m * k) * -10.0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 6.5d-301) .or. (.not. (k <= 5.4d-6))) then
tmp = a_m / (k * (k + 10.0d0))
else
tmp = a_m + ((a_m * k) * (-10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 6.5e-301) || !(k <= 5.4e-6)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m + ((a_m * k) * -10.0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= 6.5e-301) or not (k <= 5.4e-6): tmp = a_m / (k * (k + 10.0)) else: tmp = a_m + ((a_m * k) * -10.0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= 6.5e-301) || !(k <= 5.4e-6)) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); else tmp = Float64(a_m + Float64(Float64(a_m * k) * -10.0)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= 6.5e-301) || ~((k <= 5.4e-6))) tmp = a_m / (k * (k + 10.0)); else tmp = a_m + ((a_m * k) * -10.0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, 6.5e-301], N[Not[LessEqual[k, 5.4e-6]], $MachinePrecision]], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(N[(a$95$m * k), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 6.5 \cdot 10^{-301} \lor \neg \left(k \leq 5.4 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m + \left(a\_m \cdot k\right) \cdot -10\\
\end{array}
\end{array}
if k < 6.49999999999999991e-301 or 5.39999999999999997e-6 < k Initial program 82.8%
associate-*l/79.3%
sqr-neg79.3%
associate-+l+79.3%
sqr-neg79.3%
distribute-rgt-out79.3%
Simplified79.3%
Taylor expanded in m around 0 42.2%
clear-num42.4%
inv-pow42.4%
+-commutative42.4%
+-commutative42.4%
fma-udef42.4%
Applied egg-rr42.4%
unpow-142.4%
Simplified42.4%
Taylor expanded in k around inf 42.5%
+-commutative42.5%
unpow242.5%
distribute-rgt-in42.5%
Simplified42.5%
Taylor expanded in a around 0 42.4%
associate-/r*41.6%
+-commutative41.6%
associate-/r*42.4%
Simplified42.4%
if 6.49999999999999991e-301 < k < 5.39999999999999997e-6Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 49.4%
Taylor expanded in k around 0 49.4%
Final simplification44.7%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= k 1.3e-302) (not (<= k 25000000000000.0)))
(/ a_m (* k (+ k 10.0)))
(/ a_m (+ 1.0 (* k 10.0))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 1.3e-302) || !(k <= 25000000000000.0)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m / (1.0 + (k * 10.0));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 1.3d-302) .or. (.not. (k <= 25000000000000.0d0))) then
tmp = a_m / (k * (k + 10.0d0))
else
tmp = a_m / (1.0d0 + (k * 10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 1.3e-302) || !(k <= 25000000000000.0)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m / (1.0 + (k * 10.0));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= 1.3e-302) or not (k <= 25000000000000.0): tmp = a_m / (k * (k + 10.0)) else: tmp = a_m / (1.0 + (k * 10.0)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= 1.3e-302) || !(k <= 25000000000000.0)) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); else tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= 1.3e-302) || ~((k <= 25000000000000.0))) tmp = a_m / (k * (k + 10.0)); else tmp = a_m / (1.0 + (k * 10.0)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, 1.3e-302], N[Not[LessEqual[k, 25000000000000.0]], $MachinePrecision]], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 1.3 \cdot 10^{-302} \lor \neg \left(k \leq 25000000000000\right):\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < 1.30000000000000006e-302 or 2.5e13 < k Initial program 82.2%
associate-*l/78.5%
sqr-neg78.5%
associate-+l+78.5%
sqr-neg78.5%
distribute-rgt-out78.5%
Simplified78.5%
Taylor expanded in m around 0 43.6%
clear-num43.8%
inv-pow43.8%
+-commutative43.8%
+-commutative43.8%
fma-udef43.8%
Applied egg-rr43.8%
unpow-143.8%
Simplified43.8%
Taylor expanded in k around inf 43.9%
+-commutative43.9%
unpow243.9%
distribute-rgt-in43.9%
Simplified43.9%
Taylor expanded in a around 0 43.7%
associate-/r*42.9%
+-commutative42.9%
associate-/r*43.7%
Simplified43.7%
if 1.30000000000000006e-302 < k < 2.5e13Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 46.4%
Taylor expanded in k around 0 46.4%
*-commutative46.4%
Simplified46.4%
Final simplification44.7%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= k 1.65e-295) (not (<= k 25000000000000.0)))
(/ 0.1 (/ k a_m))
a_m)))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 1.65e-295) || !(k <= 25000000000000.0)) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 1.65d-295) .or. (.not. (k <= 25000000000000.0d0))) then
tmp = 0.1d0 / (k / a_m)
else
tmp = a_m
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= 1.65e-295) || !(k <= 25000000000000.0)) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= 1.65e-295) or not (k <= 25000000000000.0): tmp = 0.1 / (k / a_m) else: tmp = a_m return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= 1.65e-295) || !(k <= 25000000000000.0)) tmp = Float64(0.1 / Float64(k / a_m)); else tmp = a_m; end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= 1.65e-295) || ~((k <= 25000000000000.0))) tmp = 0.1 / (k / a_m); else tmp = a_m; end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, 1.65e-295], N[Not[LessEqual[k, 25000000000000.0]], $MachinePrecision]], N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision], a$95$m]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 1.65 \cdot 10^{-295} \lor \neg \left(k \leq 25000000000000\right):\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m\\
\end{array}
\end{array}
if k < 1.6499999999999999e-295 or 2.5e13 < k Initial program 82.2%
associate-*l/78.5%
sqr-neg78.5%
associate-+l+78.5%
sqr-neg78.5%
distribute-rgt-out78.5%
Simplified78.5%
Taylor expanded in m around 0 43.6%
clear-num43.8%
inv-pow43.8%
+-commutative43.8%
+-commutative43.8%
fma-udef43.8%
Applied egg-rr43.8%
unpow-143.8%
Simplified43.8%
Taylor expanded in k around inf 43.9%
+-commutative43.9%
unpow243.9%
distribute-rgt-in43.9%
Simplified43.9%
Taylor expanded in k around 0 17.9%
associate-*r/17.9%
associate-/l*19.2%
Simplified19.2%
if 1.6499999999999999e-295 < k < 2.5e13Initial program 99.9%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 99.4%
Taylor expanded in m around 0 46.0%
Final simplification28.6%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* k (+ k 10.0)))) (* a_s (if (<= m -9.8e+35) (/ 1.0 (/ t_0 a_m)) (/ a_m (+ 1.0 t_0))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -9.8e+35) {
tmp = 1.0 / (t_0 / a_m);
} else {
tmp = a_m / (1.0 + t_0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-9.8d+35)) then
tmp = 1.0d0 / (t_0 / a_m)
else
tmp = a_m / (1.0d0 + t_0)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -9.8e+35) {
tmp = 1.0 / (t_0 / a_m);
} else {
tmp = a_m / (1.0 + t_0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -9.8e+35: tmp = 1.0 / (t_0 / a_m) else: tmp = a_m / (1.0 + t_0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -9.8e+35) tmp = Float64(1.0 / Float64(t_0 / a_m)); else tmp = Float64(a_m / Float64(1.0 + t_0)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -9.8e+35) tmp = 1.0 / (t_0 / a_m); else tmp = a_m / (1.0 + t_0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -9.8e+35], N[(1.0 / N[(t$95$0 / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -9.8 \cdot 10^{+35}:\\
\;\;\;\;\frac{1}{\frac{t\_0}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + t\_0}\\
\end{array}
\end{array}
\end{array}
if m < -9.8000000000000005e35Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 42.9%
clear-num43.5%
inv-pow43.5%
+-commutative43.5%
+-commutative43.5%
fma-udef43.5%
Applied egg-rr43.5%
unpow-143.5%
Simplified43.5%
Taylor expanded in k around inf 47.9%
+-commutative47.9%
unpow247.9%
distribute-rgt-in47.9%
Simplified47.9%
if -9.8000000000000005e35 < m Initial program 82.9%
associate-*l/79.4%
sqr-neg79.4%
associate-+l+79.4%
sqr-neg79.4%
distribute-rgt-out79.4%
Simplified79.4%
Taylor expanded in m around 0 45.4%
Final simplification46.2%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m -5.8e-22) (/ 0.1 (/ k a_m)) (+ a_m (* (* a_m k) -10.0)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.8e-22) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m + ((a_m * k) * -10.0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-5.8d-22)) then
tmp = 0.1d0 / (k / a_m)
else
tmp = a_m + ((a_m * k) * (-10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.8e-22) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m + ((a_m * k) * -10.0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -5.8e-22: tmp = 0.1 / (k / a_m) else: tmp = a_m + ((a_m * k) * -10.0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -5.8e-22) tmp = Float64(0.1 / Float64(k / a_m)); else tmp = Float64(a_m + Float64(Float64(a_m * k) * -10.0)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -5.8e-22) tmp = 0.1 / (k / a_m); else tmp = a_m + ((a_m * k) * -10.0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -5.8e-22], N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(N[(a$95$m * k), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -5.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m + \left(a\_m \cdot k\right) \cdot -10\\
\end{array}
\end{array}
if m < -5.8000000000000003e-22Initial program 98.2%
associate-*l/98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
Taylor expanded in m around 0 41.9%
clear-num42.4%
inv-pow42.4%
+-commutative42.4%
+-commutative42.4%
fma-udef42.4%
Applied egg-rr42.4%
unpow-142.4%
Simplified42.4%
Taylor expanded in k around inf 45.3%
+-commutative45.3%
unpow245.3%
distribute-rgt-in45.3%
Simplified45.3%
Taylor expanded in k around 0 24.2%
associate-*r/24.2%
associate-/l*25.5%
Simplified25.5%
if -5.8000000000000003e-22 < m Initial program 81.9%
associate-*l/78.0%
sqr-neg78.0%
associate-+l+78.0%
sqr-neg78.0%
distribute-rgt-out78.0%
Simplified78.0%
Taylor expanded in m around 0 46.3%
Taylor expanded in k around 0 29.2%
Final simplification27.7%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m -5.8e-22) (* (/ a_m k) 0.1) a_m)))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.8e-22) {
tmp = (a_m / k) * 0.1;
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-5.8d-22)) then
tmp = (a_m / k) * 0.1d0
else
tmp = a_m
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5.8e-22) {
tmp = (a_m / k) * 0.1;
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -5.8e-22: tmp = (a_m / k) * 0.1 else: tmp = a_m return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -5.8e-22) tmp = Float64(Float64(a_m / k) * 0.1); else tmp = a_m; end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -5.8e-22) tmp = (a_m / k) * 0.1; else tmp = a_m; end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -5.8e-22], N[(N[(a$95$m / k), $MachinePrecision] * 0.1), $MachinePrecision], a$95$m]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -5.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{a\_m}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\_m\\
\end{array}
\end{array}
if m < -5.8000000000000003e-22Initial program 98.2%
associate-*l/98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
Taylor expanded in m around 0 41.9%
Taylor expanded in k around 0 21.3%
*-commutative21.3%
Simplified21.3%
Taylor expanded in k around inf 24.2%
if -5.8000000000000003e-22 < m Initial program 81.9%
associate-/l*81.9%
sqr-neg81.9%
associate-+l+81.9%
+-commutative81.9%
sqr-neg81.9%
distribute-rgt-out81.9%
fma-def81.9%
+-commutative81.9%
Simplified81.9%
Taylor expanded in k around 0 77.4%
Taylor expanded in m around 0 28.1%
Final simplification26.5%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s a_m))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
return a_s * a_m;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a_s * a_m
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
return a_s * a_m;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): return a_s * a_m
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) return Float64(a_s * a_m) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp = code(a_s, a_m, k, m) tmp = a_s * a_m; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * a$95$m), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot a\_m
\end{array}
Initial program 88.4%
associate-/l*88.4%
sqr-neg88.4%
associate-+l+88.4%
+-commutative88.4%
sqr-neg88.4%
distribute-rgt-out88.4%
fma-def88.4%
+-commutative88.4%
Simplified88.4%
Taylor expanded in k around 0 84.8%
Taylor expanded in m around 0 18.7%
Final simplification18.7%
herbie shell --seed 2024031
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))