
(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 14 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)) (+ (* k k) (+ 1.0 (* k 10.0)))) 2e+124)
(* (pow k m) (/ a_m (+ 1.0 (* k (+ k 10.0)))))
(/ a_m (fma 10.0 (/ k (pow k 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)) / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+124) {
tmp = pow(k, m) * (a_m / (1.0 + (k * (k + 10.0))));
} else {
tmp = a_m / fma(10.0, (k / pow(k, m)), 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(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 2e+124) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a_m / fma(10.0, Float64(k / (k ^ m)), (k ^ Float64(-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[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+124], 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[(10.0 * N[(k / N[Power[k, m], $MachinePrecision]), $MachinePrecision] + N[Power[k, (-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}\;\frac{a\_m \cdot {k}^{m}}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 2 \cdot 10^{+124}:\\
\;\;\;\;{k}^{m} \cdot \frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{\mathsf{fma}\left(10, \frac{k}{{k}^{m}}, {k}^{\left(-m\right)}\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%
associate-*l/94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
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 100.0%
fma-def100.0%
exp-to-pow69.4%
*-commutative69.4%
exp-neg69.4%
distribute-lft-neg-out69.4%
*-commutative69.4%
exp-to-pow100.0%
Simplified100.0%
Final simplification95.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)
(* (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 -3.5e-9)
(* a_m (pow k m))
(if (<= m 9.2e-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 <= -3.5e-9) {
tmp = a_m * pow(k, m);
} else if (m <= 9.2e-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 <= (-3.5d-9)) then
tmp = a_m * (k ** m)
else if (m <= 9.2d-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 <= -3.5e-9) {
tmp = a_m * Math.pow(k, m);
} else if (m <= 9.2e-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 <= -3.5e-9: tmp = a_m * math.pow(k, m) elif m <= 9.2e-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 <= -3.5e-9) tmp = Float64(a_m * (k ^ m)); elseif (m <= 9.2e-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 <= -3.5e-9) tmp = a_m * (k ^ m); elseif (m <= 9.2e-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, -3.5e-9], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9.2e-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 -3.5 \cdot 10^{-9}:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{elif}\;m \leq 9.2 \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 < -3.4999999999999999e-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 -3.4999999999999999e-9 < m < 9.2000000000000003e-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 9.2000000000000003e-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.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.2e-9)
(* (pow k m) (/ a_m (+ 1.0 (* k 10.0))))
(if (<= m 4e-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 <= -1.2e-9) {
tmp = pow(k, m) * (a_m / (1.0 + (k * 10.0)));
} else if (m <= 4e-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 <= (-1.2d-9)) then
tmp = (k ** m) * (a_m / (1.0d0 + (k * 10.0d0)))
else if (m <= 4d-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 <= -1.2e-9) {
tmp = Math.pow(k, m) * (a_m / (1.0 + (k * 10.0)));
} else if (m <= 4e-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 <= -1.2e-9: tmp = math.pow(k, m) * (a_m / (1.0 + (k * 10.0))) elif m <= 4e-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 <= -1.2e-9) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 4e-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 <= -1.2e-9) tmp = (k ^ m) * (a_m / (1.0 + (k * 10.0))); elseif (m <= 4e-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, -1.2e-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, 4e-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 -1.2 \cdot 10^{-9}:\\
\;\;\;\;{k}^{m} \cdot \frac{a\_m}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 4 \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 < -1.2e-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.2e-9 < m < 4.0000000000000001e-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 4.0000000000000001e-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 -4e-11)
(/ a_m (/ (+ 1.0 (* k 10.0)) (pow k m)))
(if (<= m 4.5e-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 <= -4e-11) {
tmp = a_m / ((1.0 + (k * 10.0)) / pow(k, m));
} else if (m <= 4.5e-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 <= (-4d-11)) then
tmp = a_m / ((1.0d0 + (k * 10.0d0)) / (k ** m))
else if (m <= 4.5d-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 <= -4e-11) {
tmp = a_m / ((1.0 + (k * 10.0)) / Math.pow(k, m));
} else if (m <= 4.5e-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 <= -4e-11: tmp = a_m / ((1.0 + (k * 10.0)) / math.pow(k, m)) elif m <= 4.5e-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 <= -4e-11) tmp = Float64(a_m / Float64(Float64(1.0 + Float64(k * 10.0)) / (k ^ m))); elseif (m <= 4.5e-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 <= -4e-11) tmp = a_m / ((1.0 + (k * 10.0)) / (k ^ m)); elseif (m <= 4.5e-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, -4e-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, 4.5e-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 -4 \cdot 10^{-11}:\\
\;\;\;\;\frac{a\_m}{\frac{1 + k \cdot 10}{{k}^{m}}}\\
\mathbf{elif}\;m \leq 4.5 \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 < -3.99999999999999976e-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 -3.99999999999999976e-11 < m < 4.5e-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 4.5e-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.9%
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.2e-9) (not (<= m 2.5e-10)))
(* 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.2e-9) || !(m <= 2.5e-10)) {
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.2d-9)) .or. (.not. (m <= 2.5d-10))) 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.2e-9) || !(m <= 2.5e-10)) {
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.2e-9) or not (m <= 2.5e-10): 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.2e-9) || !(m <= 2.5e-10)) 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.2e-9) || ~((m <= 2.5e-10))) 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.2e-9], N[Not[LessEqual[m, 2.5e-10]], $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.2 \cdot 10^{-9} \lor \neg \left(m \leq 2.5 \cdot 10^{-10}\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.20000000000000012e-9 or 2.50000000000000016e-10 < 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.20000000000000012e-9 < m < 2.50000000000000016e-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%
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 (<= k 6.5e-295) (not (<= k 25000000000000.0)))
(/ 1.0 (/ (* k (+ k 10.0)) a_m))
(* a_m (/ 1.0 (+ 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 <= 6.5e-295) || !(k <= 25000000000000.0)) {
tmp = 1.0 / ((k * (k + 10.0)) / a_m);
} else {
tmp = a_m * (1.0 / (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 <= 6.5d-295) .or. (.not. (k <= 25000000000000.0d0))) then
tmp = 1.0d0 / ((k * (k + 10.0d0)) / a_m)
else
tmp = a_m * (1.0d0 / (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 <= 6.5e-295) || !(k <= 25000000000000.0)) {
tmp = 1.0 / ((k * (k + 10.0)) / a_m);
} else {
tmp = a_m * (1.0 / (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 <= 6.5e-295) or not (k <= 25000000000000.0): tmp = 1.0 / ((k * (k + 10.0)) / a_m) else: tmp = a_m * (1.0 / (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 <= 6.5e-295) || !(k <= 25000000000000.0)) tmp = Float64(1.0 / Float64(Float64(k * Float64(k + 10.0)) / a_m)); else tmp = Float64(a_m * Float64(1.0 / 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 <= 6.5e-295) || ~((k <= 25000000000000.0))) tmp = 1.0 / ((k * (k + 10.0)) / a_m); else tmp = a_m * (1.0 / (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, 6.5e-295], N[Not[LessEqual[k, 25000000000000.0]], $MachinePrecision]], N[(1.0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 / N[(1.0 + 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}\;k \leq 6.5 \cdot 10^{-295} \lor \neg \left(k \leq 25000000000000\right):\\
\;\;\;\;\frac{1}{\frac{k \cdot \left(k + 10\right)}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot \frac{1}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < 6.4999999999999998e-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%
unpow243.9%
distribute-rgt-in43.9%
Simplified43.9%
if 6.4999999999999998e-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%
clear-num99.8%
associate-/r/100.0%
clear-num100.0%
remove-double-div100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 46.5%
Taylor expanded in k around 0 46.5%
*-commutative46.4%
Simplified46.5%
Final simplification44.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 (<= k 1.2e-302) (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.2e-302) || !(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.2d-302) .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.2e-302) || !(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.2e-302) 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.2e-302) || !(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.2e-302) || ~((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.2e-302], 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.2 \cdot 10^{-302} \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.20000000000000011e-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%
Taylor expanded in k around 0 17.8%
*-commutative17.8%
Simplified17.8%
Taylor expanded in k around inf 17.9%
clear-num19.2%
un-div-inv19.2%
Applied egg-rr19.2%
if 1.20000000000000011e-302 < 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 (* a_s (if (<= m -8e+34) (/ 0.1 (/ k a_m)) (* a_m (/ 1.0 (+ 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 (m <= -8e+34) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m * (1.0 / (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 (m <= (-8d+34)) then
tmp = 0.1d0 / (k / a_m)
else
tmp = a_m * (1.0d0 / (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 (m <= -8e+34) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m * (1.0 / (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 m <= -8e+34: tmp = 0.1 / (k / a_m) else: tmp = a_m * (1.0 / (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 (m <= -8e+34) tmp = Float64(0.1 / Float64(k / a_m)); else tmp = Float64(a_m * Float64(1.0 / 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 (m <= -8e+34) tmp = 0.1 / (k / a_m); else tmp = a_m * (1.0 / (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[LessEqual[m, -8e+34], N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 / N[(1.0 + 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 -8 \cdot 10^{+34}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m \cdot \frac{1}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -7.99999999999999956e34Initial 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%
Taylor expanded in k around 0 23.3%
*-commutative23.3%
Simplified23.3%
Taylor expanded in k around inf 27.7%
clear-num29.3%
un-div-inv29.3%
Applied egg-rr29.3%
if -7.99999999999999956e34 < m Initial program 82.9%
associate-/l*82.9%
sqr-neg82.9%
associate-+l+82.9%
+-commutative82.9%
sqr-neg82.9%
distribute-rgt-out82.9%
fma-def82.9%
+-commutative82.9%
Simplified82.9%
clear-num82.6%
associate-/r/82.9%
clear-num82.9%
remove-double-div82.8%
Applied egg-rr82.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around 0 30.0%
*-commutative30.0%
Simplified30.0%
Final simplification29.8%
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 -4.1e+34) (/ 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 <= -4.1e+34) {
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 <= (-4.1d+34)) 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 <= -4.1e+34) {
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 <= -4.1e+34: 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 <= -4.1e+34) 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 <= -4.1e+34) 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, -4.1e+34], 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 -4.1 \cdot 10^{+34}:\\
\;\;\;\;\frac{1}{\frac{t\_0}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + t\_0}\\
\end{array}
\end{array}
\end{array}
if m < -4.0999999999999998e34Initial 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%
unpow247.9%
distribute-rgt-in47.9%
Simplified47.9%
if -4.0999999999999998e34 < 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 (* -10.0 (* 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 (m <= -5.8e-22) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m + (-10.0 * (a_m * k));
}
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 + ((-10.0d0) * (a_m * k))
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 + (-10.0 * (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 m <= -5.8e-22: tmp = 0.1 / (k / a_m) else: tmp = a_m + (-10.0 * (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 (m <= -5.8e-22) tmp = Float64(0.1 / Float64(k / a_m)); else tmp = Float64(a_m + Float64(-10.0 * 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 (m <= -5.8e-22) tmp = 0.1 / (k / a_m); else tmp = a_m + (-10.0 * (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[m, -5.8e-22], N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $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 -5.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\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%
clear-num25.5%
un-div-inv25.5%
Applied egg-rr25.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 -3.85e+34) (/ 0.1 (/ k a_m)) (/ 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 (m <= -3.85e+34) {
tmp = 0.1 / (k / a_m);
} 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 (m <= (-3.85d+34)) then
tmp = 0.1d0 / (k / a_m)
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 (m <= -3.85e+34) {
tmp = 0.1 / (k / a_m);
} 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 m <= -3.85e+34: tmp = 0.1 / (k / a_m) 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 (m <= -3.85e+34) tmp = Float64(0.1 / Float64(k / a_m)); 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 (m <= -3.85e+34) tmp = 0.1 / (k / a_m); 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[LessEqual[m, -3.85e+34], N[(0.1 / N[(k / a$95$m), $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}\;m \leq -3.85 \cdot 10^{+34}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -3.8499999999999999e34Initial 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%
Taylor expanded in k around 0 23.3%
*-commutative23.3%
Simplified23.3%
Taylor expanded in k around inf 27.7%
clear-num29.3%
un-div-inv29.3%
Applied egg-rr29.3%
if -3.8499999999999999e34 < 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%
Taylor expanded in k around 0 30.0%
*-commutative30.0%
Simplified30.0%
Final simplification29.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 -5.8e-22) (* 0.1 (/ a_m 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 (m <= -5.8e-22) {
tmp = 0.1 * (a_m / k);
} 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 = 0.1d0 * (a_m / k)
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 = 0.1 * (a_m / k);
} 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 = 0.1 * (a_m / k) 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(0.1 * Float64(a_m / k)); 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 = 0.1 * (a_m / k); 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[(0.1 * N[(a$95$m / k), $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}\;m \leq -5.8 \cdot 10^{-22}:\\
\;\;\;\;0.1 \cdot \frac{a\_m}{k}\\
\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))))