
(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)) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k)))))
(*
a_s
(if (<= t_1 0.0)
(* (/ (pow k m) (hypot 1.0 k)) (/ a_m (hypot 1.0 k)))
(if (<= t_1 4e+204) 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 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 0.0) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a_m / hypot(1.0, k));
} else if (t_1 <= 4e+204) {
tmp = t_1;
} 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 t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 0.0) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a_m / Math.hypot(1.0, k));
} else if (t_1 <= 4e+204) {
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 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 0.0: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a_m / math.hypot(1.0, k)) elif t_1 <= 4e+204: 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(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a_m / hypot(1.0, k))); elseif (t_1 <= 4e+204) 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 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 0.0) tmp = ((k ^ m) / hypot(1.0, k)) * (a_m / hypot(1.0, k)); elseif (t_1 <= 4e+204) 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[(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] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a$95$m / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+204], 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(1 + k \cdot 10\right) + k \cdot k}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a_m}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{+204}:\\
\;\;\;\;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))) < 0.0Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in k around 0 94.6%
*-commutative94.6%
pow294.6%
add-sqr-sqrt94.6%
times-frac93.6%
pow293.6%
hypot-1-def93.6%
pow293.6%
hypot-1-def98.0%
Applied egg-rr98.0%
if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 3.99999999999999996e204Initial program 99.7%
if 3.99999999999999996e204 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 57.1%
associate-*l/52.4%
sqr-neg52.4%
associate-+l+52.4%
sqr-neg52.4%
distribute-rgt-out52.4%
Simplified52.4%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
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 89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in k around 0 87.9%
*-un-lft-identity87.9%
pow287.9%
add-sqr-sqrt87.9%
times-frac87.8%
pow287.8%
hypot-1-def87.8%
pow287.8%
hypot-1-def98.1%
Applied egg-rr98.1%
associate-*l/98.2%
*-lft-identity98.2%
associate-/l*98.2%
Simplified98.2%
clear-num98.1%
associate-/r/98.2%
clear-num98.2%
Applied egg-rr98.2%
Final simplification98.2%
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 (+ (+ 1.0 (* k 10.0)) (* k k))))) (* a_s (if (<= t_1 4e+204) 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 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 4e+204) {
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 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 4d+204) 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 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 4e+204) {
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 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 4e+204: 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(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 4e+204) 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 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 4e+204) 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[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[t$95$1, 4e+204], 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(1 + k \cdot 10\right) + k \cdot k}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;t_1 \leq 4 \cdot 10^{+204}:\\
\;\;\;\;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))) < 3.99999999999999996e204Initial program 96.0%
if 3.99999999999999996e204 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 57.1%
associate-*l/52.4%
sqr-neg52.4%
associate-+l+52.4%
sqr-neg52.4%
distribute-rgt-out52.4%
Simplified52.4%
Taylor expanded in k around 0 100.0%
Final simplification96.6%
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 (+ 1.0 (* k k)))))
(*
a_s
(if (<= m -3.5e-14)
t_1
(if (<= m 2e-22)
(/ a_m (+ 1.0 (+ (* k 10.0) (pow k 2.0))))
(if (<= m 2.4) 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 / (1.0 + (k * k));
double tmp;
if (m <= -3.5e-14) {
tmp = t_1;
} else if (m <= 2e-22) {
tmp = a_m / (1.0 + ((k * 10.0) + pow(k, 2.0)));
} else if (m <= 2.4) {
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 / (1.0d0 + (k * k))
if (m <= (-3.5d-14)) then
tmp = t_1
else if (m <= 2d-22) then
tmp = a_m / (1.0d0 + ((k * 10.0d0) + (k ** 2.0d0)))
else if (m <= 2.4d0) 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 / (1.0 + (k * k));
double tmp;
if (m <= -3.5e-14) {
tmp = t_1;
} else if (m <= 2e-22) {
tmp = a_m / (1.0 + ((k * 10.0) + Math.pow(k, 2.0)));
} else if (m <= 2.4) {
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 / (1.0 + (k * k)) tmp = 0 if m <= -3.5e-14: tmp = t_1 elif m <= 2e-22: tmp = a_m / (1.0 + ((k * 10.0) + math.pow(k, 2.0))) elif m <= 2.4: 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(1.0 + Float64(k * k))) tmp = 0.0 if (m <= -3.5e-14) tmp = t_1; elseif (m <= 2e-22) tmp = Float64(a_m / Float64(1.0 + Float64(Float64(k * 10.0) + (k ^ 2.0)))); elseif (m <= 2.4) 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 / (1.0 + (k * k)); tmp = 0.0; if (m <= -3.5e-14) tmp = t_1; elseif (m <= 2e-22) tmp = a_m / (1.0 + ((k * 10.0) + (k ^ 2.0))); elseif (m <= 2.4) 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[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -3.5e-14], t$95$1, If[LessEqual[m, 2e-22], N[(a$95$m / N[(1.0 + N[(N[(k * 10.0), $MachinePrecision] + N[Power[k, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.4], 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}{1 + k \cdot k}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -3.5 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;m \leq 2 \cdot 10^{-22}:\\
\;\;\;\;\frac{a_m}{1 + \left(k \cdot 10 + {k}^{2}\right)}\\
\mathbf{elif}\;m \leq 2.4:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
\end{array}
if m < -3.5000000000000002e-14 or 2.0000000000000001e-22 < m < 2.39999999999999991Initial program 98.9%
*-commutative98.9%
Simplified98.9%
Taylor expanded in k around 0 98.9%
if -3.5000000000000002e-14 < m < 2.0000000000000001e-22Initial program 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in m around 0 90.5%
if 2.39999999999999991 < m Initial program 79.8%
associate-*l/73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in k around 0 100.0%
Final simplification96.6%
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 -0.00085) (not (<= m 0.96)))
(* (pow k m) a_m)
(/ a_m (+ 1.0 (+ (* k 10.0) (pow k 2.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 <= -0.00085) || !(m <= 0.96)) {
tmp = pow(k, m) * a_m;
} else {
tmp = a_m / (1.0 + ((k * 10.0) + pow(k, 2.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 <= (-0.00085d0)) .or. (.not. (m <= 0.96d0))) then
tmp = (k ** m) * a_m
else
tmp = a_m / (1.0d0 + ((k * 10.0d0) + (k ** 2.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 <= -0.00085) || !(m <= 0.96)) {
tmp = Math.pow(k, m) * a_m;
} else {
tmp = a_m / (1.0 + ((k * 10.0) + Math.pow(k, 2.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 <= -0.00085) or not (m <= 0.96): tmp = math.pow(k, m) * a_m else: tmp = a_m / (1.0 + ((k * 10.0) + math.pow(k, 2.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 <= -0.00085) || !(m <= 0.96)) tmp = Float64((k ^ m) * a_m); else tmp = Float64(a_m / Float64(1.0 + Float64(Float64(k * 10.0) + (k ^ 2.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 <= -0.00085) || ~((m <= 0.96))) tmp = (k ^ m) * a_m; else tmp = a_m / (1.0 + ((k * 10.0) + (k ^ 2.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, -0.00085], N[Not[LessEqual[m, 0.96]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $MachinePrecision], N[(a$95$m / N[(1.0 + N[(N[(k * 10.0), $MachinePrecision] + N[Power[k, 2.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 -0.00085 \lor \neg \left(m \leq 0.96\right):\\
\;\;\;\;{k}^{m} \cdot a_m\\
\mathbf{else}:\\
\;\;\;\;\frac{a_m}{1 + \left(k \cdot 10 + {k}^{2}\right)}\\
\end{array}
\end{array}
if m < -8.49999999999999953e-4 or 0.95999999999999996 < m Initial program 89.2%
associate-*l/85.6%
sqr-neg85.6%
associate-+l+85.6%
sqr-neg85.6%
distribute-rgt-out85.6%
Simplified85.6%
Taylor expanded in k around 0 100.0%
if -8.49999999999999953e-4 < m < 0.95999999999999996Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in m around 0 89.1%
Final simplification96.2%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 2.7)
(* (pow k m) (/ a_m (+ 1.0 (* k (+ k 10.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 <= 2.7) {
tmp = pow(k, m) * (a_m / (1.0 + (k * (k + 10.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 <= 2.7d0) then
tmp = (k ** m) * (a_m / (1.0d0 + (k * (k + 10.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 <= 2.7) {
tmp = Math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.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 <= 2.7: tmp = math.pow(k, m) * (a_m / (1.0 + (k * (k + 10.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 <= 2.7) tmp = Float64((k ^ m) * Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.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 <= 2.7) tmp = (k ^ m) * (a_m / (1.0 + (k * (k + 10.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, 2.7], N[(N[Power[k, m], $MachinePrecision] * N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(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 2.7:\\
\;\;\;\;{k}^{m} \cdot \frac{a_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a_m\\
\end{array}
\end{array}
if m < 2.7000000000000002Initial program 94.8%
associate-*l/94.8%
sqr-neg94.8%
associate-+l+94.8%
sqr-neg94.8%
distribute-rgt-out94.8%
Simplified94.8%
if 2.7000000000000002 < m Initial program 79.8%
associate-*l/73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in k around 0 100.0%
Final simplification96.6%
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.2) (not (<= m 0.47)))
(* (pow k m) a_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.2) || !(m <= 0.47)) {
tmp = pow(k, m) * a_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.2d0)) .or. (.not. (m <= 0.47d0))) then
tmp = (k ** m) * a_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.2) || !(m <= 0.47)) {
tmp = Math.pow(k, m) * a_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.2) or not (m <= 0.47): tmp = math.pow(k, m) * a_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.2) || !(m <= 0.47)) tmp = Float64((k ^ m) * a_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.2) || ~((m <= 0.47))) tmp = (k ^ m) * a_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.2], N[Not[LessEqual[m, 0.47]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a$95$m), $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.2 \lor \neg \left(m \leq 0.47\right):\\
\;\;\;\;{k}^{m} \cdot a_m\\
\mathbf{else}:\\
\;\;\;\;\frac{a_m}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.19999999999999996 or 0.46999999999999997 < m Initial program 89.2%
associate-*l/85.6%
sqr-neg85.6%
associate-+l+85.6%
sqr-neg85.6%
distribute-rgt-out85.6%
Simplified85.6%
Taylor expanded in k around 0 100.0%
if -1.19999999999999996 < m < 0.46999999999999997Initial program 90.3%
associate-*l/90.3%
sqr-neg90.3%
associate-+l+90.3%
sqr-neg90.3%
distribute-rgt-out90.3%
Simplified90.3%
Taylor expanded in m around 0 89.1%
Final simplification96.2%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= k -1.85e+117) (not (<= k 0.075)))
(* a_m (/ 1.0 (* k (+ k 10.0))))
(* a_m (+ 1.0 (* k -10.0))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -1.85e+117) || !(k <= 0.075)) {
tmp = a_m * (1.0 / (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * -10.0));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-1.85d+117)) .or. (.not. (k <= 0.075d0))) then
tmp = a_m * (1.0d0 / (k * (k + 10.0d0)))
else
tmp = a_m * (1.0d0 + (k * (-10.0d0)))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -1.85e+117) || !(k <= 0.075)) {
tmp = a_m * (1.0 / (k * (k + 10.0)));
} else {
tmp = a_m * (1.0 + (k * -10.0));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= -1.85e+117) or not (k <= 0.075): tmp = a_m * (1.0 / (k * (k + 10.0))) else: tmp = a_m * (1.0 + (k * -10.0)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= -1.85e+117) || !(k <= 0.075)) tmp = Float64(a_m * Float64(1.0 / Float64(k * Float64(k + 10.0)))); else tmp = Float64(a_m * Float64(1.0 + Float64(k * -10.0))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= -1.85e+117) || ~((k <= 0.075))) tmp = a_m * (1.0 / (k * (k + 10.0))); else tmp = a_m * (1.0 + (k * -10.0)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, -1.85e+117], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(a$95$m * N[(1.0 / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -1.85 \cdot 10^{+117} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;a_m \cdot \frac{1}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a_m \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < -1.8499999999999999e117 or 0.0749999999999999972 < k Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in m around 0 55.5%
frac-2neg55.5%
+-commutative55.5%
distribute-neg-in55.5%
pow255.5%
distribute-rgt-in55.4%
+-commutative55.4%
distribute-neg-in55.4%
fma-udef55.4%
frac-2neg55.4%
clear-num55.4%
associate-/r/55.4%
Applied egg-rr55.4%
Taylor expanded in k around inf 54.4%
+-commutative54.4%
unpow254.4%
distribute-rgt-in54.4%
Simplified54.4%
if -1.8499999999999999e117 < k < 0.0749999999999999972Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 33.3%
frac-2neg33.3%
+-commutative33.3%
distribute-neg-in33.3%
pow233.3%
distribute-rgt-in33.3%
+-commutative33.3%
distribute-neg-in33.3%
fma-udef33.3%
frac-2neg33.3%
clear-num33.3%
associate-/r/33.3%
Applied egg-rr33.3%
Taylor expanded in k around 0 33.2%
*-commutative33.2%
Simplified33.2%
Final simplification43.7%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (or (<= k -2.05e+120) (not (<= k 0.075)))
(* 0.1 (/ a_m k))
(* a_m (+ 1.0 (* k -10.0))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -2.05e+120) || !(k <= 0.075)) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m * (1.0 + (k * -10.0));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-2.05d+120)) .or. (.not. (k <= 0.075d0))) then
tmp = 0.1d0 * (a_m / k)
else
tmp = a_m * (1.0d0 + (k * (-10.0d0)))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -2.05e+120) || !(k <= 0.075)) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m * (1.0 + (k * -10.0));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= -2.05e+120) or not (k <= 0.075): tmp = 0.1 * (a_m / k) else: tmp = a_m * (1.0 + (k * -10.0)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= -2.05e+120) || !(k <= 0.075)) tmp = Float64(0.1 * Float64(a_m / k)); else tmp = Float64(a_m * Float64(1.0 + Float64(k * -10.0))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= -2.05e+120) || ~((k <= 0.075))) tmp = 0.1 * (a_m / k); else tmp = a_m * (1.0 + (k * -10.0)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, -2.05e+120], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -2.05 \cdot 10^{+120} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;0.1 \cdot \frac{a_m}{k}\\
\mathbf{else}:\\
\;\;\;\;a_m \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < -2.05e120 or 0.0749999999999999972 < k Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in m around 0 55.5%
Taylor expanded in k around 0 23.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in k around inf 23.0%
if -2.05e120 < k < 0.0749999999999999972Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 33.3%
frac-2neg33.3%
+-commutative33.3%
distribute-neg-in33.3%
pow233.3%
distribute-rgt-in33.3%
+-commutative33.3%
distribute-neg-in33.3%
fma-udef33.3%
frac-2neg33.3%
clear-num33.3%
associate-/r/33.3%
Applied egg-rr33.3%
Taylor expanded in k around 0 33.2%
*-commutative33.2%
Simplified33.2%
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 (if (or (<= k -1.15e+119) (not (<= k 0.1))) (* 0.1 (/ a_m k)) a_m)))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -1.15e+119) || !(k <= 0.1)) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-1.15d+119)) .or. (.not. (k <= 0.1d0))) then
tmp = 0.1d0 * (a_m / k)
else
tmp = a_m
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if ((k <= -1.15e+119) || !(k <= 0.1)) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m;
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if (k <= -1.15e+119) or not (k <= 0.1): tmp = 0.1 * (a_m / k) else: tmp = a_m return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if ((k <= -1.15e+119) || !(k <= 0.1)) tmp = Float64(0.1 * Float64(a_m / k)); else tmp = a_m; end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if ((k <= -1.15e+119) || ~((k <= 0.1))) tmp = 0.1 * (a_m / k); else tmp = a_m; end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[Or[LessEqual[k, -1.15e+119], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], a$95$m]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq -1.15 \cdot 10^{+119} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;0.1 \cdot \frac{a_m}{k}\\
\mathbf{else}:\\
\;\;\;\;a_m\\
\end{array}
\end{array}
if k < -1.15e119 or 0.10000000000000001 < k Initial program 79.1%
*-commutative79.1%
Simplified79.1%
Taylor expanded in m around 0 55.5%
Taylor expanded in k around 0 23.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in k around inf 23.0%
if -1.15e119 < k < 0.10000000000000001Initial program 99.9%
associate-*l/99.2%
sqr-neg99.2%
associate-+l+99.2%
sqr-neg99.2%
distribute-rgt-out99.2%
Simplified99.2%
Taylor expanded in m around 0 33.3%
Taylor expanded in k around 0 31.9%
Final simplification27.5%
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 -1.6e+36) (* a_m (/ 1.0 t_0)) (/ a_m (+ 1.0 t_0))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -1.6e+36) {
tmp = a_m * (1.0 / t_0);
} else {
tmp = a_m / (1.0 + t_0);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-1.6d+36)) then
tmp = a_m * (1.0d0 / t_0)
else
tmp = a_m / (1.0d0 + t_0)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -1.6e+36) {
tmp = a_m * (1.0 / t_0);
} else {
tmp = a_m / (1.0 + t_0);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -1.6e+36: tmp = a_m * (1.0 / t_0) else: tmp = a_m / (1.0 + t_0) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -1.6e+36) tmp = Float64(a_m * Float64(1.0 / t_0)); else tmp = Float64(a_m / Float64(1.0 + t_0)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -1.6e+36) tmp = a_m * (1.0 / t_0); else tmp = a_m / (1.0 + t_0); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -1.6e+36], N[(a$95$m * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.6 \cdot 10^{+36}:\\
\;\;\;\;a_m \cdot \frac{1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{a_m}{1 + t_0}\\
\end{array}
\end{array}
\end{array}
if m < -1.5999999999999999e36Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 41.8%
frac-2neg41.8%
+-commutative41.8%
distribute-neg-in41.8%
pow241.8%
distribute-rgt-in41.8%
+-commutative41.8%
distribute-neg-in41.8%
fma-udef41.8%
frac-2neg41.8%
clear-num41.8%
associate-/r/41.8%
Applied egg-rr41.8%
Taylor expanded in k around inf 50.3%
+-commutative50.3%
unpow250.3%
distribute-rgt-in50.3%
Simplified50.3%
if -1.5999999999999999e36 < m Initial program 85.5%
associate-*l/82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in m around 0 45.2%
Final simplification46.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 -2.8e+36) (* 0.1 (/ a_m k)) (/ a_m (+ 1.0 (* k 10.0))))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -2.8e+36) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m / (1.0 + (k * 10.0));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-2.8d+36)) then
tmp = 0.1d0 * (a_m / k)
else
tmp = a_m / (1.0d0 + (k * 10.0d0))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -2.8e+36) {
tmp = 0.1 * (a_m / k);
} else {
tmp = a_m / (1.0 + (k * 10.0));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -2.8e+36: tmp = 0.1 * (a_m / k) else: tmp = a_m / (1.0 + (k * 10.0)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -2.8e+36) tmp = Float64(0.1 * Float64(a_m / k)); else tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -2.8e+36) tmp = 0.1 * (a_m / k); else tmp = a_m / (1.0 + (k * 10.0)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -2.8e+36], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -2.8 \cdot 10^{+36}:\\
\;\;\;\;0.1 \cdot \frac{a_m}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a_m}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -2.8000000000000001e36Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 41.8%
Taylor expanded in k around 0 17.4%
*-commutative17.4%
Simplified17.4%
Taylor expanded in k around inf 25.9%
if -2.8000000000000001e36 < m Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in m around 0 45.3%
Taylor expanded in k around 0 31.8%
*-commutative31.8%
Simplified31.8%
Final simplification30.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 89.6%
associate-*l/87.3%
sqr-neg87.3%
associate-+l+87.3%
sqr-neg87.3%
distribute-rgt-out87.2%
Simplified87.2%
Taylor expanded in m around 0 44.3%
Taylor expanded in k around 0 18.2%
Final simplification18.2%
herbie shell --seed 2024026
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))