
(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 12 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 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* a_m (pow k m))) (t_1 (/ 1.0 t_0)))
(*
a_s
(if (<= (/ t_0 (- (* k k) (- -1.0 (* k 10.0)))) 2e-309)
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m (hypot 1.0 k)))
(/ 1.0 (+ t_1 (* k (+ (* 10.0 t_1) (/ k 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 = a_m * pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 2e-309) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / hypot(1.0, k));
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
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 t_0 = a_m * Math.pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 2e-309) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a_m / Math.hypot(1.0, k));
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / 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 = a_m * math.pow(k, m) t_1 = 1.0 / t_0 tmp = 0 if (t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 2e-309: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a_m / math.hypot(1.0, k)) else: tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / 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(a_m * (k ^ m)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) - Float64(-1.0 - Float64(k * 10.0)))) <= 2e-309) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / hypot(1.0, k))); else tmp = Float64(1.0 / Float64(t_1 + Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / 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 = a_m * (k ^ m); t_1 = 1.0 / t_0; tmp = 0.0; if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 2e-309) tmp = ((k ^ m) / hypot(1.0, k)) * (a_m / hypot(1.0, k)); else tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / 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[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] - N[(-1.0 - N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e-309], 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[(1.0 / N[(t$95$1 + N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $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 := a\_m \cdot {k}^{m}\\
t_1 := \frac{1}{t\_0}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_0}{k \cdot k - \left(-1 - k \cdot 10\right)} \leq 2 \cdot 10^{-309}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a\_m}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right)}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.9999999999999988e-309Initial program 97.4%
*-commutative97.4%
Simplified97.4%
Taylor expanded in k around 0 96.3%
*-commutative96.3%
add-sqr-sqrt96.3%
times-frac95.7%
hypot-1-def95.7%
hypot-1-def98.3%
Applied egg-rr98.3%
if 1.9999999999999988e-309 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 79.7%
associate-/l*79.7%
remove-double-neg79.7%
distribute-frac-neg279.7%
distribute-neg-frac279.7%
remove-double-neg79.7%
sqr-neg79.7%
associate-+l+79.7%
sqr-neg79.7%
distribute-rgt-out79.7%
Simplified79.7%
distribute-lft-in79.7%
associate-+l+79.7%
associate-*r/79.7%
clear-num79.6%
associate-+l+79.6%
distribute-lft-in79.6%
+-commutative79.6%
fma-define79.6%
+-commutative79.6%
*-commutative79.6%
Applied egg-rr79.6%
Taylor expanded in k around 0 99.9%
Final simplification98.7%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* a_m (pow k m))))
(*
a_s
(if (<= (/ t_0 (- (* k k) (- -1.0 (* k 10.0)))) 5e+233)
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m (hypot 1.0 k)))
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 = a_m * pow(k, m);
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / hypot(1.0, k));
} else {
tmp = t_0;
}
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 t_0 = a_m * Math.pow(k, m);
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a_m / Math.hypot(1.0, k));
} else {
tmp = 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 = a_m * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a_m / math.hypot(1.0, k)) else: tmp = 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(a_m * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) - Float64(-1.0 - Float64(k * 10.0)))) <= 5e+233) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / hypot(1.0, k))); else tmp = 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 = a_m * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) tmp = ((k ^ m) / hypot(1.0, k)) * (a_m / hypot(1.0, k)); else tmp = 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[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] - N[(-1.0 - N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+233], 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], t$95$0]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := a\_m \cdot {k}^{m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_0}{k \cdot k - \left(-1 - k \cdot 10\right)} \leq 5 \cdot 10^{+233}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a\_m}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 5.00000000000000009e233Initial program 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in k around 0 96.0%
*-commutative96.0%
add-sqr-sqrt96.0%
times-frac95.5%
hypot-1-def95.5%
hypot-1-def97.7%
Applied egg-rr97.7%
if 5.00000000000000009e233 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 65.1%
associate-/l*65.1%
remove-double-neg65.1%
distribute-frac-neg265.1%
distribute-neg-frac265.1%
remove-double-neg65.1%
sqr-neg65.1%
associate-+l+65.1%
sqr-neg65.1%
distribute-rgt-out65.1%
Simplified65.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.1%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* a_m (pow k m))))
(*
a_s
(if (<= (/ t_0 (- (* k k) (- -1.0 (* k 10.0)))) 5e+233)
(* a_m (/ (pow k m) (+ (* k (+ k 10.0)) 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 = a_m * pow(k, m);
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) {
tmp = a_m * (pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = 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 = a_m * (k ** m)
if ((t_0 / ((k * k) - ((-1.0d0) - (k * 10.0d0)))) <= 5d+233) then
tmp = a_m * ((k ** m) / ((k * (k + 10.0d0)) + 1.0d0))
else
tmp = 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 = a_m * Math.pow(k, m);
double tmp;
if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) {
tmp = a_m * (Math.pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = 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 = a_m * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233: tmp = a_m * (math.pow(k, m) / ((k * (k + 10.0)) + 1.0)) else: tmp = 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(a_m * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) - Float64(-1.0 - Float64(k * 10.0)))) <= 5e+233) tmp = Float64(a_m * Float64((k ^ m) / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); else tmp = 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 = a_m * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) - (-1.0 - (k * 10.0)))) <= 5e+233) tmp = a_m * ((k ^ m) / ((k * (k + 10.0)) + 1.0)); else tmp = 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[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] - N[(-1.0 - N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+233], N[(a$95$m * N[(N[Power[k, m], $MachinePrecision] / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := a\_m \cdot {k}^{m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_0}{k \cdot k - \left(-1 - k \cdot 10\right)} \leq 5 \cdot 10^{+233}:\\
\;\;\;\;a\_m \cdot \frac{{k}^{m}}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 5.00000000000000009e233Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
if 5.00000000000000009e233 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 65.1%
associate-/l*65.1%
remove-double-neg65.1%
distribute-frac-neg265.1%
distribute-neg-frac265.1%
remove-double-neg65.1%
sqr-neg65.1%
associate-+l+65.1%
sqr-neg65.1%
distribute-rgt-out65.1%
Simplified65.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.1%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* a_m (pow k m)))) (* a_s (if (<= m 3.2) (/ t_0 (+ (* k k) 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 = a_m * pow(k, m);
double tmp;
if (m <= 3.2) {
tmp = t_0 / ((k * k) + 1.0);
} else {
tmp = 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 = a_m * (k ** m)
if (m <= 3.2d0) then
tmp = t_0 / ((k * k) + 1.0d0)
else
tmp = 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 = a_m * Math.pow(k, m);
double tmp;
if (m <= 3.2) {
tmp = t_0 / ((k * k) + 1.0);
} else {
tmp = 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 = a_m * math.pow(k, m) tmp = 0 if m <= 3.2: tmp = t_0 / ((k * k) + 1.0) else: tmp = 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(a_m * (k ^ m)) tmp = 0.0 if (m <= 3.2) tmp = Float64(t_0 / Float64(Float64(k * k) + 1.0)); else tmp = 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 = a_m * (k ^ m); tmp = 0.0; if (m <= 3.2) tmp = t_0 / ((k * k) + 1.0); else tmp = 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[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, 3.2], N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := a\_m \cdot {k}^{m}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 3.2:\\
\;\;\;\;\frac{t\_0}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if m < 3.2000000000000002Initial program 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in k around 0 95.0%
if 3.2000000000000002 < m Initial program 83.0%
associate-/l*83.0%
remove-double-neg83.0%
distribute-frac-neg283.0%
distribute-neg-frac283.0%
remove-double-neg83.0%
sqr-neg83.0%
associate-+l+83.0%
sqr-neg83.0%
distribute-rgt-out83.0%
Simplified83.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification96.7%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= m -290000.0) (not (<= m 4e-6)))
(* a_m (pow k m))
(/ a_m (+ (* k (+ k 10.0)) 1.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 <= -290000.0) || !(m <= 4e-6)) {
tmp = a_m * pow(k, m);
} else {
tmp = a_m / ((k * (k + 10.0)) + 1.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 <= (-290000.0d0)) .or. (.not. (m <= 4d-6))) then
tmp = a_m * (k ** m)
else
tmp = a_m / ((k * (k + 10.0d0)) + 1.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 <= -290000.0) || !(m <= 4e-6)) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = a_m / ((k * (k + 10.0)) + 1.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 <= -290000.0) or not (m <= 4e-6): tmp = a_m * math.pow(k, m) else: tmp = a_m / ((k * (k + 10.0)) + 1.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 <= -290000.0) || !(m <= 4e-6)) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(a_m / Float64(Float64(k * Float64(k + 10.0)) + 1.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 <= -290000.0) || ~((m <= 4e-6))) tmp = a_m * (k ^ m); else tmp = a_m / ((k * (k + 10.0)) + 1.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, -290000.0], N[Not[LessEqual[m, 4e-6]], $MachinePrecision]], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.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 -290000 \lor \neg \left(m \leq 4 \cdot 10^{-6}\right):\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
\end{array}
\end{array}
if m < -2.9e5 or 3.99999999999999982e-6 < m Initial program 90.8%
associate-/l*90.8%
remove-double-neg90.8%
distribute-frac-neg290.8%
distribute-neg-frac290.8%
remove-double-neg90.8%
sqr-neg90.8%
associate-+l+90.8%
sqr-neg90.8%
distribute-rgt-out90.8%
Simplified90.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -2.9e5 < m < 3.99999999999999982e-6Initial program 94.8%
associate-/l*94.8%
remove-double-neg94.8%
distribute-frac-neg294.8%
distribute-neg-frac294.8%
remove-double-neg94.8%
sqr-neg94.8%
associate-+l+94.8%
sqr-neg94.8%
distribute-rgt-out94.8%
Simplified94.8%
Taylor expanded in m around 0 93.9%
Final simplification97.8%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (/ a_m (+ (* k (+ k 10.0)) 1.0))))
(*
a_s
(if (<= m -8.6e+189)
t_0
(if (<= m -1.2e+28)
(/ (- (/ (- (* 0.001 (/ a_m k)) (* a_m 0.01)) k) (* a_m -0.1)) k)
(if (<= m 2.4)
t_0
(if (<= m 1.05e+244)
(* a_m (+ (* k (* k 99.0)) 1.0))
(* -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 t_0 = a_m / ((k * (k + 10.0)) + 1.0);
double tmp;
if (m <= -8.6e+189) {
tmp = t_0;
} else if (m <= -1.2e+28) {
tmp = ((((0.001 * (a_m / k)) - (a_m * 0.01)) / k) - (a_m * -0.1)) / k;
} else if (m <= 2.4) {
tmp = t_0;
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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) :: t_0
real(8) :: tmp
t_0 = a_m / ((k * (k + 10.0d0)) + 1.0d0)
if (m <= (-8.6d+189)) then
tmp = t_0
else if (m <= (-1.2d+28)) then
tmp = ((((0.001d0 * (a_m / k)) - (a_m * 0.01d0)) / k) - (a_m * (-0.1d0))) / k
else if (m <= 2.4d0) then
tmp = t_0
else if (m <= 1.05d+244) then
tmp = a_m * ((k * (k * 99.0d0)) + 1.0d0)
else
tmp = (-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 t_0 = a_m / ((k * (k + 10.0)) + 1.0);
double tmp;
if (m <= -8.6e+189) {
tmp = t_0;
} else if (m <= -1.2e+28) {
tmp = ((((0.001 * (a_m / k)) - (a_m * 0.01)) / k) - (a_m * -0.1)) / k;
} else if (m <= 2.4) {
tmp = t_0;
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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): t_0 = a_m / ((k * (k + 10.0)) + 1.0) tmp = 0 if m <= -8.6e+189: tmp = t_0 elif m <= -1.2e+28: tmp = ((((0.001 * (a_m / k)) - (a_m * 0.01)) / k) - (a_m * -0.1)) / k elif m <= 2.4: tmp = t_0 elif m <= 1.05e+244: tmp = a_m * ((k * (k * 99.0)) + 1.0) else: tmp = -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) t_0 = Float64(a_m / Float64(Float64(k * Float64(k + 10.0)) + 1.0)) tmp = 0.0 if (m <= -8.6e+189) tmp = t_0; elseif (m <= -1.2e+28) tmp = Float64(Float64(Float64(Float64(Float64(0.001 * Float64(a_m / k)) - Float64(a_m * 0.01)) / k) - Float64(a_m * -0.1)) / k); elseif (m <= 2.4) tmp = t_0; elseif (m <= 1.05e+244) tmp = Float64(a_m * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); else tmp = 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) t_0 = a_m / ((k * (k + 10.0)) + 1.0); tmp = 0.0; if (m <= -8.6e+189) tmp = t_0; elseif (m <= -1.2e+28) tmp = ((((0.001 * (a_m / k)) - (a_m * 0.01)) / k) - (a_m * -0.1)) / k; elseif (m <= 2.4) tmp = t_0; elseif (m <= 1.05e+244) tmp = a_m * ((k * (k * 99.0)) + 1.0); else tmp = -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_] := Block[{t$95$0 = N[(a$95$m / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -8.6e+189], t$95$0, If[LessEqual[m, -1.2e+28], N[(N[(N[(N[(N[(0.001 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision] - N[(a$95$m * 0.01), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] - N[(a$95$m * -0.1), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 2.4], t$95$0, If[LessEqual[m, 1.05e+244], N[(a$95$m * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
a\_m = \left|a\right|
\\
a\_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := \frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -8.6 \cdot 10^{+189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -1.2 \cdot 10^{+28}:\\
\;\;\;\;\frac{\frac{0.001 \cdot \frac{a\_m}{k} - a\_m \cdot 0.01}{k} - a\_m \cdot -0.1}{k}\\
\mathbf{elif}\;m \leq 2.4:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.05 \cdot 10^{+244}:\\
\;\;\;\;a\_m \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
\end{array}
if m < -8.59999999999999995e189 or -1.19999999999999991e28 < m < 2.39999999999999991Initial program 96.3%
associate-/l*96.2%
remove-double-neg96.2%
distribute-frac-neg296.2%
distribute-neg-frac296.2%
remove-double-neg96.2%
sqr-neg96.2%
associate-+l+96.2%
sqr-neg96.2%
distribute-rgt-out96.3%
Simplified96.3%
Taylor expanded in m around 0 79.2%
if -8.59999999999999995e189 < m < -1.19999999999999991e28Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 20.5%
Taylor expanded in k around 0 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in k around -inf 42.6%
if 2.39999999999999991 < m < 1.05e244Initial program 77.6%
associate-/l*77.6%
remove-double-neg77.6%
distribute-frac-neg277.6%
distribute-neg-frac277.6%
remove-double-neg77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.5%
Taylor expanded in k around inf 32.5%
*-commutative32.5%
Simplified32.5%
if 1.05e244 < m Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 4.1%
Taylor expanded in k around 0 4.3%
Taylor expanded in k around inf 35.9%
Final simplification57.8%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 2.4)
(/ a_m (+ (* k (+ k 10.0)) 1.0))
(if (<= m 1.05e+244)
(* a_m (+ (* k (* k 99.0)) 1.0))
(* -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 <= 2.4) {
tmp = a_m / ((k * (k + 10.0)) + 1.0);
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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 <= 2.4d0) then
tmp = a_m / ((k * (k + 10.0d0)) + 1.0d0)
else if (m <= 1.05d+244) then
tmp = a_m * ((k * (k * 99.0d0)) + 1.0d0)
else
tmp = (-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 <= 2.4) {
tmp = a_m / ((k * (k + 10.0)) + 1.0);
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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 <= 2.4: tmp = a_m / ((k * (k + 10.0)) + 1.0) elif m <= 1.05e+244: tmp = a_m * ((k * (k * 99.0)) + 1.0) else: tmp = -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 <= 2.4) tmp = Float64(a_m / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); elseif (m <= 1.05e+244) tmp = Float64(a_m * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); else tmp = 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 <= 2.4) tmp = a_m / ((k * (k + 10.0)) + 1.0); elseif (m <= 1.05e+244) tmp = a_m * ((k * (k * 99.0)) + 1.0); else tmp = -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, 2.4], N[(a$95$m / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.05e+244], N[(a$95$m * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * 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}\;m \leq 2.4:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{elif}\;m \leq 1.05 \cdot 10^{+244}:\\
\;\;\;\;a\_m \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 97.1%
associate-/l*97.1%
remove-double-neg97.1%
distribute-frac-neg297.1%
distribute-neg-frac297.1%
remove-double-neg97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 65.5%
if 2.39999999999999991 < m < 1.05e244Initial program 77.6%
associate-/l*77.6%
remove-double-neg77.6%
distribute-frac-neg277.6%
distribute-neg-frac277.6%
remove-double-neg77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.5%
Taylor expanded in k around inf 32.5%
*-commutative32.5%
Simplified32.5%
if 1.05e244 < m Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 4.1%
Taylor expanded in k around 0 4.3%
Taylor expanded in k around inf 35.9%
Final simplification54.4%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 2.2)
(/ a_m (+ (* k 10.0) 1.0))
(if (<= m 1.05e+244)
(* a_m (+ (* k (* k 99.0)) 1.0))
(* -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 <= 2.2) {
tmp = a_m / ((k * 10.0) + 1.0);
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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 <= 2.2d0) then
tmp = a_m / ((k * 10.0d0) + 1.0d0)
else if (m <= 1.05d+244) then
tmp = a_m * ((k * (k * 99.0d0)) + 1.0d0)
else
tmp = (-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 <= 2.2) {
tmp = a_m / ((k * 10.0) + 1.0);
} else if (m <= 1.05e+244) {
tmp = a_m * ((k * (k * 99.0)) + 1.0);
} else {
tmp = -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 <= 2.2: tmp = a_m / ((k * 10.0) + 1.0) elif m <= 1.05e+244: tmp = a_m * ((k * (k * 99.0)) + 1.0) else: tmp = -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 <= 2.2) tmp = Float64(a_m / Float64(Float64(k * 10.0) + 1.0)); elseif (m <= 1.05e+244) tmp = Float64(a_m * Float64(Float64(k * Float64(k * 99.0)) + 1.0)); else tmp = 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 <= 2.2) tmp = a_m / ((k * 10.0) + 1.0); elseif (m <= 1.05e+244) tmp = a_m * ((k * (k * 99.0)) + 1.0); else tmp = -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, 2.2], N[(a$95$m / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.05e+244], N[(a$95$m * N[(N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * 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}\;m \leq 2.2:\\
\;\;\;\;\frac{a\_m}{k \cdot 10 + 1}\\
\mathbf{elif}\;m \leq 1.05 \cdot 10^{+244}:\\
\;\;\;\;a\_m \cdot \left(k \cdot \left(k \cdot 99\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 97.1%
associate-/l*97.1%
remove-double-neg97.1%
distribute-frac-neg297.1%
distribute-neg-frac297.1%
remove-double-neg97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 65.5%
Taylor expanded in k around 0 38.9%
*-commutative38.9%
Simplified38.9%
if 2.2000000000000002 < m < 1.05e244Initial program 77.6%
associate-/l*77.6%
remove-double-neg77.6%
distribute-frac-neg277.6%
distribute-neg-frac277.6%
remove-double-neg77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.5%
Taylor expanded in k around inf 32.5%
*-commutative32.5%
Simplified32.5%
if 1.05e244 < m Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 4.1%
Taylor expanded in k around 0 4.3%
Taylor expanded in k around inf 35.9%
Final simplification37.0%
a\_m = (fabs.f64 a)
a\_s = (copysign.f64 #s(literal 1 binary64) a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -2.95e-24)
(* a_m (/ 0.1 k))
(if (<= m 62000000000000.0) 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 <= -2.95e-24) {
tmp = a_m * (0.1 / k);
} else if (m <= 62000000000000.0) {
tmp = a_m;
} else {
tmp = -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 <= (-2.95d-24)) then
tmp = a_m * (0.1d0 / k)
else if (m <= 62000000000000.0d0) then
tmp = a_m
else
tmp = (-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 <= -2.95e-24) {
tmp = a_m * (0.1 / k);
} else if (m <= 62000000000000.0) {
tmp = a_m;
} else {
tmp = -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 <= -2.95e-24: tmp = a_m * (0.1 / k) elif m <= 62000000000000.0: tmp = a_m else: tmp = -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 <= -2.95e-24) tmp = Float64(a_m * Float64(0.1 / k)); elseif (m <= 62000000000000.0) tmp = a_m; else tmp = 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 <= -2.95e-24) tmp = a_m * (0.1 / k); elseif (m <= 62000000000000.0) tmp = a_m; else tmp = -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, -2.95e-24], N[(a$95$m * N[(0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 62000000000000.0], a$95$m, N[(-10.0 * 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}\;m \leq -2.95 \cdot 10^{-24}:\\
\;\;\;\;a\_m \cdot \frac{0.1}{k}\\
\mathbf{elif}\;m \leq 62000000000000:\\
\;\;\;\;a\_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < -2.9500000000000001e-24Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 32.2%
Taylor expanded in k around 0 13.2%
*-commutative13.2%
Simplified13.2%
Taylor expanded in k around inf 18.1%
associate-*r/18.1%
*-commutative18.1%
associate-/l*18.1%
Simplified18.1%
if -2.9500000000000001e-24 < m < 6.2e13Initial program 93.9%
associate-/l*93.9%
remove-double-neg93.9%
distribute-frac-neg293.9%
distribute-neg-frac293.9%
remove-double-neg93.9%
sqr-neg93.9%
associate-+l+93.9%
sqr-neg93.9%
distribute-rgt-out93.9%
Simplified93.9%
Taylor expanded in m around 0 89.0%
Taylor expanded in k around 0 46.4%
if 6.2e13 < m Initial program 83.1%
associate-/l*83.1%
remove-double-neg83.1%
distribute-frac-neg283.1%
distribute-neg-frac283.1%
remove-double-neg83.1%
sqr-neg83.1%
associate-+l+83.1%
sqr-neg83.1%
distribute-rgt-out83.1%
Simplified83.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 5.7%
Taylor expanded in k around inf 22.7%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m 62000000000000.0) (/ a_m (+ (* k 10.0) 1.0)) (* -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 <= 62000000000000.0) {
tmp = a_m / ((k * 10.0) + 1.0);
} else {
tmp = -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 <= 62000000000000.0d0) then
tmp = a_m / ((k * 10.0d0) + 1.0d0)
else
tmp = (-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 <= 62000000000000.0) {
tmp = a_m / ((k * 10.0) + 1.0);
} else {
tmp = -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 <= 62000000000000.0: tmp = a_m / ((k * 10.0) + 1.0) else: tmp = -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 <= 62000000000000.0) tmp = Float64(a_m / Float64(Float64(k * 10.0) + 1.0)); else tmp = 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 <= 62000000000000.0) tmp = a_m / ((k * 10.0) + 1.0); else tmp = -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, 62000000000000.0], N[(a$95$m / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * 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}\;m \leq 62000000000000:\\
\;\;\;\;\frac{a\_m}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 6.2e13Initial program 96.6%
associate-/l*96.6%
remove-double-neg96.6%
distribute-frac-neg296.6%
distribute-neg-frac296.6%
remove-double-neg96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
Taylor expanded in m around 0 63.7%
Taylor expanded in k around 0 37.9%
*-commutative37.9%
Simplified37.9%
if 6.2e13 < m Initial program 83.1%
associate-/l*83.1%
remove-double-neg83.1%
distribute-frac-neg283.1%
distribute-neg-frac283.1%
remove-double-neg83.1%
sqr-neg83.1%
associate-+l+83.1%
sqr-neg83.1%
distribute-rgt-out83.1%
Simplified83.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 5.7%
Taylor expanded in k around inf 22.7%
Final simplification33.0%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m 25000000000000.0) 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 <= 25000000000000.0) {
tmp = a_m;
} else {
tmp = -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 <= 25000000000000.0d0) then
tmp = a_m
else
tmp = (-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 <= 25000000000000.0) {
tmp = a_m;
} else {
tmp = -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 <= 25000000000000.0: tmp = a_m else: tmp = -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 <= 25000000000000.0) tmp = a_m; else tmp = 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 <= 25000000000000.0) tmp = a_m; else tmp = -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, 25000000000000.0], a$95$m, N[(-10.0 * 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}\;m \leq 25000000000000:\\
\;\;\;\;a\_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < 2.5e13Initial program 96.6%
associate-/l*96.6%
remove-double-neg96.6%
distribute-frac-neg296.6%
distribute-neg-frac296.6%
remove-double-neg96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
Taylor expanded in m around 0 63.7%
Taylor expanded in k around 0 27.4%
if 2.5e13 < m Initial program 83.1%
associate-/l*83.1%
remove-double-neg83.1%
distribute-frac-neg283.1%
distribute-neg-frac283.1%
remove-double-neg83.1%
sqr-neg83.1%
associate-+l+83.1%
sqr-neg83.1%
distribute-rgt-out83.1%
Simplified83.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 5.7%
Taylor expanded in k around inf 22.7%
a\_m = (fabs.f64 a) a\_s = (copysign.f64 #s(literal 1 binary64) 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 92.3%
associate-/l*92.2%
remove-double-neg92.2%
distribute-frac-neg292.2%
distribute-neg-frac292.2%
remove-double-neg92.2%
sqr-neg92.2%
associate-+l+92.2%
sqr-neg92.2%
distribute-rgt-out92.3%
Simplified92.3%
Taylor expanded in m around 0 44.1%
Taylor expanded in k around 0 19.7%
herbie shell --seed 2024089
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))