
(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))) (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 2e+293)
(* (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 <= 2e+293) {
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 <= 2d+293) 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 <= 2e+293) {
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 <= 2e+293: 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 <= 2e+293) 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 <= 2e+293) 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, 2e+293], 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 2 \cdot 10^{+293}:\\
\;\;\;\;{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 96.8%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
*-commutative93.3%
clear-num93.3%
un-div-inv93.3%
+-commutative93.3%
fma-define93.3%
+-commutative93.3%
Applied egg-rr93.3%
Taylor expanded in k around inf 72.3%
+-commutative72.3%
unpow272.3%
distribute-rgt-in72.3%
Simplified72.3%
associate-/l*75.5%
associate-/r/81.8%
Applied egg-rr81.8%
if 0.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999998e293Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
if 1.9999999999999998e293 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 53.2%
associate-*l/46.8%
sqr-neg46.8%
associate-+l+46.8%
sqr-neg46.8%
distribute-rgt-out46.8%
Simplified46.8%
Taylor expanded in k around 0 100.0%
Final simplification87.6%
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.00112)
(* 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.00112) {
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.00112d0) 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.00112) {
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.00112: 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.00112) 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.00112) 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.00112], 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.00112:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a\_m}{k + 10}\\
\end{array}
\end{array}
if k < 0.0011199999999999999Initial program 92.7%
associate-*l/90.5%
sqr-neg90.5%
associate-+l+90.5%
sqr-neg90.5%
distribute-rgt-out90.5%
Simplified90.5%
Taylor expanded in k around 0 99.8%
if 0.0011199999999999999 < k Initial program 80.9%
associate-*l/74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
*-commutative74.4%
clear-num74.5%
un-div-inv74.5%
+-commutative74.5%
fma-define74.5%
+-commutative74.5%
Applied egg-rr74.5%
Taylor expanded in k around inf 74.5%
+-commutative74.5%
unpow274.5%
distribute-rgt-in74.5%
Simplified74.5%
associate-/l*85.7%
associate-/r/93.4%
Applied egg-rr93.4%
Final simplification97.9%
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.8e-7) (not (<= m 1.9e-50)))
(* 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.8e-7) || !(m <= 1.9e-50)) {
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.8d-7)) .or. (.not. (m <= 1.9d-50))) 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.8e-7) || !(m <= 1.9e-50)) {
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.8e-7) or not (m <= 1.9e-50): 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.8e-7) || !(m <= 1.9e-50)) 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.8e-7) || ~((m <= 1.9e-50))) 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.8e-7], N[Not[LessEqual[m, 1.9e-50]], $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.8 \cdot 10^{-7} \lor \neg \left(m \leq 1.9 \cdot 10^{-50}\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.79999999999999997e-7 or 1.9e-50 < m Initial program 87.3%
associate-*l/82.3%
sqr-neg82.3%
associate-+l+82.3%
sqr-neg82.3%
distribute-rgt-out82.3%
Simplified82.3%
Taylor expanded in k around 0 99.4%
if -1.79999999999999997e-7 < m < 1.9e-50Initial program 93.7%
associate-*l/93.7%
sqr-neg93.7%
associate-+l+93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
Simplified93.7%
Taylor expanded in m around 0 93.7%
Final simplification97.8%
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.00112) (* a_m (pow k m)) (* (/ (pow k m) k) (/ 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 (k <= 0.00112) {
tmp = a_m * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (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 (k <= 0.00112d0) then
tmp = a_m * (k ** m)
else
tmp = ((k ** m) / k) * (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 (k <= 0.00112) {
tmp = a_m * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (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 k <= 0.00112: tmp = a_m * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (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 (k <= 0.00112) tmp = Float64(a_m * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * 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 (k <= 0.00112) tmp = a_m * (k ^ m); else tmp = ((k ^ m) / k) * (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[k, 0.00112], N[(a$95$m * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * 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}\;k \leq 0.00112:\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a\_m}{k}\\
\end{array}
\end{array}
if k < 0.0011199999999999999Initial program 92.7%
associate-*l/90.5%
sqr-neg90.5%
associate-+l+90.5%
sqr-neg90.5%
distribute-rgt-out90.5%
Simplified90.5%
Taylor expanded in k around 0 99.8%
if 0.0011199999999999999 < k Initial program 80.9%
associate-*l/74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
*-commutative74.4%
clear-num74.5%
un-div-inv74.5%
+-commutative74.5%
fma-define74.5%
+-commutative74.5%
Applied egg-rr74.5%
Taylor expanded in k around inf 74.5%
+-commutative74.5%
unpow274.5%
distribute-rgt-in74.5%
Simplified74.5%
associate-/l*85.7%
associate-/r/93.4%
Applied egg-rr93.4%
Taylor expanded in k around inf 93.1%
Final simplification97.8%
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 -6.5e+32)
(/ a_m t_0)
(if (<= m 9e+16) (/ a_m (+ 1.0 t_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 t_0 = k * (k + 10.0);
double tmp;
if (m <= -6.5e+32) {
tmp = a_m / t_0;
} else if (m <= 9e+16) {
tmp = a_m / (1.0 + t_0);
} else {
tmp = a_m + (-10.0 * (a_m * k));
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-6.5d+32)) then
tmp = a_m / t_0
else if (m <= 9d+16) then
tmp = a_m / (1.0d0 + t_0)
else
tmp = a_m + ((-10.0d0) * (a_m * k))
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -6.5e+32) {
tmp = a_m / t_0;
} else if (m <= 9e+16) {
tmp = a_m / (1.0 + t_0);
} else {
tmp = a_m + (-10.0 * (a_m * k));
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -6.5e+32: tmp = a_m / t_0 elif m <= 9e+16: tmp = a_m / (1.0 + t_0) else: tmp = a_m + (-10.0 * (a_m * k)) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -6.5e+32) tmp = Float64(a_m / t_0); elseif (m <= 9e+16) tmp = Float64(a_m / Float64(1.0 + t_0)); else tmp = Float64(a_m + Float64(-10.0 * Float64(a_m * k))); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -6.5e+32) tmp = a_m / t_0; elseif (m <= 9e+16) tmp = a_m / (1.0 + t_0); else tmp = a_m + (-10.0 * (a_m * k)); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, N[(a$95$s * If[LessEqual[m, -6.5e+32], N[(a$95$m / t$95$0), $MachinePrecision], If[LessEqual[m, 9e+16], N[(a$95$m / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $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 := k \cdot \left(k + 10\right)\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;m \leq -6.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{a\_m}{t\_0}\\
\mathbf{elif}\;m \leq 9 \cdot 10^{+16}:\\
\;\;\;\;\frac{a\_m}{1 + t\_0}\\
\mathbf{else}:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
\end{array}
if m < -6.4999999999999994e32Initial 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-define100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in k around inf 85.9%
+-commutative85.9%
unpow285.9%
distribute-rgt-in85.9%
Simplified85.9%
Taylor expanded in m around 0 52.3%
if -6.4999999999999994e32 < m < 9e16Initial program 93.9%
associate-*l/92.8%
sqr-neg92.8%
associate-+l+92.8%
sqr-neg92.8%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 83.0%
if 9e16 < m Initial program 76.1%
associate-*l/67.4%
sqr-neg67.4%
associate-+l+67.4%
sqr-neg67.4%
distribute-rgt-out67.4%
Simplified67.4%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 9.3%
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 (or (<= k -7.2e+149) (not (<= k 0.0115)))
(/ 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 ((k <= -7.2e+149) || !(k <= 0.0115)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m + (-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 ((k <= (-7.2d+149)) .or. (.not. (k <= 0.0115d0))) then
tmp = a_m / (k * (k + 10.0d0))
else
tmp = a_m + ((-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 ((k <= -7.2e+149) || !(k <= 0.0115)) {
tmp = a_m / (k * (k + 10.0));
} else {
tmp = a_m + (-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 (k <= -7.2e+149) or not (k <= 0.0115): tmp = a_m / (k * (k + 10.0)) else: tmp = a_m + (-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 ((k <= -7.2e+149) || !(k <= 0.0115)) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); else tmp = Float64(a_m + 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 ((k <= -7.2e+149) || ~((k <= 0.0115))) tmp = a_m / (k * (k + 10.0)); else tmp = a_m + (-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[Or[LessEqual[k, -7.2e+149], N[Not[LessEqual[k, 0.0115]], $MachinePrecision]], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $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 -7.2 \cdot 10^{+149} \lor \neg \left(k \leq 0.0115\right):\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if k < -7.1999999999999999e149 or 0.0115 < k Initial program 72.9%
associate-*l/68.0%
sqr-neg68.0%
associate-+l+68.0%
sqr-neg68.0%
distribute-rgt-out68.0%
Simplified68.0%
*-commutative68.0%
clear-num68.0%
un-div-inv68.0%
+-commutative68.0%
fma-define68.0%
+-commutative68.0%
Applied egg-rr68.0%
Taylor expanded in k around inf 68.0%
+-commutative68.0%
unpow268.0%
distribute-rgt-in68.0%
Simplified68.0%
Taylor expanded in m around 0 54.2%
if -7.1999999999999999e149 < k < 0.0115Initial program 100.0%
associate-*l/97.4%
sqr-neg97.4%
associate-+l+97.4%
sqr-neg97.4%
distribute-rgt-out97.4%
Simplified97.4%
Taylor expanded in m around 0 35.2%
Taylor expanded in k around 0 35.2%
Final simplification42.8%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k -2.1e+152)
(/ a_m (* k (+ k 10.0)))
(if (<= k 0.0115) (+ a_m (* -10.0 (* a_m k))) (/ (/ 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 <= -2.1e+152) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 0.0115) {
tmp = a_m + (-10.0 * (a_m * k));
} 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 <= (-2.1d+152)) then
tmp = a_m / (k * (k + 10.0d0))
else if (k <= 0.0115d0) then
tmp = a_m + ((-10.0d0) * (a_m * k))
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 <= -2.1e+152) {
tmp = a_m / (k * (k + 10.0));
} else if (k <= 0.0115) {
tmp = a_m + (-10.0 * (a_m * k));
} 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 <= -2.1e+152: tmp = a_m / (k * (k + 10.0)) elif k <= 0.0115: tmp = a_m + (-10.0 * (a_m * k)) 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 <= -2.1e+152) tmp = Float64(a_m / Float64(k * Float64(k + 10.0))); elseif (k <= 0.0115) tmp = Float64(a_m + Float64(-10.0 * Float64(a_m * k))); 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 <= -2.1e+152) tmp = a_m / (k * (k + 10.0)); elseif (k <= 0.0115) tmp = a_m + (-10.0 * (a_m * k)); 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, -2.1e+152], N[(a$95$m / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.0115], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $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 -2.1 \cdot 10^{+152}:\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 0.0115:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a\_m}{k}}{k + 10}\\
\end{array}
\end{array}
if k < -2.1000000000000002e152Initial program 50.0%
associate-*l/50.0%
sqr-neg50.0%
associate-+l+50.0%
sqr-neg50.0%
distribute-rgt-out50.0%
Simplified50.0%
*-commutative50.0%
clear-num50.0%
un-div-inv50.0%
+-commutative50.0%
fma-define50.0%
+-commutative50.0%
Applied egg-rr50.0%
Taylor expanded in k around inf 50.0%
+-commutative50.0%
unpow250.0%
distribute-rgt-in50.0%
Simplified50.0%
Taylor expanded in m around 0 50.8%
if -2.1000000000000002e152 < k < 0.0115Initial program 100.0%
associate-*l/97.4%
sqr-neg97.4%
associate-+l+97.4%
sqr-neg97.4%
distribute-rgt-out97.4%
Simplified97.4%
Taylor expanded in m around 0 35.2%
Taylor expanded in k around 0 35.2%
if 0.0115 < k Initial program 80.7%
associate-*l/74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
*-commutative74.1%
clear-num74.1%
un-div-inv74.1%
+-commutative74.1%
fma-define74.1%
+-commutative74.1%
Applied egg-rr74.1%
Taylor expanded in k around inf 74.1%
+-commutative74.1%
unpow274.1%
distribute-rgt-in74.1%
Simplified74.1%
Taylor expanded in m around 0 55.4%
associate-/r*59.3%
+-commutative59.3%
Simplified59.3%
Final simplification44.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 -7.6e-41) (/ 0.1 (/ k a_m)) (+ 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 <= -7.6e-41) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m + (-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 <= (-7.6d-41)) then
tmp = 0.1d0 / (k / a_m)
else
tmp = a_m + ((-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 <= -7.6e-41) {
tmp = 0.1 / (k / a_m);
} else {
tmp = a_m + (-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 <= -7.6e-41: tmp = 0.1 / (k / a_m) else: tmp = a_m + (-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 <= -7.6e-41) tmp = Float64(0.1 / Float64(k / a_m)); else tmp = Float64(a_m + 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 <= -7.6e-41) tmp = 0.1 / (k / a_m); else tmp = a_m + (-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, -7.6e-41], N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $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 -7.6 \cdot 10^{-41}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < -7.59999999999999958e-41Initial program 98.9%
associate-*l/98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 42.0%
Taylor expanded in k around 0 18.7%
*-commutative18.7%
Simplified18.7%
Taylor expanded in k around inf 26.1%
clear-num26.7%
un-div-inv26.7%
Applied egg-rr26.7%
if -7.59999999999999958e-41 < m Initial program 84.4%
associate-*l/79.2%
sqr-neg79.2%
associate-+l+79.2%
sqr-neg79.2%
distribute-rgt-out79.2%
Simplified79.2%
Taylor expanded in m around 0 43.1%
Taylor expanded in k around 0 33.9%
Final simplification31.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 -7.6e-41) (* (/ a_m k) 0.1) 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 <= -7.6e-41) {
tmp = (a_m / k) * 0.1;
} 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 (m <= (-7.6d-41)) then
tmp = (a_m / k) * 0.1d0
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 (m <= -7.6e-41) {
tmp = (a_m / k) * 0.1;
} 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 m <= -7.6e-41: tmp = (a_m / k) * 0.1 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 (m <= -7.6e-41) tmp = Float64(Float64(a_m / k) * 0.1); 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 (m <= -7.6e-41) tmp = (a_m / k) * 0.1; 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[LessEqual[m, -7.6e-41], N[(N[(a$95$m / k), $MachinePrecision] * 0.1), $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}\;m \leq -7.6 \cdot 10^{-41}:\\
\;\;\;\;\frac{a\_m}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\_m\\
\end{array}
\end{array}
if m < -7.59999999999999958e-41Initial program 98.9%
associate-*l/98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 42.0%
Taylor expanded in k around 0 18.7%
*-commutative18.7%
Simplified18.7%
Taylor expanded in k around inf 26.1%
if -7.59999999999999958e-41 < m Initial program 84.4%
associate-*l/79.2%
sqr-neg79.2%
associate-+l+79.2%
sqr-neg79.2%
distribute-rgt-out79.2%
Simplified79.2%
Taylor expanded in m around 0 43.1%
Taylor expanded in k around 0 31.3%
Final simplification29.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 -7.6e-41) (/ 0.1 (/ k a_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 <= -7.6e-41) {
tmp = 0.1 / (k / a_m);
} 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 (m <= (-7.6d-41)) then
tmp = 0.1d0 / (k / a_m)
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 (m <= -7.6e-41) {
tmp = 0.1 / (k / a_m);
} 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 m <= -7.6e-41: tmp = 0.1 / (k / a_m) 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 (m <= -7.6e-41) tmp = Float64(0.1 / Float64(k / a_m)); 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 (m <= -7.6e-41) tmp = 0.1 / (k / a_m); 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[LessEqual[m, -7.6e-41], N[(0.1 / N[(k / a$95$m), $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}\;m \leq -7.6 \cdot 10^{-41}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\mathbf{else}:\\
\;\;\;\;a\_m\\
\end{array}
\end{array}
if m < -7.59999999999999958e-41Initial program 98.9%
associate-*l/98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 42.0%
Taylor expanded in k around 0 18.7%
*-commutative18.7%
Simplified18.7%
Taylor expanded in k around inf 26.1%
clear-num26.7%
un-div-inv26.7%
Applied egg-rr26.7%
if -7.59999999999999958e-41 < m Initial program 84.4%
associate-*l/79.2%
sqr-neg79.2%
associate-+l+79.2%
sqr-neg79.2%
distribute-rgt-out79.2%
Simplified79.2%
Taylor expanded in m around 0 43.1%
Taylor expanded in k around 0 31.3%
Final simplification29.8%
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.2%
associate-*l/85.7%
sqr-neg85.7%
associate-+l+85.7%
sqr-neg85.7%
distribute-rgt-out85.7%
Simplified85.7%
Taylor expanded in m around 0 42.8%
Taylor expanded in k around 0 22.8%
Final simplification22.8%
herbie shell --seed 2024035
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))