
(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 11 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))))
(*
a_s
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 1e+164)
(/ (pow k m) (+ (/ 1.0 a_m) (* (/ k a_m) (+ 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 tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+164) {
tmp = pow(k, m) / ((1.0 / a_m) + ((k / a_m) * (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 ** m)
if ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 1d+164) then
tmp = (k ** m) / ((1.0d0 / a_m) + ((k / a_m) * (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 tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+164) {
tmp = Math.pow(k, m) / ((1.0 / a_m) + ((k / a_m) * (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) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+164: tmp = math.pow(k, m) / ((1.0 / a_m) + ((k / a_m) * (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)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 1e+164) tmp = Float64((k ^ m) / Float64(Float64(1.0 / a_m) + Float64(Float64(k / a_m) * 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); tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 1e+164) tmp = (k ^ m) / ((1.0 / a_m) + ((k / a_m) * (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]}, 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+164], N[(N[Power[k, m], $MachinePrecision] / N[(N[(1.0 / a$95$m), $MachinePrecision] + N[(N[(k / a$95$m), $MachinePrecision] * N[(k + 10.0), $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}\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 10^{+164}:\\
\;\;\;\;\frac{{k}^{m}}{\frac{1}{a_m} + \frac{k}{a_m} \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))) < 1e164Initial program 97.2%
*-commutative97.2%
associate-/l*95.9%
sqr-neg95.9%
associate-+l+95.9%
+-commutative95.9%
sqr-neg95.9%
distribute-rgt-out95.9%
fma-def95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in a around 0 95.9%
flip-+69.4%
associate-/l/67.4%
metadata-eval67.4%
*-un-lft-identity67.4%
metadata-eval67.4%
frac-times69.4%
flip-+95.9%
distribute-lft-in95.9%
associate-/r/95.9%
clear-num95.9%
+-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in k around 0 93.5%
*-rgt-identity93.5%
associate-*r/93.5%
*-commutative93.5%
*-commutative93.5%
fma-def93.5%
*-lft-identity93.5%
associate-*l/93.5%
unpow293.5%
associate-*l*96.2%
fma-def96.2%
distribute-lft-out98.6%
+-commutative98.6%
associate-*l/98.6%
*-lft-identity98.6%
Simplified98.6%
if 1e164 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 67.3%
associate-/l*67.3%
sqr-neg67.3%
associate-+l+67.3%
sqr-neg67.3%
distribute-rgt-out67.3%
Simplified67.3%
Taylor expanded in k around 0 100.0%
Final simplification98.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -6e-12)
(/ (/ a_m (+ 1.0 (* k 10.0))) (pow k (- m)))
(if (<= m 0.00052)
(/ 1.0 (+ (/ 1.0 a_m) (* k (/ (+ k 10.0) a_m))))
(* a_m (pow k m))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -6e-12) {
tmp = (a_m / (1.0 + (k * 10.0))) / pow(k, -m);
} else if (m <= 0.00052) {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / a_m)));
} else {
tmp = a_m * pow(k, m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-6d-12)) then
tmp = (a_m / (1.0d0 + (k * 10.0d0))) / (k ** -m)
else if (m <= 0.00052d0) then
tmp = 1.0d0 / ((1.0d0 / a_m) + (k * ((k + 10.0d0) / a_m)))
else
tmp = a_m * (k ** m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -6e-12) {
tmp = (a_m / (1.0 + (k * 10.0))) / Math.pow(k, -m);
} else if (m <= 0.00052) {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / a_m)));
} else {
tmp = a_m * Math.pow(k, m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -6e-12: tmp = (a_m / (1.0 + (k * 10.0))) / math.pow(k, -m) elif m <= 0.00052: tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / a_m))) else: tmp = a_m * math.pow(k, m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -6e-12) tmp = Float64(Float64(a_m / Float64(1.0 + Float64(k * 10.0))) / (k ^ Float64(-m))); elseif (m <= 0.00052) tmp = Float64(1.0 / Float64(Float64(1.0 / a_m) + Float64(k * Float64(Float64(k + 10.0) / a_m)))); else tmp = Float64(a_m * (k ^ 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 <= -6e-12) tmp = (a_m / (1.0 + (k * 10.0))) / (k ^ -m); elseif (m <= 0.00052) tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / a_m))); else tmp = a_m * (k ^ m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -6e-12], N[(N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.00052], N[(1.0 / N[(N[(1.0 / a$95$m), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -6 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{a_m}{1 + k \cdot 10}}{{k}^{\left(-m\right)}}\\
\mathbf{elif}\;m \leq 0.00052:\\
\;\;\;\;\frac{1}{\frac{1}{a_m} + k \cdot \frac{k + 10}{a_m}}\\
\mathbf{else}:\\
\;\;\;\;a_m \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -6.0000000000000003e-12Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative20.0%
Simplified100.0%
add-sqr-sqrt48.1%
div-inv48.1%
times-frac48.1%
+-commutative48.1%
fma-def48.1%
pow-flip48.1%
Applied egg-rr48.1%
associate-*r/48.1%
associate-*l/48.1%
rem-square-sqrt100.0%
Simplified100.0%
Taylor expanded in a around 0 100.0%
if -6.0000000000000003e-12 < m < 5.19999999999999954e-4Initial program 93.0%
*-commutative93.0%
associate-/l*92.2%
sqr-neg92.2%
associate-+l+92.2%
+-commutative92.2%
sqr-neg92.2%
distribute-rgt-out92.2%
fma-def92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in a around 0 92.2%
flip-+57.4%
associate-/l/57.2%
metadata-eval57.2%
*-un-lft-identity57.2%
metadata-eval57.2%
frac-times57.4%
flip-+92.2%
distribute-lft-in92.2%
associate-/r/92.2%
clear-num92.2%
+-commutative92.2%
Applied egg-rr92.2%
Taylor expanded in m around 0 92.2%
associate-/l*98.9%
+-commutative98.9%
Simplified98.9%
clear-num99.0%
associate-/r/99.0%
clear-num99.0%
Applied egg-rr99.0%
if 5.19999999999999954e-4 < m Initial program 82.6%
associate-/l*82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in k around 0 100.0%
Final simplification99.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.45e-13) (not (<= m 2.2e-11)))
(* a_m (pow k m))
(/ 1.0 (+ (/ 1.0 a_m) (* k (/ (+ k 10.0) 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.45e-13) || !(m <= 2.2e-11)) {
tmp = a_m * pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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.45d-13)) .or. (.not. (m <= 2.2d-11))) then
tmp = a_m * (k ** m)
else
tmp = 1.0d0 / ((1.0d0 / a_m) + (k * ((k + 10.0d0) / 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.45e-13) || !(m <= 2.2e-11)) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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.45e-13) or not (m <= 2.2e-11): tmp = a_m * math.pow(k, m) else: tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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.45e-13) || !(m <= 2.2e-11)) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(1.0 / Float64(Float64(1.0 / a_m) + Float64(k * Float64(Float64(k + 10.0) / 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.45e-13) || ~((m <= 2.2e-11))) tmp = a_m * (k ^ m); else tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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[m, -1.45e-13], N[Not[LessEqual[m, 2.2e-11]], $MachinePrecision]], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a$95$m), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a$95$m), $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.45 \cdot 10^{-13} \lor \neg \left(m \leq 2.2 \cdot 10^{-11}\right):\\
\;\;\;\;a_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a_m} + k \cdot \frac{k + 10}{a_m}}\\
\end{array}
\end{array}
if m < -1.4499999999999999e-13 or 2.2000000000000002e-11 < m Initial program 90.7%
associate-/l*90.7%
sqr-neg90.7%
associate-+l+90.7%
sqr-neg90.7%
distribute-rgt-out90.7%
Simplified90.7%
Taylor expanded in k around 0 100.0%
if -1.4499999999999999e-13 < m < 2.2000000000000002e-11Initial program 93.0%
*-commutative93.0%
associate-/l*92.2%
sqr-neg92.2%
associate-+l+92.2%
+-commutative92.2%
sqr-neg92.2%
distribute-rgt-out92.2%
fma-def92.2%
+-commutative92.2%
Simplified92.2%
Taylor expanded in a around 0 92.2%
flip-+57.4%
associate-/l/57.2%
metadata-eval57.2%
*-un-lft-identity57.2%
metadata-eval57.2%
frac-times57.4%
flip-+92.2%
distribute-lft-in92.2%
associate-/r/92.2%
clear-num92.2%
+-commutative92.2%
Applied egg-rr92.2%
Taylor expanded in m around 0 92.2%
associate-/l*98.9%
+-commutative98.9%
Simplified98.9%
clear-num99.0%
associate-/r/99.0%
clear-num99.0%
Applied egg-rr99.0%
Final simplification99.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 -5e+40)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(if (<= m 880000000.0)
(/ 1.0 (+ (/ 1.0 a_m) (* k (/ (+ k 10.0) a_m))))
(* -10.0 (* a_m k))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -5e+40) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else if (m <= 880000000.0) {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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 <= (-5d+40)) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else if (m <= 880000000.0d0) then
tmp = 1.0d0 / ((1.0d0 / a_m) + (k * ((k + 10.0d0) / 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 <= -5e+40) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else if (m <= 880000000.0) {
tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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 <= -5e+40: tmp = a_m / (1.0 + (k * (k + 10.0))) elif m <= 880000000.0: tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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 <= -5e+40) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); elseif (m <= 880000000.0) tmp = Float64(1.0 / Float64(Float64(1.0 / a_m) + Float64(k * Float64(Float64(k + 10.0) / 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 <= -5e+40) tmp = a_m / (1.0 + (k * (k + 10.0))); elseif (m <= 880000000.0) tmp = 1.0 / ((1.0 / a_m) + (k * ((k + 10.0) / 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, -5e+40], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 880000000.0], N[(1.0 / N[(N[(1.0 / a$95$m), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -5 \cdot 10^{+40}:\\
\;\;\;\;\frac{a_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 880000000:\\
\;\;\;\;\frac{1}{\frac{1}{a_m} + k \cdot \frac{k + 10}{a_m}}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < -5.00000000000000003e40Initial 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 41.3%
if -5.00000000000000003e40 < m < 8.8e8Initial program 94.1%
*-commutative94.1%
associate-/l*93.5%
sqr-neg93.5%
associate-+l+93.5%
+-commutative93.5%
sqr-neg93.5%
distribute-rgt-out93.5%
fma-def93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in a around 0 93.5%
flip-+63.2%
associate-/l/63.1%
metadata-eval63.1%
*-un-lft-identity63.1%
metadata-eval63.1%
frac-times63.2%
flip-+93.4%
distribute-lft-in93.5%
associate-/r/93.5%
clear-num93.5%
+-commutative93.5%
Applied egg-rr93.5%
Taylor expanded in m around 0 80.1%
associate-/l*85.8%
+-commutative85.8%
Simplified85.8%
clear-num85.8%
associate-/r/85.8%
clear-num85.8%
Applied egg-rr85.8%
if 8.8e8 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification49.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 600000000.0)
(* a_m (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))
(* -10.0 (* a_m k)))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 600000000.0) {
tmp = a_m * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 600000000.0d0) then
tmp = a_m * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 600000000.0) {
tmp = a_m * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 600000000.0: tmp = a_m * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 600000000.0) tmp = Float64(a_m * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 600000000.0) tmp = a_m * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 600000000.0], N[(a$95$m * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 600000000:\\
\;\;\;\;a_m \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < 6e8Initial program 96.5%
associate-/l*96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
clear-num96.1%
associate-/r/96.5%
clear-num96.5%
+-commutative96.5%
+-commutative96.5%
fma-udef96.5%
Applied egg-rr96.5%
Taylor expanded in m around 0 65.0%
if 6e8 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification48.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -1.7e+106)
(* 0.1 (/ a_m k))
(if (<= m 960000000.0) (/ a_m (+ 1.0 (* k 10.0))) (* -10.0 (* a_m k))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.7e+106) {
tmp = 0.1 * (a_m / k);
} else if (m <= 960000000.0) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.7d+106)) then
tmp = 0.1d0 * (a_m / k)
else if (m <= 960000000.0d0) then
tmp = a_m / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -1.7e+106) {
tmp = 0.1 * (a_m / k);
} else if (m <= 960000000.0) {
tmp = a_m / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -1.7e+106: tmp = 0.1 * (a_m / k) elif m <= 960000000.0: tmp = a_m / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -1.7e+106) tmp = Float64(0.1 * Float64(a_m / k)); elseif (m <= 960000000.0) tmp = Float64(a_m / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -1.7e+106) tmp = 0.1 * (a_m / k); elseif (m <= 960000000.0) tmp = a_m / (1.0 + (k * 10.0)); else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -1.7e+106], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 960000000.0], N[(a$95$m / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{+106}:\\
\;\;\;\;0.1 \cdot \frac{a_m}{k}\\
\mathbf{elif}\;m \leq 960000000:\\
\;\;\;\;\frac{a_m}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < -1.69999999999999997e106Initial 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 36.8%
Taylor expanded in k around 0 23.4%
*-commutative23.4%
Simplified23.4%
Taylor expanded in k around inf 36.6%
if -1.69999999999999997e106 < m < 9.6e8Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 77.3%
Taylor expanded in k around 0 49.7%
*-commutative49.7%
Simplified49.7%
if 9.6e8 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification35.6%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m 49000000000.0)
(/ a_m (+ 1.0 (* k (+ k 10.0))))
(* -10.0 (* a_m k)))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 49000000000.0) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 49000000000.0d0) then
tmp = a_m / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 49000000000.0) {
tmp = a_m / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 49000000000.0: tmp = a_m / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 49000000000.0) tmp = Float64(a_m / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 49000000000.0) tmp = a_m / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 49000000000.0], N[(a$95$m / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 49000000000:\\
\;\;\;\;\frac{a_m}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < 4.9e10Initial program 96.5%
associate-/l*96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 65.0%
if 4.9e10 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification48.0%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -4.6e+30)
(* 0.1 (/ a_m k))
(if (<= m 600000000.0) a_m (* -10.0 (* a_m k))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -4.6e+30) {
tmp = 0.1 * (a_m / k);
} else if (m <= 600000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-4.6d+30)) then
tmp = 0.1d0 * (a_m / k)
else if (m <= 600000000.0d0) then
tmp = a_m
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -4.6e+30) {
tmp = 0.1 * (a_m / k);
} else if (m <= 600000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -4.6e+30: tmp = 0.1 * (a_m / k) elif m <= 600000000.0: tmp = a_m else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -4.6e+30) tmp = Float64(0.1 * Float64(a_m / k)); elseif (m <= 600000000.0) tmp = a_m; else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -4.6e+30) tmp = 0.1 * (a_m / k); elseif (m <= 600000000.0) tmp = a_m; else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -4.6e+30], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 600000000.0], a$95$m, N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -4.6 \cdot 10^{+30}:\\
\;\;\;\;0.1 \cdot \frac{a_m}{k}\\
\mathbf{elif}\;m \leq 600000000:\\
\;\;\;\;a_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < -4.6e30Initial 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 40.8%
Taylor expanded in k around 0 21.8%
*-commutative21.8%
Simplified21.8%
Taylor expanded in k around inf 29.8%
if -4.6e30 < m < 6e8Initial program 94.1%
associate-/l*94.1%
sqr-neg94.1%
associate-+l+94.1%
sqr-neg94.1%
distribute-rgt-out94.1%
Simplified94.1%
Taylor expanded in m around 0 81.6%
Taylor expanded in k around 0 41.9%
if 6e8 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification29.9%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= m -4.6e+30)
(/ a_m (* k 10.0))
(if (<= m 960000000.0) a_m (* -10.0 (* a_m k))))))a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -4.6e+30) {
tmp = a_m / (k * 10.0);
} else if (m <= 960000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-4.6d+30)) then
tmp = a_m / (k * 10.0d0)
else if (m <= 960000000.0d0) then
tmp = a_m
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= -4.6e+30) {
tmp = a_m / (k * 10.0);
} else if (m <= 960000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= -4.6e+30: tmp = a_m / (k * 10.0) elif m <= 960000000.0: tmp = a_m else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= -4.6e+30) tmp = Float64(a_m / Float64(k * 10.0)); elseif (m <= 960000000.0) tmp = a_m; else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= -4.6e+30) tmp = a_m / (k * 10.0); elseif (m <= 960000000.0) tmp = a_m; else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, -4.6e+30], N[(a$95$m / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 960000000.0], a$95$m, N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -4.6 \cdot 10^{+30}:\\
\;\;\;\;\frac{a_m}{k \cdot 10}\\
\mathbf{elif}\;m \leq 960000000:\\
\;\;\;\;a_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < -4.6e30Initial 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 40.8%
Taylor expanded in k around 0 21.8%
*-commutative21.8%
Simplified21.8%
Taylor expanded in k around inf 31.2%
*-commutative31.2%
Simplified31.2%
if -4.6e30 < m < 9.6e8Initial program 94.1%
associate-/l*94.1%
sqr-neg94.1%
associate-+l+94.1%
sqr-neg94.1%
distribute-rgt-out94.1%
Simplified94.1%
Taylor expanded in m around 0 81.6%
Taylor expanded in k around 0 41.9%
if 9.6e8 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification30.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 1500000000000.0) a_m (* -10.0 (* a_m k)))))
a_m = fabs(a);
a_s = copysign(1.0, a);
double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1500000000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1500000000000.0d0) then
tmp = a_m
else
tmp = (-10.0d0) * (a_m * k)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (m <= 1500000000000.0) {
tmp = a_m;
} else {
tmp = -10.0 * (a_m * k);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if m <= 1500000000000.0: tmp = a_m else: tmp = -10.0 * (a_m * k) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (m <= 1500000000000.0) tmp = a_m; else tmp = Float64(-10.0 * Float64(a_m * k)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (m <= 1500000000000.0) tmp = a_m; else tmp = -10.0 * (a_m * k); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[m, 1500000000000.0], a$95$m, N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq 1500000000000:\\
\;\;\;\;a_m\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a_m \cdot k\right)\\
\end{array}
\end{array}
if m < 1.5e12Initial program 96.5%
associate-/l*96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 65.0%
Taylor expanded in k around 0 26.6%
if 1.5e12 < m Initial program 82.4%
associate-/l*82.4%
sqr-neg82.4%
associate-+l+82.4%
sqr-neg82.4%
distribute-rgt-out82.4%
Simplified82.4%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 5.3%
Taylor expanded in k around inf 17.2%
*-commutative17.2%
Simplified17.2%
Final simplification23.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.5%
associate-/l*91.5%
sqr-neg91.5%
associate-+l+91.5%
sqr-neg91.5%
distribute-rgt-out91.5%
Simplified91.5%
Taylor expanded in m around 0 42.9%
Taylor expanded in k around 0 18.3%
Final simplification18.3%
herbie shell --seed 2023333
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))