
(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 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* a_m (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k)))))
(*
a_s
(if (<= t_1 0.0)
(* (/ (pow k m) k) (/ a_m (+ k 10.0)))
(if (<= t_1 1e+255)
(* (pow k m) (/ a_m (+ 1.0 (* k (+ k 10.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 t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 0.0) {
tmp = (pow(k, m) / k) * (a_m / (k + 10.0));
} else if (t_1 <= 1e+255) {
tmp = pow(k, m) * (a_m / (1.0 + (k * (k + 10.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) :: t_1
real(8) :: tmp
t_0 = a_m * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 0.0d0) then
tmp = ((k ** m) / k) * (a_m / (k + 10.0d0))
else if (t_1 <= 1d+255) then
tmp = (k ** m) * (a_m / (1.0d0 + (k * (k + 10.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 t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.pow(k, m) / k) * (a_m / (k + 10.0));
} else if (t_1 <= 1e+255) {
tmp = Math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.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) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 0.0: tmp = (math.pow(k, m) / k) * (a_m / (k + 10.0)) elif t_1 <= 1e+255: tmp = math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.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)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64((k ^ m) / k) * Float64(a_m / Float64(k + 10.0))); elseif (t_1 <= 1e+255) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.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); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 0.0) tmp = ((k ^ m) / k) * (a_m / (k + 10.0)); elseif (t_1 <= 1e+255) tmp = (k ^ m) * (a_m / (1.0 + (k * (k + 10.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]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 0.0], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a$95$m / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+255], N[(N[Power[k, m], $MachinePrecision] * N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $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}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a_m}{k + 10}\\
\mathbf{elif}\;t_1 \leq 10^{+255}:\\
\;\;\;\;{k}^{m} \cdot \frac{a_m}{1 + k \cdot \left(k + 10\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))) < 0.0Initial program 97.5%
associate-*l/96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
*-commutative96.5%
clear-num96.4%
un-div-inv96.4%
+-commutative96.4%
fma-def96.4%
+-commutative96.4%
Applied egg-rr96.4%
Taylor expanded in k around inf 72.9%
+-commutative72.9%
unpow272.9%
distribute-rgt-in72.9%
Simplified72.9%
associate-/l*75.3%
associate-/r/82.3%
Applied egg-rr82.3%
if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 9.99999999999999988e254Initial program 99.8%
associate-*l/99.8%
sqr-neg99.8%
associate-+l+99.8%
sqr-neg99.8%
distribute-rgt-out99.8%
Simplified99.8%
if 9.99999999999999988e254 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 66.7%
associate-*l/62.2%
sqr-neg62.2%
associate-+l+62.2%
sqr-neg62.2%
distribute-rgt-out62.2%
Simplified62.2%
Taylor expanded in k around 0 100.0%
Final simplification87.0%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (let* ((t_0 (cbrt (* a_m (pow k m))))) (* a_s (* (/ (pow t_0 2.0) (hypot 1.0 k)) (/ t_0 (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) {
double t_0 = cbrt((a_m * pow(k, m)));
return a_s * ((pow(t_0, 2.0) / hypot(1.0, k)) * (t_0 / 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) {
double t_0 = Math.cbrt((a_m * Math.pow(k, m)));
return a_s * ((Math.pow(t_0, 2.0) / Math.hypot(1.0, k)) * (t_0 / Math.hypot(1.0, k)));
}
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = cbrt(Float64(a_m * (k ^ m))) return Float64(a_s * Float64(Float64((t_0 ^ 2.0) / hypot(1.0, k)) * Float64(t_0 / 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_] := Block[{t$95$0 = N[Power[N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(a$95$s * N[(N[(N[Power[t$95$0, 2.0], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 / N[Sqrt[1.0 ^ 2 + k ^ 2], $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 := \sqrt[3]{a_m \cdot {k}^{m}}\\
a_s \cdot \left(\frac{{t_0}^{2}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{t_0}{\mathsf{hypot}\left(1, k\right)}\right)
\end{array}
\end{array}
Initial program 92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in k around 0 91.6%
add-cube-cbrt91.2%
add-sqr-sqrt91.2%
times-frac91.2%
pow291.2%
hypot-1-def91.2%
hypot-1-def98.8%
Applied egg-rr98.8%
Final simplification98.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* a_m (pow k m))))
(*
a_s
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 1e+255)
(* (/ (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 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+255) {
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 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+255) {
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 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+255: 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(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 1e+255) 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 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+255) 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[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+255], 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}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 10^{+255}:\\
\;\;\;\;\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))) < 9.99999999999999988e254Initial program 97.8%
*-commutative97.8%
Simplified97.8%
Taylor expanded in k around 0 96.9%
*-commutative96.9%
add-sqr-sqrt96.9%
times-frac95.9%
hypot-1-def95.9%
hypot-1-def98.1%
Applied egg-rr98.1%
if 9.99999999999999988e254 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 66.7%
associate-*l/62.2%
sqr-neg62.2%
associate-+l+62.2%
sqr-neg62.2%
distribute-rgt-out62.2%
Simplified62.2%
Taylor expanded in k around 0 100.0%
Final simplification98.4%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= k 0.1) (* a_m (pow k m)) (* (/ (pow k m) k) (/ a_m (+ k 10.0))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a_m * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (a_m / (k + 10.0));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.1d0) then
tmp = a_m * (k ** m)
else
tmp = ((k ** m) / k) * (a_m / (k + 10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (a_m / (k + 10.0));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if k <= 0.1: tmp = a_m * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (a_m / (k + 10.0)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * Float64(a_m / 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 <= 0.1) tmp = a_m * (k ^ m); else tmp = ((k ^ m) / k) * (a_m / (k + 10.0)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[k, 0.1], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a$95$m / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a_m}{k + 10}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 94.9%
associate-*l/93.2%
sqr-neg93.2%
associate-+l+93.2%
sqr-neg93.2%
distribute-rgt-out93.2%
Simplified93.2%
Taylor expanded in k around 0 99.0%
if 0.10000000000000001 < k Initial program 86.7%
associate-*l/85.4%
sqr-neg85.4%
associate-+l+85.4%
sqr-neg85.4%
distribute-rgt-out85.5%
Simplified85.5%
*-commutative85.5%
clear-num84.2%
un-div-inv84.2%
+-commutative84.2%
fma-def84.2%
+-commutative84.2%
Applied egg-rr84.2%
Taylor expanded in k around inf 84.2%
+-commutative84.2%
unpow284.2%
distribute-rgt-in84.2%
Simplified84.2%
associate-/l*89.9%
associate-/r/94.9%
Applied egg-rr94.9%
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
(if (or (<= m -1.02e-10) (not (<= m 2.5e-16)))
(* 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 <= -1.02e-10) || !(m <= 2.5e-16)) {
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 <= (-1.02d-10)) .or. (.not. (m <= 2.5d-16))) 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 <= -1.02e-10) || !(m <= 2.5e-16)) {
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 <= -1.02e-10) or not (m <= 2.5e-16): 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 <= -1.02e-10) || !(m <= 2.5e-16)) 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 <= -1.02e-10) || ~((m <= 2.5e-16))) 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, -1.02e-10], N[Not[LessEqual[m, 2.5e-16]], $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 -1.02 \cdot 10^{-10} \lor \neg \left(m \leq 2.5 \cdot 10^{-16}\right):\\
\;\;\;\;a_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a_m}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.01999999999999997e-10 or 2.5000000000000002e-16 < m Initial program 90.7%
associate-*l/88.3%
sqr-neg88.3%
associate-+l+88.3%
sqr-neg88.3%
distribute-rgt-out88.3%
Simplified88.3%
Taylor expanded in k around 0 100.0%
if -1.01999999999999997e-10 < m < 2.5000000000000002e-16Initial program 95.0%
associate-*l/95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in m around 0 94.6%
Final simplification98.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (/ a_m (* k (+ k 10.0)))))
(*
a_s
(if (<= k -1.55e+32)
t_0
(if (<= k 3.05e-294)
(* -10.0 (* a_m k))
(if (<= k 0.075) (* a_m (+ 1.0 (* k -10.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 / (k * (k + 10.0));
double tmp;
if (k <= -1.55e+32) {
tmp = t_0;
} else if (k <= 3.05e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.075) {
tmp = a_m * (1.0 + (k * -10.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 * (k + 10.0d0))
if (k <= (-1.55d+32)) then
tmp = t_0
else if (k <= 3.05d-294) then
tmp = (-10.0d0) * (a_m * k)
else if (k <= 0.075d0) then
tmp = a_m * (1.0d0 + (k * (-10.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 / (k * (k + 10.0));
double tmp;
if (k <= -1.55e+32) {
tmp = t_0;
} else if (k <= 3.05e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.075) {
tmp = a_m * (1.0 + (k * -10.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 / (k * (k + 10.0)) tmp = 0 if k <= -1.55e+32: tmp = t_0 elif k <= 3.05e-294: tmp = -10.0 * (a_m * k) elif k <= 0.075: tmp = a_m * (1.0 + (k * -10.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 / Float64(k * Float64(k + 10.0))) tmp = 0.0 if (k <= -1.55e+32) tmp = t_0; elseif (k <= 3.05e-294) tmp = Float64(-10.0 * Float64(a_m * k)); elseif (k <= 0.075) tmp = Float64(a_m * Float64(1.0 + Float64(k * -10.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 * (k + 10.0)); tmp = 0.0; if (k <= -1.55e+32) tmp = t_0; elseif (k <= 3.05e-294) tmp = -10.0 * (a_m * k); elseif (k <= 0.075) tmp = a_m * (1.0 + (k * -10.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[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[k, -1.55e+32], t$95$0, If[LessEqual[k, 3.05e-294], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a$95$m * N[(1.0 + N[(k * -10.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 := \frac{a_m}{k \cdot \left(k + 10\right)}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -1.55 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 3.05 \cdot 10^{-294}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a_m \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
\end{array}
if k < -1.54999999999999997e32 or 0.0749999999999999972 < k Initial program 83.3%
associate-*l/80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
*-commutative80.0%
clear-num79.1%
un-div-inv79.1%
+-commutative79.1%
fma-def79.1%
+-commutative79.1%
Applied egg-rr79.1%
Taylor expanded in k around inf 79.1%
+-commutative79.1%
unpow279.1%
distribute-rgt-in79.1%
Simplified79.1%
Taylor expanded in m around 0 54.4%
if -1.54999999999999997e32 < k < 3.0500000000000001e-294Initial 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 3.7%
Taylor expanded in k around 0 3.7%
Taylor expanded in k around inf 22.7%
if 3.0500000000000001e-294 < k < 0.0749999999999999972Initial 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 51.5%
Taylor expanded in k around 0 51.1%
Taylor expanded in a around 0 51.1%
*-commutative51.1%
Simplified51.1%
Final simplification48.2%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (/ a_m (* k (+ k 10.0)))))
(*
a_s
(if (<= k -6.1e+43)
t_0
(if (<= k 2.15e-294)
(* -10.0 (* a_m k))
(if (<= k 0.65) (/ a_m (+ 1.0 (* k 10.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 / (k * (k + 10.0));
double tmp;
if (k <= -6.1e+43) {
tmp = t_0;
} else if (k <= 2.15e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.65) {
tmp = a_m / (1.0 + (k * 10.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 * (k + 10.0d0))
if (k <= (-6.1d+43)) then
tmp = t_0
else if (k <= 2.15d-294) then
tmp = (-10.0d0) * (a_m * k)
else if (k <= 0.65d0) then
tmp = a_m / (1.0d0 + (k * 10.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 / (k * (k + 10.0));
double tmp;
if (k <= -6.1e+43) {
tmp = t_0;
} else if (k <= 2.15e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.65) {
tmp = a_m / (1.0 + (k * 10.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 / (k * (k + 10.0)) tmp = 0 if k <= -6.1e+43: tmp = t_0 elif k <= 2.15e-294: tmp = -10.0 * (a_m * k) elif k <= 0.65: tmp = a_m / (1.0 + (k * 10.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 / Float64(k * Float64(k + 10.0))) tmp = 0.0 if (k <= -6.1e+43) tmp = t_0; elseif (k <= 2.15e-294) tmp = Float64(-10.0 * Float64(a_m * k)); elseif (k <= 0.65) tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.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 * (k + 10.0)); tmp = 0.0; if (k <= -6.1e+43) tmp = t_0; elseif (k <= 2.15e-294) tmp = -10.0 * (a_m * k); elseif (k <= 0.65) tmp = a_m / (1.0 + (k * 10.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[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[k, -6.1e+43], t$95$0, If[LessEqual[k, 2.15e-294], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.65], N[(a$95$m / N[(1.0 + N[(k * 10.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 := \frac{a_m}{k \cdot \left(k + 10\right)}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -6.1 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 2.15 \cdot 10^{-294}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\mathbf{elif}\;k \leq 0.65:\\
\;\;\;\;\frac{a_m}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
\end{array}
if k < -6.0999999999999998e43 or 0.650000000000000022 < k Initial program 83.3%
associate-*l/80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
*-commutative80.0%
clear-num79.1%
un-div-inv79.1%
+-commutative79.1%
fma-def79.1%
+-commutative79.1%
Applied egg-rr79.1%
Taylor expanded in k around inf 79.1%
+-commutative79.1%
unpow279.1%
distribute-rgt-in79.1%
Simplified79.1%
Taylor expanded in m around 0 54.4%
if -6.0999999999999998e43 < k < 2.1500000000000001e-294Initial 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 3.7%
Taylor expanded in k around 0 3.7%
Taylor expanded in k around inf 22.7%
if 2.1500000000000001e-294 < k < 0.650000000000000022Initial 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 51.5%
Taylor expanded in k around 0 51.2%
*-commutative51.2%
Simplified51.2%
Final simplification48.2%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k -1.75e+24)
(/ a_m (* k (+ k 10.0)))
(if (<= k 2.15e-294)
(* -10.0 (* a_m k))
(if (<= k 0.65) (/ a_m (+ 1.0 (* k 10.0))) (/ (/ a_m 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 (k <= -1.75e+24) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 2.15e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.65) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = (a_m / 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 (k <= (-1.75d+24)) then
tmp = a_m / (k * (k + 10.0d0))
else if (k <= 2.15d-294) then
tmp = (-10.0d0) * (a_m * k)
else if (k <= 0.65d0) then
tmp = a_m / (1.0d0 + (k * 10.0d0))
else
tmp = (a_m / 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 (k <= -1.75e+24) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 2.15e-294) {
tmp = -10.0 * (a_m * k);
} else if (k <= 0.65) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = (a_m / 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 k <= -1.75e+24: tmp = a_m / (k * (k + 10.0)) elif k <= 2.15e-294: tmp = -10.0 * (a_m * k) elif k <= 0.65: tmp = a_m / (1.0 + (k * 10.0)) else: tmp = (a_m / 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 (k <= -1.75e+24) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); elseif (k <= 2.15e-294) tmp = Float64(-10.0 * Float64(a_m * k)); elseif (k <= 0.65) tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a_m / 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 (k <= -1.75e+24) tmp = a_m / (k * (k + 10.0)); elseif (k <= 2.15e-294) tmp = -10.0 * (a_m * k); elseif (k <= 0.65) tmp = a_m / (1.0 + (k * 10.0)); else tmp = (a_m / 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[LessEqual[k, -1.75e+24], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.15e-294], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.65], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a$95$m / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -1.75 \cdot 10^{+24}:\\
\;\;\;\;\frac{a_m}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 2.15 \cdot 10^{-294}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\mathbf{elif}\;k \leq 0.65:\\
\;\;\;\;\frac{a_m}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a_m}{k}}{k + 10}\\
\end{array}
\end{array}
if k < -1.7500000000000001e24Initial program 76.3%
associate-*l/68.4%
sqr-neg68.4%
associate-+l+68.4%
sqr-neg68.4%
distribute-rgt-out68.4%
Simplified68.4%
*-commutative68.4%
clear-num68.4%
un-div-inv68.4%
+-commutative68.4%
fma-def68.4%
+-commutative68.4%
Applied egg-rr68.4%
Taylor expanded in k around inf 68.4%
+-commutative68.4%
unpow268.4%
distribute-rgt-in68.4%
Simplified68.4%
Taylor expanded in m around 0 33.3%
if -1.7500000000000001e24 < k < 2.1500000000000001e-294Initial 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 3.7%
Taylor expanded in k around 0 3.7%
Taylor expanded in k around inf 22.7%
if 2.1500000000000001e-294 < k < 0.650000000000000022Initial 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 51.5%
Taylor expanded in k around 0 51.2%
*-commutative51.2%
Simplified51.2%
if 0.650000000000000022 < k Initial program 86.7%
associate-*l/85.4%
sqr-neg85.4%
associate-+l+85.4%
sqr-neg85.4%
distribute-rgt-out85.5%
Simplified85.5%
*-commutative85.5%
clear-num84.2%
un-div-inv84.2%
+-commutative84.2%
fma-def84.2%
+-commutative84.2%
Applied egg-rr84.2%
Taylor expanded in k around inf 84.2%
+-commutative84.2%
unpow284.2%
distribute-rgt-in84.2%
Simplified84.2%
Taylor expanded in m around 0 64.5%
associate-/r*67.5%
+-commutative67.5%
Simplified67.5%
Final simplification49.2%
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 -0.39)
(/ a_m t_0)
(if (<= m 1.25e+43) (/ a_m (+ 1.0 t_0)) (* a_m (* k -10.0)))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.39) {
tmp = a_m / t_0;
} else if (m <= 1.25e+43) {
tmp = a_m / (1.0 + t_0);
} else {
tmp = a_m * (k * -10.0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-0.39d0)) then
tmp = a_m / t_0
else if (m <= 1.25d+43) then
tmp = a_m / (1.0d0 + t_0)
else
tmp = a_m * (k * (-10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.39) {
tmp = a_m / t_0;
} else if (m <= 1.25e+43) {
tmp = a_m / (1.0 + t_0);
} else {
tmp = a_m * (k * -10.0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.39: tmp = a_m / t_0 elif m <= 1.25e+43: tmp = a_m / (1.0 + t_0) else: tmp = a_m * (k * -10.0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.39) tmp = Float64(a_m / t_0); elseif (m <= 1.25e+43) tmp = Float64(a_m / Float64(1.0 + t_0)); else tmp = Float64(a_m * 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) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.39) tmp = a_m / t_0; elseif (m <= 1.25e+43) tmp = a_m / (1.0 + t_0); else tmp = a_m * (k * -10.0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -0.39], N[(a$95$m / t$95$0), $MachinePrecision], If[LessEqual[m, 1.25e+43], N[(a$95$m / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(k * -10.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 -0.39:\\
\;\;\;\;\frac{a_m}{t_0}\\
\mathbf{elif}\;m \leq 1.25 \cdot 10^{+43}:\\
\;\;\;\;\frac{a_m}{1 + t_0}\\
\mathbf{else}:\\
\;\;\;\;a_m \cdot \left(k \cdot -10\right)\\
\end{array}
\end{array}
\end{array}
if m < -0.39000000000000001Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
*-commutative100.0%
clear-num100.0%
un-div-inv100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in k around inf 87.7%
+-commutative87.7%
unpow287.7%
distribute-rgt-in87.7%
Simplified87.7%
Taylor expanded in m around 0 41.8%
if -0.39000000000000001 < m < 1.2500000000000001e43Initial program 94.7%
associate-*l/94.7%
sqr-neg94.7%
associate-+l+94.7%
sqr-neg94.7%
distribute-rgt-out94.7%
Simplified94.7%
Taylor expanded in m around 0 84.8%
if 1.2500000000000001e43 < m Initial program 81.6%
associate-*l/76.3%
sqr-neg76.3%
associate-+l+76.3%
sqr-neg76.3%
distribute-rgt-out76.3%
Simplified76.3%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 10.9%
Taylor expanded in a around 0 10.9%
*-commutative10.9%
Simplified10.9%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification55.5%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m 1.25e+43) 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 <= 1.25e+43) {
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 <= 1.25d+43) 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 <= 1.25e+43) {
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 <= 1.25e+43: 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 <= 1.25e+43) 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 <= 1.25e+43) 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, 1.25e+43], 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 1.25 \cdot 10^{+43}:\\
\;\;\;\;a_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < 1.2500000000000001e43Initial program 96.8%
associate-*l/96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 63.2%
Taylor expanded in k around 0 28.9%
if 1.2500000000000001e43 < m Initial program 81.6%
associate-*l/76.3%
sqr-neg76.3%
associate-+l+76.3%
sqr-neg76.3%
distribute-rgt-out76.3%
Simplified76.3%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 27.6%
Final simplification28.5%
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.2e+43) a_m (* a_m (* k -10.0)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 3.2e+43) {
tmp = a_m;
} else {
tmp = a_m * (k * -10.0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3.2d+43) then
tmp = a_m
else
tmp = a_m * (k * (-10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 3.2e+43) {
tmp = a_m;
} else {
tmp = a_m * (k * -10.0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 3.2e+43: tmp = a_m else: tmp = a_m * (k * -10.0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 3.2e+43) tmp = a_m; else tmp = Float64(a_m * 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+43) tmp = a_m; else tmp = a_m * (k * -10.0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 3.2e+43], a$95$m, N[(a$95$m * N[(k * -10.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 3.2 \cdot 10^{+43}:\\
\;\;\;\;a_m\\
\mathbf{else}:\\
\;\;\;\;a_m \cdot \left(k \cdot -10\right)\\
\end{array}
\end{array}
if m < 3.20000000000000014e43Initial program 96.8%
associate-*l/96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 63.2%
Taylor expanded in k around 0 28.9%
if 3.20000000000000014e43 < m Initial program 81.6%
associate-*l/76.3%
sqr-neg76.3%
associate-+l+76.3%
sqr-neg76.3%
distribute-rgt-out76.3%
Simplified76.3%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 10.9%
Taylor expanded in a around 0 10.9%
*-commutative10.9%
Simplified10.9%
Taylor expanded in k around inf 27.6%
*-commutative27.6%
Simplified27.6%
Final simplification28.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 92.3%
associate-*l/90.8%
sqr-neg90.8%
associate-+l+90.8%
sqr-neg90.8%
distribute-rgt-out90.8%
Simplified90.8%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around 0 21.4%
Final simplification21.4%
herbie shell --seed 2024018
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))