
(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 13 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
(let* ((t_0 (* (pow k m) a_m)))
(*
a_s
(if (<= (/ t_0 (+ (+ (* k 10.0) 1.0) (* k k))) 1e+205)
(* (/ (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 = pow(k, m) * a_m;
double tmp;
if ((t_0 / (((k * 10.0) + 1.0) + (k * k))) <= 1e+205) {
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 = Math.pow(k, m) * a_m;
double tmp;
if ((t_0 / (((k * 10.0) + 1.0) + (k * k))) <= 1e+205) {
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 = math.pow(k, m) * a_m tmp = 0 if (t_0 / (((k * 10.0) + 1.0) + (k * k))) <= 1e+205: 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((k ^ m) * a_m) tmp = 0.0 if (Float64(t_0 / Float64(Float64(Float64(k * 10.0) + 1.0) + Float64(k * k))) <= 1e+205) 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 = (k ^ m) * a_m; tmp = 0.0; if ((t_0 / (((k * 10.0) + 1.0) + (k * k))) <= 1e+205) 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[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[N[(t$95$0 / N[(N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+205], 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 := {k}^{m} \cdot a\_m\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_0}{\left(k \cdot 10 + 1\right) + k \cdot k} \leq 10^{+205}:\\
\;\;\;\;\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 1 (*.f64 10 k)) (*.f64 k k))) < 1.00000000000000002e205Initial program 96.8%
Taylor expanded in k around 0 95.0%
*-commutative95.0%
add-sqr-sqrt95.0%
times-frac94.0%
hypot-1-def94.0%
hypot-1-def97.2%
Applied egg-rr97.2%
if 1.00000000000000002e205 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 69.8%
associate-/l*69.8%
remove-double-neg69.8%
distribute-frac-neg269.8%
distribute-neg-frac269.8%
remove-double-neg69.8%
sqr-neg69.8%
associate-+l+69.8%
sqr-neg69.8%
distribute-rgt-out69.8%
Simplified69.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.7%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (/ (* (/ (pow k m) (hypot 1.0 k)) a_m) (hypot 1.0 k))))
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 * (((pow(k, m) / hypot(1.0, k)) * a_m) / hypot(1.0, k));
}
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 * (((Math.pow(k, m) / Math.hypot(1.0, k)) * a_m) / Math.hypot(1.0, k));
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): return a_s * (((math.pow(k, m) / math.hypot(1.0, k)) * a_m) / math.hypot(1.0, k))
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) return Float64(a_s * Float64(Float64(Float64((k ^ m) / hypot(1.0, k)) * a_m) / hypot(1.0, k))) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp = code(a_s, a_m, k, m) tmp = a_s * ((((k ^ m) / hypot(1.0, k)) * a_m) / hypot(1.0, k)); 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 * N[(N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * a$95$m), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \frac{\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot a\_m}{\mathsf{hypot}\left(1, k\right)}
\end{array}
Initial program 91.2%
Taylor expanded in k around 0 89.8%
*-commutative89.8%
add-sqr-sqrt89.8%
times-frac88.6%
hypot-1-def88.6%
hypot-1-def95.4%
Applied egg-rr95.4%
frac-2neg95.4%
associate-*r/98.5%
Applied egg-rr98.5%
Final simplification98.5%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* (pow k m) a_m)) (t_1 (/ t_0 (+ (+ (* k 10.0) 1.0) (* k k))))) (* a_s (if (<= t_1 4e+303) t_1 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 = pow(k, m) * a_m;
double t_1 = t_0 / (((k * 10.0) + 1.0) + (k * k));
double tmp;
if (t_1 <= 4e+303) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = (k ** m) * a_m
t_1 = t_0 / (((k * 10.0d0) + 1.0d0) + (k * k))
if (t_1 <= 4d+303) then
tmp = t_1
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 = Math.pow(k, m) * a_m;
double t_1 = t_0 / (((k * 10.0) + 1.0) + (k * k));
double tmp;
if (t_1 <= 4e+303) {
tmp = t_1;
} 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 = math.pow(k, m) * a_m t_1 = t_0 / (((k * 10.0) + 1.0) + (k * k)) tmp = 0 if t_1 <= 4e+303: tmp = t_1 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((k ^ m) * a_m) t_1 = Float64(t_0 / Float64(Float64(Float64(k * 10.0) + 1.0) + Float64(k * k))) tmp = 0.0 if (t_1 <= 4e+303) tmp = t_1; 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 = (k ^ m) * a_m; t_1 = t_0 / (((k * 10.0) + 1.0) + (k * k)); tmp = 0.0; if (t_1 <= 4e+303) tmp = t_1; 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[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 4e+303], t$95$1, 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 := {k}^{m} \cdot a\_m\\
t_1 := \frac{t\_0}{\left(k \cdot 10 + 1\right) + k \cdot k}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 4e303Initial program 96.8%
if 4e303 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 68.0%
associate-/l*68.0%
remove-double-neg68.0%
distribute-frac-neg268.0%
distribute-neg-frac268.0%
remove-double-neg68.0%
sqr-neg68.0%
associate-+l+68.0%
sqr-neg68.0%
distribute-rgt-out68.0%
Simplified68.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.4%
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.5)
(* a_m (/ (pow k m) (+ (* k (+ k 10.0)) 1.0)))
(* (pow k 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 (m <= 3.5) {
tmp = a_m * (pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = pow(k, m) * 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 <= 3.5d0) then
tmp = a_m * ((k ** m) / ((k * (k + 10.0d0)) + 1.0d0))
else
tmp = (k ** m) * 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 <= 3.5) {
tmp = a_m * (Math.pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = Math.pow(k, m) * 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 <= 3.5: tmp = a_m * (math.pow(k, m) / ((k * (k + 10.0)) + 1.0)) else: tmp = math.pow(k, m) * 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 <= 3.5) tmp = Float64(a_m * Float64((k ^ m) / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); else tmp = Float64((k ^ m) * 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 <= 3.5) tmp = a_m * ((k ^ m) / ((k * (k + 10.0)) + 1.0)); else tmp = (k ^ m) * 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, 3.5], N[(a$95$m * N[(N[Power[k, m], $MachinePrecision] / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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:\\
\;\;\;\;a\_m \cdot \frac{{k}^{m}}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\_m\\
\end{array}
\end{array}
if m < 3.5Initial program 96.3%
associate-/l*96.3%
remove-double-neg96.3%
distribute-frac-neg296.3%
distribute-neg-frac296.3%
remove-double-neg96.3%
sqr-neg96.3%
associate-+l+96.3%
sqr-neg96.3%
distribute-rgt-out96.3%
Simplified96.3%
if 3.5 < m 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%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.4%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* (pow k m) a_m)))
(*
a_s
(if (<= m -1.9e-6)
(/ t_0 (+ (* k 10.0) 1.0))
(if (<= m 1.26e-11) (/ a_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 = pow(k, m) * a_m;
double tmp;
if (m <= -1.9e-6) {
tmp = t_0 / ((k * 10.0) + 1.0);
} else if (m <= 1.26e-11) {
tmp = a_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 = (k ** m) * a_m
if (m <= (-1.9d-6)) then
tmp = t_0 / ((k * 10.0d0) + 1.0d0)
else if (m <= 1.26d-11) then
tmp = a_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 = Math.pow(k, m) * a_m;
double tmp;
if (m <= -1.9e-6) {
tmp = t_0 / ((k * 10.0) + 1.0);
} else if (m <= 1.26e-11) {
tmp = a_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 = math.pow(k, m) * a_m tmp = 0 if m <= -1.9e-6: tmp = t_0 / ((k * 10.0) + 1.0) elif m <= 1.26e-11: tmp = a_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((k ^ m) * a_m) tmp = 0.0 if (m <= -1.9e-6) tmp = Float64(t_0 / Float64(Float64(k * 10.0) + 1.0)); elseif (m <= 1.26e-11) tmp = Float64(a_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 = (k ^ m) * a_m; tmp = 0.0; if (m <= -1.9e-6) tmp = t_0 / ((k * 10.0) + 1.0); elseif (m <= 1.26e-11) tmp = a_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[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -1.9e-6], N[(t$95$0 / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.26e-11], N[(a$95$m / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $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 := {k}^{m} \cdot a\_m\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.9 \cdot 10^{-6}:\\
\;\;\;\;\frac{t\_0}{k \cdot 10 + 1}\\
\mathbf{elif}\;m \leq 1.26 \cdot 10^{-11}:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if m < -1.9e-6Initial program 100.0%
Taylor expanded in k around 0 100.0%
if -1.9e-6 < m < 1.26e-11Initial program 92.9%
associate-/l*92.9%
remove-double-neg92.9%
distribute-frac-neg292.9%
distribute-neg-frac292.9%
remove-double-neg92.9%
sqr-neg92.9%
associate-+l+92.9%
sqr-neg92.9%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 92.5%
if 1.26e-11 < m Initial program 80.2%
associate-/l*80.2%
remove-double-neg80.2%
distribute-frac-neg280.2%
distribute-neg-frac280.2%
remove-double-neg80.2%
sqr-neg80.2%
associate-+l+80.2%
sqr-neg80.2%
distribute-rgt-out80.2%
Simplified80.2%
Taylor expanded in k around 0 98.8%
*-commutative98.8%
Simplified98.8%
Final simplification96.9%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (* (pow k m) a_m))) (* a_s (if (<= m 3.4) (/ 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 = pow(k, m) * a_m;
double tmp;
if (m <= 3.4) {
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 = (k ** m) * a_m
if (m <= 3.4d0) 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 = Math.pow(k, m) * a_m;
double tmp;
if (m <= 3.4) {
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 = math.pow(k, m) * a_m tmp = 0 if m <= 3.4: 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((k ^ m) * a_m) tmp = 0.0 if (m <= 3.4) 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 = (k ^ m) * a_m; tmp = 0.0; if (m <= 3.4) 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[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, 3.4], 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 := {k}^{m} \cdot a\_m\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 3.4:\\
\;\;\;\;\frac{t\_0}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if m < 3.39999999999999991Initial program 96.3%
Taylor expanded in k around 0 94.2%
if 3.39999999999999991 < m 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%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification96.0%
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 -7.5e-11) (not (<= m 1.35e-11)))
(* (pow k m) a_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 <= -7.5e-11) || !(m <= 1.35e-11)) {
tmp = pow(k, m) * a_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 <= (-7.5d-11)) .or. (.not. (m <= 1.35d-11))) then
tmp = (k ** m) * a_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 <= -7.5e-11) || !(m <= 1.35e-11)) {
tmp = Math.pow(k, m) * a_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 <= -7.5e-11) or not (m <= 1.35e-11): tmp = math.pow(k, m) * a_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 <= -7.5e-11) || !(m <= 1.35e-11)) tmp = Float64((k ^ m) * a_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 <= -7.5e-11) || ~((m <= 1.35e-11))) tmp = (k ^ m) * a_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, -7.5e-11], N[Not[LessEqual[m, 1.35e-11]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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 -7.5 \cdot 10^{-11} \lor \neg \left(m \leq 1.35 \cdot 10^{-11}\right):\\
\;\;\;\;{k}^{m} \cdot a\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
\end{array}
\end{array}
if m < -7.5e-11 or 1.35000000000000002e-11 < m Initial program 90.2%
associate-/l*90.2%
remove-double-neg90.2%
distribute-frac-neg290.2%
distribute-neg-frac290.2%
remove-double-neg90.2%
sqr-neg90.2%
associate-+l+90.2%
sqr-neg90.2%
distribute-rgt-out90.2%
Simplified90.2%
Taylor expanded in k around 0 99.2%
*-commutative99.2%
Simplified99.2%
if -7.5e-11 < m < 1.35000000000000002e-11Initial program 92.9%
associate-/l*92.9%
remove-double-neg92.9%
distribute-frac-neg292.9%
distribute-neg-frac292.9%
remove-double-neg92.9%
sqr-neg92.9%
associate-+l+92.9%
sqr-neg92.9%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 92.5%
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 -0.06)
(* a_m (/ 0.1 k))
(if (<= m 0.195) (/ a_m (+ (* k 10.0) 1.0)) (* -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 (m <= -0.06) {
tmp = a_m * (0.1 / k);
} else if (m <= 0.195) {
tmp = a_m / ((k * 10.0) + 1.0);
} else {
tmp = -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 (m <= (-0.06d0)) then
tmp = a_m * (0.1d0 / k)
else if (m <= 0.195d0) then
tmp = a_m / ((k * 10.0d0) + 1.0d0)
else
tmp = (-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 (m <= -0.06) {
tmp = a_m * (0.1 / k);
} else if (m <= 0.195) {
tmp = a_m / ((k * 10.0) + 1.0);
} else {
tmp = -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 m <= -0.06: tmp = a_m * (0.1 / k) elif m <= 0.195: tmp = a_m / ((k * 10.0) + 1.0) else: tmp = -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 (m <= -0.06) tmp = Float64(a_m * Float64(0.1 / k)); elseif (m <= 0.195) tmp = Float64(a_m / Float64(Float64(k * 10.0) + 1.0)); else tmp = Float64(-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 (m <= -0.06) tmp = a_m * (0.1 / k); elseif (m <= 0.195) tmp = a_m / ((k * 10.0) + 1.0); else tmp = -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[m, -0.06], N[(a$95$m * N[(0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.195], N[(a$95$m / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a$95$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 -0.06:\\
\;\;\;\;a\_m \cdot \frac{0.1}{k}\\
\mathbf{elif}\;m \leq 0.195:\\
\;\;\;\;\frac{a\_m}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\_m\right)\\
\end{array}
\end{array}
if m < -0.059999999999999998Initial 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 36.2%
Taylor expanded in k around 0 19.3%
*-commutative19.3%
Simplified19.3%
Taylor expanded in k around inf 29.4%
*-commutative29.4%
Simplified29.4%
Taylor expanded in a around 0 29.4%
associate-*r/29.4%
*-commutative29.4%
associate-/l*29.4%
Simplified29.4%
if -0.059999999999999998 < m < 0.19500000000000001Initial program 93.1%
associate-/l*93.1%
remove-double-neg93.1%
distribute-frac-neg293.1%
distribute-neg-frac293.1%
remove-double-neg93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 90.7%
Taylor expanded in k around 0 68.5%
*-commutative68.5%
Simplified68.5%
if 0.19500000000000001 < m 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%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in k around inf 20.9%
Final simplification41.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 -0.052)
(* a_m (/ 0.1 k))
(if (<= m 0.19) a_m (* -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 (m <= -0.052) {
tmp = a_m * (0.1 / k);
} else if (m <= 0.19) {
tmp = a_m;
} else {
tmp = -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 (m <= (-0.052d0)) then
tmp = a_m * (0.1d0 / k)
else if (m <= 0.19d0) then
tmp = a_m
else
tmp = (-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 (m <= -0.052) {
tmp = a_m * (0.1 / k);
} else if (m <= 0.19) {
tmp = a_m;
} else {
tmp = -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 m <= -0.052: tmp = a_m * (0.1 / k) elif m <= 0.19: tmp = a_m else: tmp = -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 (m <= -0.052) tmp = Float64(a_m * Float64(0.1 / k)); elseif (m <= 0.19) tmp = a_m; else tmp = Float64(-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 (m <= -0.052) tmp = a_m * (0.1 / k); elseif (m <= 0.19) tmp = a_m; else tmp = -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[m, -0.052], N[(a$95$m * N[(0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.19], a$95$m, N[(-10.0 * N[(k * a$95$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 -0.052:\\
\;\;\;\;a\_m \cdot \frac{0.1}{k}\\
\mathbf{elif}\;m \leq 0.19:\\
\;\;\;\;a\_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\_m\right)\\
\end{array}
\end{array}
if m < -0.0519999999999999976Initial 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 36.2%
Taylor expanded in k around 0 19.3%
*-commutative19.3%
Simplified19.3%
Taylor expanded in k around inf 29.4%
*-commutative29.4%
Simplified29.4%
Taylor expanded in a around 0 29.4%
associate-*r/29.4%
*-commutative29.4%
associate-/l*29.4%
Simplified29.4%
if -0.0519999999999999976 < m < 0.19Initial program 93.1%
associate-/l*93.1%
remove-double-neg93.1%
distribute-frac-neg293.1%
distribute-neg-frac293.1%
remove-double-neg93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 90.7%
Taylor expanded in k around 0 55.2%
if 0.19 < m 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%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in k around inf 20.9%
Final simplification36.4%
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.7) (/ a_m (+ (* k (+ k 10.0)) 1.0)) (* -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 (m <= 1.7) {
tmp = a_m / ((k * (k + 10.0)) + 1.0);
} else {
tmp = -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 (m <= 1.7d0) then
tmp = a_m / ((k * (k + 10.0d0)) + 1.0d0)
else
tmp = (-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 (m <= 1.7) {
tmp = a_m / ((k * (k + 10.0)) + 1.0);
} else {
tmp = -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 m <= 1.7: tmp = a_m / ((k * (k + 10.0)) + 1.0) else: tmp = -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 (m <= 1.7) tmp = Float64(a_m / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); else tmp = Float64(-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 (m <= 1.7) tmp = a_m / ((k * (k + 10.0)) + 1.0); else tmp = -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[m, 1.7], N[(a$95$m / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a$95$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.7:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\_m\right)\\
\end{array}
\end{array}
if m < 1.69999999999999996Initial program 96.3%
associate-/l*96.3%
remove-double-neg96.3%
distribute-frac-neg296.3%
distribute-neg-frac296.3%
remove-double-neg96.3%
sqr-neg96.3%
associate-+l+96.3%
sqr-neg96.3%
distribute-rgt-out96.3%
Simplified96.3%
Taylor expanded in m around 0 65.5%
if 1.69999999999999996 < m 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%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in k around inf 20.9%
Final simplification51.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 1.35) (/ a_m (+ (* k k) 1.0)) (* -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 (m <= 1.35) {
tmp = a_m / ((k * k) + 1.0);
} else {
tmp = -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 (m <= 1.35d0) then
tmp = a_m / ((k * k) + 1.0d0)
else
tmp = (-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 (m <= 1.35) {
tmp = a_m / ((k * k) + 1.0);
} else {
tmp = -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 m <= 1.35: tmp = a_m / ((k * k) + 1.0) else: tmp = -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 (m <= 1.35) tmp = Float64(a_m / Float64(Float64(k * k) + 1.0)); else tmp = Float64(-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 (m <= 1.35) tmp = a_m / ((k * k) + 1.0); else tmp = -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[m, 1.35], N[(a$95$m / N[(N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a$95$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.35:\\
\;\;\;\;\frac{a\_m}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\_m\right)\\
\end{array}
\end{array}
if m < 1.3500000000000001Initial program 96.3%
Taylor expanded in k around 0 94.2%
Taylor expanded in m around 0 63.6%
if 1.3500000000000001 < m 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%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in k around inf 20.9%
Final simplification50.4%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m 0.18) a_m (* -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 (m <= 0.18) {
tmp = a_m;
} else {
tmp = -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 (m <= 0.18d0) then
tmp = a_m
else
tmp = (-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 (m <= 0.18) {
tmp = a_m;
} else {
tmp = -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 m <= 0.18: tmp = a_m else: tmp = -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 (m <= 0.18) tmp = a_m; else tmp = Float64(-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 (m <= 0.18) tmp = a_m; else tmp = -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[m, 0.18], a$95$m, N[(-10.0 * N[(k * a$95$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 0.18:\\
\;\;\;\;a\_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\_m\right)\\
\end{array}
\end{array}
if m < 0.17999999999999999Initial program 96.3%
associate-/l*96.3%
remove-double-neg96.3%
distribute-frac-neg296.3%
distribute-neg-frac296.3%
remove-double-neg96.3%
sqr-neg96.3%
associate-+l+96.3%
sqr-neg96.3%
distribute-rgt-out96.3%
Simplified96.3%
Taylor expanded in m around 0 65.5%
Taylor expanded in k around 0 31.5%
if 0.17999999999999999 < m 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%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 4.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in k around inf 20.9%
Final simplification28.2%
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 91.2%
associate-/l*91.2%
remove-double-neg91.2%
distribute-frac-neg291.2%
distribute-neg-frac291.2%
remove-double-neg91.2%
sqr-neg91.2%
associate-+l+91.2%
sqr-neg91.2%
distribute-rgt-out91.2%
Simplified91.2%
Taylor expanded in m around 0 46.2%
Taylor expanded in k around 0 22.9%
Final simplification22.9%
herbie shell --seed 2024043
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))