
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -3.15e-80)
(/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k)))
(if (<= m 1e-17)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))
t_0))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -3.15e-80) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else if (m <= 1e-17) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if (m <= (-3.15d-80)) then
tmp = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
else if (m <= 1d-17) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if (m <= -3.15e-80) {
tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k));
} else if (m <= 1e-17) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= -3.15e-80: tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)) elif m <= 1e-17: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -3.15e-80) tmp = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); elseif (m <= 1e-17) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= -3.15e-80) tmp = t_0 / ((1.0 + (k * 10.0)) + (k * k)); elseif (m <= 1e-17) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -3.15e-80], N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1e-17], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -3.15 \cdot 10^{-80}:\\
\;\;\;\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{elif}\;m \leq 10^{-17}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -3.14999999999999983e-80Initial program 100.0%
if -3.14999999999999983e-80 < m < 1.00000000000000007e-17Initial program 92.0%
associate-/l*91.9%
remove-double-neg91.9%
distribute-frac-neg291.9%
distribute-neg-frac291.9%
remove-double-neg91.9%
sqr-neg91.9%
associate-+l+91.9%
sqr-neg91.9%
distribute-rgt-out91.9%
Simplified91.9%
Taylor expanded in m around 0 91.9%
associate-*r/92.0%
clear-num91.8%
+-commutative91.8%
fma-define91.8%
+-commutative91.8%
*-rgt-identity91.8%
Applied egg-rr91.8%
Taylor expanded in k around 0 99.3%
if 1.00000000000000007e-17 < m Initial program 78.9%
associate-/l*78.9%
remove-double-neg78.9%
distribute-frac-neg278.9%
distribute-neg-frac278.9%
remove-double-neg78.9%
sqr-neg78.9%
associate-+l+78.9%
sqr-neg78.9%
distribute-rgt-out78.9%
Simplified78.9%
Taylor expanded in k around 0 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (a k m)
:precision binary64
(if (<= m -1.02e-81)
(* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0)))))
(if (<= m 1e-17)
(/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))
(* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.02e-81) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else if (m <= 1e-17) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.02d-81)) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else if (m <= 1d-17) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.02e-81) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else if (m <= 1e-17) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.02e-81: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) elif m <= 1e-17: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.02e-81) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); elseif (m <= 1e-17) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.02e-81) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); elseif (m <= 1e-17) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.02e-81], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1e-17], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.02 \cdot 10^{-81}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 10^{-17}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.01999999999999998e-81Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
if -1.01999999999999998e-81 < m < 1.00000000000000007e-17Initial program 92.0%
associate-/l*91.9%
remove-double-neg91.9%
distribute-frac-neg291.9%
distribute-neg-frac291.9%
remove-double-neg91.9%
sqr-neg91.9%
associate-+l+91.9%
sqr-neg91.9%
distribute-rgt-out91.9%
Simplified91.9%
Taylor expanded in m around 0 91.9%
associate-*r/92.0%
clear-num91.8%
+-commutative91.8%
fma-define91.8%
+-commutative91.8%
*-rgt-identity91.8%
Applied egg-rr91.8%
Taylor expanded in k around 0 99.3%
if 1.00000000000000007e-17 < m Initial program 78.9%
associate-/l*78.9%
remove-double-neg78.9%
distribute-frac-neg278.9%
distribute-neg-frac278.9%
remove-double-neg78.9%
sqr-neg78.9%
associate-+l+78.9%
sqr-neg78.9%
distribute-rgt-out78.9%
Simplified78.9%
Taylor expanded in k around 0 99.6%
*-commutative99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -2100000000000.0) (not (<= m 1e-17))) (* a (pow k m)) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2100000000000.0) || !(m <= 1e-17)) {
tmp = a * pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-2100000000000.0d0)) .or. (.not. (m <= 1d-17))) then
tmp = a * (k ** m)
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -2100000000000.0) || !(m <= 1e-17)) {
tmp = a * Math.pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -2100000000000.0) or not (m <= 1e-17): tmp = a * math.pow(k, m) else: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -2100000000000.0) || !(m <= 1e-17)) tmp = Float64(a * (k ^ m)); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -2100000000000.0) || ~((m <= 1e-17))) tmp = a * (k ^ m); else tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -2100000000000.0], N[Not[LessEqual[m, 1e-17]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2100000000000 \lor \neg \left(m \leq 10^{-17}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\end{array}
\end{array}
if m < -2.1e12 or 1.00000000000000007e-17 < m Initial program 89.9%
associate-/l*89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-neg-frac289.9%
remove-double-neg89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out89.9%
Simplified89.9%
Taylor expanded in k around 0 99.8%
*-commutative99.8%
Simplified99.8%
if -2.1e12 < m < 1.00000000000000007e-17Initial program 92.9%
associate-/l*92.8%
remove-double-neg92.8%
distribute-frac-neg292.8%
distribute-neg-frac292.8%
remove-double-neg92.8%
sqr-neg92.8%
associate-+l+92.8%
sqr-neg92.8%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 92.8%
associate-*r/92.9%
clear-num92.7%
+-commutative92.7%
fma-define92.7%
+-commutative92.7%
*-rgt-identity92.7%
Applied egg-rr92.7%
Taylor expanded in k around 0 99.3%
Final simplification99.6%
(FPCore (a k m) :precision binary64 (if (<= m 78.0) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a))))) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 78.0) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 78.0d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
else
tmp = a * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 78.0) {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 78.0: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 78.0) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 78.0) tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 78.0], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 78:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 78Initial program 96.2%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.1%
Simplified96.1%
Taylor expanded in m around 0 66.1%
associate-*r/66.2%
clear-num66.4%
+-commutative66.4%
fma-define66.4%
+-commutative66.4%
*-rgt-identity66.4%
Applied egg-rr66.4%
Taylor expanded in k around 0 67.9%
if 78 < m Initial program 78.1%
associate-/l*78.1%
remove-double-neg78.1%
distribute-frac-neg278.1%
distribute-neg-frac278.1%
remove-double-neg78.1%
sqr-neg78.1%
associate-+l+78.1%
sqr-neg78.1%
distribute-rgt-out78.1%
Simplified78.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 29.3%
Final simplification56.9%
(FPCore (a k m) :precision binary64 (if (or (<= k -2.1e+83) (not (<= k 3.5e-7))) (* 0.1 (/ a k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2.1e+83) || !(k <= 3.5e-7)) {
tmp = 0.1 * (a / k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-2.1d+83)) .or. (.not. (k <= 3.5d-7))) then
tmp = 0.1d0 * (a / k)
else
tmp = a * (1.0d0 + (k * (-10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -2.1e+83) || !(k <= 3.5e-7)) {
tmp = 0.1 * (a / k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2.1e+83) or not (k <= 3.5e-7): tmp = 0.1 * (a / k) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2.1e+83) || !(k <= 3.5e-7)) tmp = Float64(0.1 * Float64(a / k)); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -2.1e+83) || ~((k <= 3.5e-7))) tmp = 0.1 * (a / k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2.1e+83], N[Not[LessEqual[k, 3.5e-7]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.1 \cdot 10^{+83} \lor \neg \left(k \leq 3.5 \cdot 10^{-7}\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < -2.10000000000000002e83 or 3.49999999999999984e-7 < k Initial program 80.2%
*-commutative80.2%
Simplified80.2%
Taylor expanded in m around 0 60.8%
Taylor expanded in k around 0 21.5%
*-commutative21.5%
Simplified21.5%
Taylor expanded in k around inf 21.5%
if -2.10000000000000002e83 < k < 3.49999999999999984e-7Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 37.8%
Taylor expanded in k around 0 37.8%
Final simplification30.4%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.1) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.1d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.1) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.1: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.1) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.1) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.1], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.1:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.10000000000000009Initial program 96.2%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.1%
Simplified96.1%
Taylor expanded in m around 0 66.5%
if 2.10000000000000009 < m Initial program 78.4%
associate-/l*78.4%
remove-double-neg78.4%
distribute-frac-neg278.4%
distribute-neg-frac278.4%
remove-double-neg78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 28.9%
Final simplification55.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.0d0) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 96.2%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.1%
Simplified96.1%
Taylor expanded in m around 0 66.5%
associate-*r/66.5%
clear-num66.8%
+-commutative66.8%
fma-define66.8%
+-commutative66.8%
*-rgt-identity66.8%
Applied egg-rr66.8%
Taylor expanded in a around 0 66.8%
if 2 < m Initial program 78.4%
associate-/l*78.4%
remove-double-neg78.4%
distribute-frac-neg278.4%
distribute-neg-frac278.4%
remove-double-neg78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 28.9%
Final simplification55.8%
(FPCore (a k m) :precision binary64 (if (or (<= k -2.7e+80) (not (<= k 1.9e-7))) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2.7e+80) || !(k <= 1.9e-7)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= (-2.7d+80)) .or. (.not. (k <= 1.9d-7))) then
tmp = 0.1d0 * (a / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -2.7e+80) || !(k <= 1.9e-7)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2.7e+80) or not (k <= 1.9e-7): tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2.7e+80) || !(k <= 1.9e-7)) tmp = Float64(0.1 * Float64(a / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -2.7e+80) || ~((k <= 1.9e-7))) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2.7e+80], N[Not[LessEqual[k, 1.9e-7]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.7 \cdot 10^{+80} \lor \neg \left(k \leq 1.9 \cdot 10^{-7}\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -2.69999999999999983e80 or 1.90000000000000007e-7 < k Initial program 80.2%
*-commutative80.2%
Simplified80.2%
Taylor expanded in m around 0 60.8%
Taylor expanded in k around 0 21.5%
*-commutative21.5%
Simplified21.5%
Taylor expanded in k around inf 21.5%
if -2.69999999999999983e80 < k < 1.90000000000000007e-7Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 37.8%
Taylor expanded in k around 0 37.8%
Final simplification30.4%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ 1.0 (* k 10.0))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.2d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in m around 0 66.5%
Taylor expanded in k around 0 41.4%
*-commutative41.4%
Simplified41.4%
if 2.2000000000000002 < m Initial program 78.4%
associate-/l*78.4%
remove-double-neg78.4%
distribute-frac-neg278.4%
distribute-neg-frac278.4%
remove-double-neg78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 26.4%
cancel-sign-sub-inv26.4%
mul-1-neg26.4%
distribute-rgt1-in26.4%
metadata-eval26.4%
metadata-eval26.4%
*-commutative26.4%
Simplified26.4%
Taylor expanded in k around inf 26.4%
Final simplification37.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ 1.0 (* k 10.0))) (+ a (* k (* k (* a 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.2d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + (k * (k * (a * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (k * (k * (a * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (k * (k * (a * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 96.2%
*-commutative96.2%
Simplified96.2%
Taylor expanded in m around 0 66.5%
Taylor expanded in k around 0 41.4%
*-commutative41.4%
Simplified41.4%
if 2.2000000000000002 < m Initial program 78.4%
associate-/l*78.4%
remove-double-neg78.4%
distribute-frac-neg278.4%
distribute-neg-frac278.4%
remove-double-neg78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 26.4%
cancel-sign-sub-inv26.4%
mul-1-neg26.4%
distribute-rgt1-in26.4%
metadata-eval26.4%
metadata-eval26.4%
*-commutative26.4%
Simplified26.4%
Taylor expanded in k around inf 26.4%
associate-*r*26.4%
*-commutative26.4%
metadata-eval26.4%
distribute-rgt-neg-in26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
metadata-eval26.4%
Simplified26.4%
Final simplification37.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* k (* a 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (k * (a * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (k * (a * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (k * (a * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 96.2%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.1%
Simplified96.1%
Taylor expanded in m around 0 66.5%
if 2 < m Initial program 78.4%
associate-/l*78.4%
remove-double-neg78.4%
distribute-frac-neg278.4%
distribute-neg-frac278.4%
remove-double-neg78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 26.4%
cancel-sign-sub-inv26.4%
mul-1-neg26.4%
distribute-rgt1-in26.4%
metadata-eval26.4%
metadata-eval26.4%
*-commutative26.4%
Simplified26.4%
Taylor expanded in k around inf 26.4%
associate-*r*26.4%
*-commutative26.4%
metadata-eval26.4%
distribute-rgt-neg-in26.4%
*-commutative26.4%
distribute-rgt-neg-in26.4%
metadata-eval26.4%
Simplified26.4%
Final simplification54.9%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k 10.0))))
double code(double a, double k, double m) {
return a / (1.0 + (k * 10.0));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a / (1.0d0 + (k * 10.0d0))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * 10.0));
}
def code(a, k, m): return a / (1.0 + (k * 10.0))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * 10.0))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * 10.0)); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot 10}
\end{array}
Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 48.2%
Taylor expanded in k around 0 30.4%
*-commutative30.4%
Simplified30.4%
Final simplification30.4%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 91.0%
associate-/l*91.0%
remove-double-neg91.0%
distribute-frac-neg291.0%
distribute-neg-frac291.0%
remove-double-neg91.0%
sqr-neg91.0%
associate-+l+91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
Simplified91.0%
Taylor expanded in m around 0 48.2%
Taylor expanded in k around 0 22.8%
Final simplification22.8%
herbie shell --seed 2024074
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))