
(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 14 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 (* (pow k m) a)) (t_1 (/ 1.0 t_0))) (if (<= k 1e-129) t_0 (/ 1.0 (+ t_1 (* k (+ (* 10.0 t_1) (/ k t_0))))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-129) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / 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) :: t_1
real(8) :: tmp
t_0 = (k ** m) * a
t_1 = 1.0d0 / t_0
if (k <= 1d-129) then
tmp = t_0
else
tmp = 1.0d0 / (t_1 + (k * ((10.0d0 * t_1) + (k / t_0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-129) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a t_1 = 1.0 / t_0 tmp = 0 if k <= 1e-129: tmp = t_0 else: tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))) return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 1e-129) tmp = t_0; else tmp = Float64(1.0 / Float64(t_1 + Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / t_0))))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 1e-129) tmp = t_0; else tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 1e-129], t$95$0, N[(1.0 / N[(t$95$1 + N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 10^{-129}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right)}\\
\end{array}
\end{array}
if k < 9.9999999999999993e-130Initial program 98.5%
associate-/l*98.5%
remove-double-neg98.5%
distribute-frac-neg298.5%
distribute-neg-frac298.5%
remove-double-neg98.5%
sqr-neg98.5%
associate-+l+98.5%
sqr-neg98.5%
distribute-rgt-out98.5%
Simplified98.5%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 9.9999999999999993e-130 < k Initial program 83.4%
associate-/l*83.4%
remove-double-neg83.4%
distribute-frac-neg283.4%
distribute-neg-frac283.4%
remove-double-neg83.4%
sqr-neg83.4%
associate-+l+83.4%
sqr-neg83.4%
distribute-rgt-out83.4%
Simplified83.4%
distribute-lft-in83.4%
associate-+l+83.4%
associate-*r/83.4%
clear-num83.4%
associate-+l+83.4%
distribute-lft-in83.4%
+-commutative83.4%
fma-define83.4%
+-commutative83.4%
*-commutative83.4%
Applied egg-rr83.4%
Taylor expanded in k around 0 99.9%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = pow(k, m) * 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 <= 9.5d-10) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 9.5e-10) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (pow(k, m) / (1.0 + (k * k)));
} else {
tmp = pow(k, m) * 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 <= 9.5d-10) then
tmp = a * ((k ** m) / (1.0d0 + (k * k)))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * k)));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a * (math.pow(k, m) / (1.0 + (k * k))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * k)))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 9.5e-10) tmp = a * ((k ^ m) / (1.0 + (k * k))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in k around inf 95.5%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.3e-9) (not (<= m 9.5e-10))) (* (pow k m) a) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.3e-9) || !(m <= 9.5e-10)) {
tmp = pow(k, m) * a;
} else {
tmp = a * (1.0 / (1.0 + (k * (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 ((m <= (-1.3d-9)) .or. (.not. (m <= 9.5d-10))) then
tmp = (k ** m) * a
else
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1.3e-9) || !(m <= 9.5e-10)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.3e-9) or not (m <= 9.5e-10): tmp = math.pow(k, m) * a else: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.3e-9) || !(m <= 9.5e-10)) tmp = Float64((k ^ m) * a); else tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.3e-9) || ~((m <= 9.5e-10))) tmp = (k ^ m) * a; else tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.3e-9], N[Not[LessEqual[m, 9.5e-10]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.3 \cdot 10^{-9} \lor \neg \left(m \leq 9.5 \cdot 10^{-10}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.3000000000000001e-9 or 9.50000000000000028e-10 < m Initial program 90.0%
associate-/l*90.0%
remove-double-neg90.0%
distribute-frac-neg290.0%
distribute-neg-frac290.0%
remove-double-neg90.0%
sqr-neg90.0%
associate-+l+90.0%
sqr-neg90.0%
distribute-rgt-out90.0%
Simplified90.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.3000000000000001e-9 < m < 9.50000000000000028e-10Initial program 93.7%
associate-/l*93.8%
remove-double-neg93.8%
distribute-frac-neg293.8%
distribute-neg-frac293.8%
remove-double-neg93.8%
sqr-neg93.8%
associate-+l+93.8%
sqr-neg93.8%
distribute-rgt-out93.8%
Simplified93.8%
Taylor expanded in m around 0 93.5%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (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 <= 9.5d-10) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + (a * (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 <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(a * 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 <= 9.5e-10) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 61.6%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 23.2%
Taylor expanded in a around 0 26.0%
Final simplification48.0%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (k * 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 <= 9.5d-10) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 9.5e-10) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 61.6%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 23.2%
Taylor expanded in a around 0 26.0%
Taylor expanded in k around inf 26.0%
*-commutative26.0%
Simplified26.0%
Final simplification48.0%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 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 <= 9.5d-10) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 9.5e-10) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 61.6%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 23.2%
Taylor expanded in a around 0 26.0%
Taylor expanded in k around inf 26.0%
*-commutative26.0%
Simplified26.0%
Final simplification48.0%
(FPCore (a k m) :precision binary64 (if (<= m 9.5e-10) (* a (/ 1.0 (+ 1.0 (* k k)))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = a + (a * (k * (k * 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 <= 9.5d-10) then
tmp = a * (1.0d0 / (1.0d0 + (k * k)))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 9.5e-10) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9.5e-10: tmp = a * (1.0 / (1.0 + (k * k))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9.5e-10) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * k)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 9.5e-10) tmp = a * (1.0 / (1.0 + (k * k))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9.5e-10], N[(a * N[(1.0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9.5 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 9.50000000000000028e-10Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 61.6%
Taylor expanded in k around inf 60.2%
if 9.50000000000000028e-10 < m Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 4.5%
Taylor expanded in k around 0 23.2%
Taylor expanded in a around 0 26.0%
Taylor expanded in k around inf 26.0%
*-commutative26.0%
Simplified26.0%
(FPCore (a k m) :precision binary64 (if (<= m 920000000000.0) (* a (/ 1.0 (+ 1.0 (* k k)))) (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 920000000000.0) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = k * (a * -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 <= 920000000000.0d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * k)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 920000000000.0) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 920000000000.0: tmp = a * (1.0 / (1.0 + (k * k))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 920000000000.0) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * k)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 920000000000.0) tmp = a * (1.0 / (1.0 + (k * k))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 920000000000.0], N[(a * N[(1.0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 920000000000:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 9.2e11Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 60.3%
Taylor expanded in k around inf 58.9%
if 9.2e11 < m Initial program 81.5%
associate-/l*81.5%
remove-double-neg81.5%
distribute-frac-neg281.5%
distribute-neg-frac281.5%
remove-double-neg81.5%
sqr-neg81.5%
associate-+l+81.5%
sqr-neg81.5%
distribute-rgt-out81.5%
Simplified81.5%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.1%
Taylor expanded in k around inf 25.1%
associate-*r*25.1%
*-commutative25.1%
*-commutative25.1%
Simplified25.1%
(FPCore (a k m) :precision binary64 (if (<= m 920000000000.0) (/ a (+ 1.0 (* k k))) (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 920000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = k * (a * -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 <= 920000000000.0d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 920000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 920000000000.0: tmp = a / (1.0 + (k * k)) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 920000000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 920000000000.0) tmp = a / (1.0 + (k * k)); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 920000000000.0], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 920000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 9.2e11Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in m around 0 60.3%
Taylor expanded in k around inf 58.9%
if 9.2e11 < m Initial program 81.5%
associate-/l*81.5%
remove-double-neg81.5%
distribute-frac-neg281.5%
distribute-neg-frac281.5%
remove-double-neg81.5%
sqr-neg81.5%
associate-+l+81.5%
sqr-neg81.5%
distribute-rgt-out81.5%
Simplified81.5%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.1%
Taylor expanded in k around inf 25.1%
associate-*r*25.1%
*-commutative25.1%
*-commutative25.1%
Simplified25.1%
(FPCore (a k m) :precision binary64 (if (<= m 8.5e+35) (/ a (+ 1.0 (* k 10.0))) (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.5e+35) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = k * (a * -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 <= 8.5d+35) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 8.5e+35) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 8.5e+35: tmp = a / (1.0 + (k * 10.0)) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 8.5e+35) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 8.5e+35) tmp = a / (1.0 + (k * 10.0)); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 8.5e+35], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.5 \cdot 10^{+35}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 8.4999999999999995e35Initial program 95.9%
associate-/l*96.0%
remove-double-neg96.0%
distribute-frac-neg296.0%
distribute-neg-frac296.0%
remove-double-neg96.0%
sqr-neg96.0%
associate-+l+96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
Simplified96.0%
Taylor expanded in m around 0 59.2%
Taylor expanded in k around 0 35.3%
*-commutative35.3%
Simplified35.3%
if 8.4999999999999995e35 < m Initial program 82.0%
associate-/l*82.0%
remove-double-neg82.0%
distribute-frac-neg282.0%
distribute-neg-frac282.0%
remove-double-neg82.0%
sqr-neg82.0%
associate-+l+82.0%
sqr-neg82.0%
distribute-rgt-out82.0%
Simplified82.0%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.2%
Taylor expanded in k around inf 25.8%
associate-*r*25.8%
*-commutative25.8%
*-commutative25.8%
Simplified25.8%
(FPCore (a k m) :precision binary64 (if (<= m 8.5e+35) a (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.5e+35) {
tmp = a;
} else {
tmp = k * (a * -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 <= 8.5d+35) then
tmp = a
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 8.5e+35) {
tmp = a;
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 8.5e+35: tmp = a else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 8.5e+35) tmp = a; else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 8.5e+35) tmp = a; else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 8.5e+35], a, N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.5 \cdot 10^{+35}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 8.4999999999999995e35Initial program 95.9%
associate-/l*96.0%
remove-double-neg96.0%
distribute-frac-neg296.0%
distribute-neg-frac296.0%
remove-double-neg96.0%
sqr-neg96.0%
associate-+l+96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
Simplified96.0%
Taylor expanded in m around 0 59.2%
Taylor expanded in k around 0 22.4%
if 8.4999999999999995e35 < m Initial program 82.0%
associate-/l*82.0%
remove-double-neg82.0%
distribute-frac-neg282.0%
distribute-neg-frac282.0%
remove-double-neg82.0%
sqr-neg82.0%
associate-+l+82.0%
sqr-neg82.0%
distribute-rgt-out82.0%
Simplified82.0%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.2%
Taylor expanded in k around inf 25.8%
associate-*r*25.8%
*-commutative25.8%
*-commutative25.8%
Simplified25.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.3e+36) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.3e+36) {
tmp = a;
} else {
tmp = -10.0 * (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 <= 1.3d+36) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.3e+36) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.3e+36: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.3e+36) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.3e+36) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.3e+36], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.3 \cdot 10^{+36}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.3000000000000001e36Initial program 95.9%
associate-/l*96.0%
remove-double-neg96.0%
distribute-frac-neg296.0%
distribute-neg-frac296.0%
remove-double-neg96.0%
sqr-neg96.0%
associate-+l+96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
Simplified96.0%
Taylor expanded in m around 0 59.2%
Taylor expanded in k around 0 22.4%
if 1.3000000000000001e36 < m Initial program 82.0%
associate-/l*82.0%
remove-double-neg82.0%
distribute-frac-neg282.0%
distribute-neg-frac282.0%
remove-double-neg82.0%
sqr-neg82.0%
associate-+l+82.0%
sqr-neg82.0%
distribute-rgt-out82.0%
Simplified82.0%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.2%
Taylor expanded in k around inf 25.8%
Final simplification23.6%
(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.1%
associate-/l*91.1%
remove-double-neg91.1%
distribute-frac-neg291.1%
distribute-neg-frac291.1%
remove-double-neg91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in m around 0 39.8%
Taylor expanded in k around 0 16.0%
herbie shell --seed 2024113
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))