
(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 10 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))) 5e+274)
(* (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 tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+274) {
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) :: tmp
t_0 = a_m * (k ** m)
if ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 5d+274) 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 tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+274) {
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) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+274: 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)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 5e+274) 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); tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+274) 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]}, 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], 5e+274], 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}\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+274}:\\
\;\;\;\;{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))) < 4.9999999999999998e274Initial program 99.1%
associate-*l/98.6%
sqr-neg98.6%
associate-+l+98.6%
sqr-neg98.6%
distribute-rgt-out98.6%
Simplified98.6%
if 4.9999999999999998e274 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 70.7%
associate-*l/65.5%
sqr-neg65.5%
associate-+l+65.5%
sqr-neg65.5%
distribute-rgt-out65.5%
Simplified65.5%
Taylor expanded in k around 0 98.3%
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
(if (or (<= m -3.5e-14) (not (<= m 0.185)))
(* 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 <= -3.5e-14) || !(m <= 0.185)) {
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 <= (-3.5d-14)) .or. (.not. (m <= 0.185d0))) 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 <= -3.5e-14) || !(m <= 0.185)) {
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 <= -3.5e-14) or not (m <= 0.185): 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 <= -3.5e-14) || !(m <= 0.185)) 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 <= -3.5e-14) || ~((m <= 0.185))) 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, -3.5e-14], N[Not[LessEqual[m, 0.185]], $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 -3.5 \cdot 10^{-14} \lor \neg \left(m \leq 0.185\right):\\
\;\;\;\;a\_m \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.5000000000000002e-14 or 0.185 < m Initial program 90.8%
associate-*l/88.7%
sqr-neg88.7%
associate-+l+88.7%
sqr-neg88.7%
distribute-rgt-out88.7%
Simplified88.7%
Taylor expanded in k around 0 98.9%
if -3.5000000000000002e-14 < m < 0.185Initial program 97.5%
associate-*l/97.5%
sqr-neg97.5%
associate-+l+97.5%
sqr-neg97.5%
distribute-rgt-out97.5%
Simplified97.5%
Taylor expanded in m around 0 97.4%
Final simplification98.5%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(*
a_s
(if (<= m -3.9e+34)
(/ a_m t_0)
(if (<= m 52000.0) (/ 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 <= -3.9e+34) {
tmp = a_m / t_0;
} else if (m <= 52000.0) {
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 <= (-3.9d+34)) then
tmp = a_m / t_0
else if (m <= 52000.0d0) 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 <= -3.9e+34) {
tmp = a_m / t_0;
} else if (m <= 52000.0) {
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 <= -3.9e+34: tmp = a_m / t_0 elif m <= 52000.0: 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 <= -3.9e+34) tmp = Float64(a_m / t_0); elseif (m <= 52000.0) 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 <= -3.9e+34) tmp = a_m / t_0; elseif (m <= 52000.0) 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, -3.9e+34], N[(a$95$m / t$95$0), $MachinePrecision], If[LessEqual[m, 52000.0], 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 -3.9 \cdot 10^{+34}:\\
\;\;\;\;\frac{a\_m}{t\_0}\\
\mathbf{elif}\;m \leq 52000:\\
\;\;\;\;\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 < -3.90000000000000019e34Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
*-commutative100.0%
clear-num100.0%
un-div-inv100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in k around inf 76.7%
unpow276.7%
distribute-rgt-in76.7%
Simplified76.7%
Taylor expanded in m around 0 40.0%
if -3.90000000000000019e34 < m < 52000Initial program 97.7%
associate-*l/97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
Taylor expanded in m around 0 90.9%
if 52000 < m Initial program 80.9%
associate-*l/76.4%
sqr-neg76.4%
associate-+l+76.4%
sqr-neg76.4%
distribute-rgt-out76.4%
Simplified76.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 9.6%
Final simplification45.5%
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.1e-282) (not (<= k 0.075)))
(/ 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 <= 1.1e-282) || !(k <= 0.075)) {
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 <= 1.1d-282) .or. (.not. (k <= 0.075d0))) 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 <= 1.1e-282) || !(k <= 0.075)) {
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 <= 1.1e-282) or not (k <= 0.075): 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 <= 1.1e-282) || !(k <= 0.075)) 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 <= 1.1e-282) || ~((k <= 0.075))) 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, 1.1e-282], N[Not[LessEqual[k, 0.075]], $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 1.1 \cdot 10^{-282} \lor \neg \left(k \leq 0.075\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 < 1.09999999999999991e-282 or 0.0749999999999999972 < k Initial program 89.0%
associate-*l/86.6%
sqr-neg86.6%
associate-+l+86.6%
sqr-neg86.6%
distribute-rgt-out86.6%
Simplified86.6%
*-commutative86.6%
clear-num86.6%
un-div-inv86.6%
+-commutative86.6%
fma-def86.6%
+-commutative86.6%
Applied egg-rr86.6%
Taylor expanded in k around inf 68.3%
unpow268.3%
distribute-rgt-in68.3%
Simplified68.3%
Taylor expanded in m around 0 40.8%
if 1.09999999999999991e-282 < k < 0.0749999999999999972Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 41.0%
Taylor expanded in k around 0 40.4%
Final simplification40.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 1.06e-278) (not (<= k 0.12)))
(/ a_m (* 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.06e-278) || !(k <= 0.12)) {
tmp = a_m / (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.06d-278) .or. (.not. (k <= 0.12d0))) then
tmp = a_m / (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.06e-278) || !(k <= 0.12)) {
tmp = a_m / (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.06e-278) or not (k <= 0.12): tmp = a_m / (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.06e-278) || !(k <= 0.12)) tmp = Float64(a_m / 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.06e-278) || ~((k <= 0.12))) tmp = a_m / (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.06e-278], N[Not[LessEqual[k, 0.12]], $MachinePrecision]], N[(a$95$m / N[(k * N[(k + 10.0), $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.06 \cdot 10^{-278} \lor \neg \left(k \leq 0.12\right):\\
\;\;\;\;\frac{a\_m}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a\_m}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < 1.0600000000000001e-278 or 0.12 < k Initial program 89.0%
associate-*l/86.6%
sqr-neg86.6%
associate-+l+86.6%
sqr-neg86.6%
distribute-rgt-out86.6%
Simplified86.6%
*-commutative86.6%
clear-num86.6%
un-div-inv86.6%
+-commutative86.6%
fma-def86.6%
+-commutative86.6%
Applied egg-rr86.6%
Taylor expanded in k around inf 68.3%
unpow268.3%
distribute-rgt-in68.3%
Simplified68.3%
Taylor expanded in m around 0 40.8%
if 1.0600000000000001e-278 < k < 0.12Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 41.0%
Taylor expanded in k around 0 40.6%
*-commutative99.5%
Simplified40.6%
Final simplification40.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 3.5e-281) (not (<= k 0.122))) (* 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 <= 3.5e-281) || !(k <= 0.122)) {
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 <= 3.5d-281) .or. (.not. (k <= 0.122d0))) 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 <= 3.5e-281) || !(k <= 0.122)) {
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 <= 3.5e-281) or not (k <= 0.122): 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 <= 3.5e-281) || !(k <= 0.122)) 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 <= 3.5e-281) || ~((k <= 0.122))) 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, 3.5e-281], N[Not[LessEqual[k, 0.122]], $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 3.5 \cdot 10^{-281} \lor \neg \left(k \leq 0.122\right):\\
\;\;\;\;0.1 \cdot \frac{a\_m}{k}\\
\mathbf{else}:\\
\;\;\;\;a\_m\\
\end{array}
\end{array}
if k < 3.50000000000000022e-281 or 0.122 < k Initial program 88.9%
associate-*l/86.5%
sqr-neg86.5%
associate-+l+86.5%
sqr-neg86.5%
distribute-rgt-out86.5%
Simplified86.5%
Taylor expanded in k around 0 72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in k around inf 53.8%
associate-*r/53.8%
Simplified53.8%
Taylor expanded in m around 0 17.7%
if 3.50000000000000022e-281 < k < 0.122Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 40.6%
Taylor expanded in k around 0 39.5%
Final simplification25.1%
a_m = (fabs.f64 a)
a_s = (copysign.f64 1 a)
(FPCore (a_s a_m k m)
:precision binary64
(*
a_s
(if (<= k 1.1e-282)
(* 0.1 (/ a_m k))
(if (<= k 0.122) a_m (/ 0.1 (/ 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.1e-282) {
tmp = 0.1 * (a_m / k);
} else if (k <= 0.122) {
tmp = a_m;
} else {
tmp = 0.1 / (k / a_m);
}
return a_s * tmp;
}
a_m = abs(a)
a_s = copysign(1.0d0, a)
real(8) function code(a_s, a_m, k, m)
real(8), intent (in) :: a_s
real(8), intent (in) :: a_m
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.1d-282) then
tmp = 0.1d0 * (a_m / k)
else if (k <= 0.122d0) then
tmp = a_m
else
tmp = 0.1d0 / (k / a_m)
end if
code = a_s * tmp
end function
a_m = Math.abs(a);
a_s = Math.copySign(1.0, a);
public static double code(double a_s, double a_m, double k, double m) {
double tmp;
if (k <= 1.1e-282) {
tmp = 0.1 * (a_m / k);
} else if (k <= 0.122) {
tmp = a_m;
} else {
tmp = 0.1 / (k / a_m);
}
return a_s * tmp;
}
a_m = math.fabs(a) a_s = math.copysign(1.0, a) def code(a_s, a_m, k, m): tmp = 0 if k <= 1.1e-282: tmp = 0.1 * (a_m / k) elif k <= 0.122: tmp = a_m else: tmp = 0.1 / (k / a_m) return a_s * tmp
a_m = abs(a) a_s = copysign(1.0, a) function code(a_s, a_m, k, m) tmp = 0.0 if (k <= 1.1e-282) tmp = Float64(0.1 * Float64(a_m / k)); elseif (k <= 0.122) tmp = a_m; else tmp = Float64(0.1 / Float64(k / a_m)); end return Float64(a_s * tmp) end
a_m = abs(a); a_s = sign(a) * abs(1.0); function tmp_2 = code(a_s, a_m, k, m) tmp = 0.0; if (k <= 1.1e-282) tmp = 0.1 * (a_m / k); elseif (k <= 0.122) tmp = a_m; else tmp = 0.1 / (k / a_m); end tmp_2 = a_s * tmp; end
a_m = N[Abs[a], $MachinePrecision]
a_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[a]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[a$95$s_, a$95$m_, k_, m_] := N[(a$95$s * If[LessEqual[k, 1.1e-282], N[(0.1 * N[(a$95$m / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.122], a$95$m, N[(0.1 / N[(k / a$95$m), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
a_m = \left|a\right|
\\
a_s = \mathsf{copysign}\left(1, a\right)
\\
a\_s \cdot \begin{array}{l}
\mathbf{if}\;k \leq 1.1 \cdot 10^{-282}:\\
\;\;\;\;0.1 \cdot \frac{a\_m}{k}\\
\mathbf{elif}\;k \leq 0.122:\\
\;\;\;\;a\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a\_m}}\\
\end{array}
\end{array}
if k < 1.09999999999999991e-282Initial program 89.5%
associate-*l/87.4%
sqr-neg87.4%
associate-+l+87.4%
sqr-neg87.4%
distribute-rgt-out87.4%
Simplified87.4%
Taylor expanded in k around 0 80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in k around inf 47.4%
associate-*r/47.4%
Simplified47.4%
Taylor expanded in m around 0 12.4%
if 1.09999999999999991e-282 < k < 0.122Initial program 99.9%
associate-*l/99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 40.6%
Taylor expanded in k around 0 39.5%
if 0.122 < k Initial program 88.1%
associate-*l/85.4%
sqr-neg85.4%
associate-+l+85.4%
sqr-neg85.4%
distribute-rgt-out85.4%
Simplified85.4%
Taylor expanded in k around 0 63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in k around inf 62.0%
associate-*r/62.0%
Simplified62.0%
Taylor expanded in m around 0 24.4%
clear-num26.0%
un-div-inv26.0%
Applied egg-rr26.0%
Final simplification25.5%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= m -0.000105) (* 0.1 (/ a_m k)) (+ 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 <= -0.000105) {
tmp = 0.1 * (a_m / k);
} 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 <= (-0.000105d0)) then
tmp = 0.1d0 * (a_m / k)
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 <= -0.000105) {
tmp = 0.1 * (a_m / k);
} 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 <= -0.000105: tmp = 0.1 * (a_m / k) 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 <= -0.000105) tmp = Float64(0.1 * Float64(a_m / k)); 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 <= -0.000105) tmp = 0.1 * (a_m / k); 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, -0.000105], N[(0.1 * N[(a$95$m / k), $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 -0.000105:\\
\;\;\;\;0.1 \cdot \frac{a\_m}{k}\\
\mathbf{else}:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\end{array}
\end{array}
if m < -1.05e-4Initial 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%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around inf 76.3%
associate-*r/76.3%
Simplified76.3%
Taylor expanded in m around 0 23.0%
if -1.05e-4 < m Initial program 88.5%
associate-*l/86.0%
sqr-neg86.0%
associate-+l+86.0%
sqr-neg86.0%
distribute-rgt-out86.0%
Simplified86.0%
Taylor expanded in m around 0 44.9%
Taylor expanded in k around 0 26.5%
Final simplification25.2%
a_m = (fabs.f64 a) a_s = (copysign.f64 1 a) (FPCore (a_s a_m k m) :precision binary64 (* a_s (if (<= k 0.075) (+ a_m (* -10.0 (* a_m k))) (/ 1.0 (/ k (* a_m 0.1))))))
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.075) {
tmp = a_m + (-10.0 * (a_m * k));
} else {
tmp = 1.0 / (k / (a_m * 0.1));
}
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.075d0) then
tmp = a_m + ((-10.0d0) * (a_m * k))
else
tmp = 1.0d0 / (k / (a_m * 0.1d0))
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.075) {
tmp = a_m + (-10.0 * (a_m * k));
} else {
tmp = 1.0 / (k / (a_m * 0.1));
}
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.075: tmp = a_m + (-10.0 * (a_m * k)) else: tmp = 1.0 / (k / (a_m * 0.1)) 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.075) tmp = Float64(a_m + Float64(-10.0 * Float64(a_m * k))); else tmp = Float64(1.0 / Float64(k / Float64(a_m * 0.1))); 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.075) tmp = a_m + (-10.0 * (a_m * k)); else tmp = 1.0 / (k / (a_m * 0.1)); 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.075], N[(a$95$m + N[(-10.0 * N[(a$95$m * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(k / N[(a$95$m * 0.1), $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.075:\\
\;\;\;\;a\_m + -10 \cdot \left(a\_m \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{k}{a\_m \cdot 0.1}}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 94.4%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
Taylor expanded in m around 0 29.7%
Taylor expanded in k around 0 24.6%
if 0.0749999999999999972 < k Initial program 88.3%
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 63.7%
*-commutative63.7%
Simplified63.7%
Taylor expanded in k around inf 62.5%
associate-*r/62.5%
Simplified62.5%
Taylor expanded in m around 0 24.2%
associate-*r/24.2%
clear-num26.7%
*-commutative26.7%
Applied egg-rr26.7%
Final simplification25.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 92.6%
associate-*l/91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in m around 0 40.5%
Taylor expanded in k around 0 16.4%
Final simplification16.4%
herbie shell --seed 2024041
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))