
(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 8 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))) (if (<= k 4.5e-6) t_0 (/ (/ t_0 k) k))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (k <= 4.5e-6) {
tmp = t_0;
} else {
tmp = (t_0 / k) / 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) :: t_0
real(8) :: tmp
t_0 = (k ** m) * a
if (k <= 4.5d-6) then
tmp = t_0
else
tmp = (t_0 / k) / k
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 tmp;
if (k <= 4.5e-6) {
tmp = t_0;
} else {
tmp = (t_0 / k) / k;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if k <= 4.5e-6: tmp = t_0 else: tmp = (t_0 / k) / k return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (k <= 4.5e-6) tmp = t_0; else tmp = Float64(Float64(t_0 / k) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (k <= 4.5e-6) tmp = t_0; else tmp = (t_0 / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[k, 4.5e-6], t$95$0, N[(N[(t$95$0 / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;k \leq 4.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{k}}{k}\\
\end{array}
\end{array}
if k < 4.50000000000000011e-6Initial program 95.1%
associate-/l*95.1%
remove-double-neg95.1%
distribute-frac-neg295.1%
distribute-neg-frac295.1%
remove-double-neg95.1%
sqr-neg95.1%
associate-+l+95.1%
sqr-neg95.1%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in k around 0 99.7%
*-commutative99.7%
Simplified99.7%
if 4.50000000000000011e-6 < k Initial program 82.5%
*-commutative82.5%
associate-/l*82.5%
remove-double-neg82.5%
distribute-frac-neg82.5%
distribute-frac-neg82.5%
remove-double-neg82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-define82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in k around inf 82.5%
pow282.5%
associate-*r/82.5%
*-commutative82.5%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.0038) (not (<= m 1.65e-10))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.0038) || !(m <= 1.65e-10)) {
tmp = pow(k, m) * a;
} else {
tmp = a / (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 <= (-0.0038d0)) .or. (.not. (m <= 1.65d-10))) then
tmp = (k ** m) * a
else
tmp = a / (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 <= -0.0038) || !(m <= 1.65e-10)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.0038) or not (m <= 1.65e-10): tmp = math.pow(k, m) * a else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.0038) || !(m <= 1.65e-10)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / 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 <= -0.0038) || ~((m <= 1.65e-10))) tmp = (k ^ m) * a; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.0038], N[Not[LessEqual[m, 1.65e-10]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0038 \lor \neg \left(m \leq 1.65 \cdot 10^{-10}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.00379999999999999999 or 1.65e-10 < m Initial program 87.0%
associate-/l*87.0%
remove-double-neg87.0%
distribute-frac-neg287.0%
distribute-neg-frac287.0%
remove-double-neg87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.0%
Simplified87.0%
Taylor expanded in k around 0 98.8%
*-commutative98.8%
Simplified98.8%
if -0.00379999999999999999 < m < 1.65e-10Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 95.5%
Final simplification97.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.3) (/ a (+ 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 <= 2.3) {
tmp = a / (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 <= 2.3d0) then
tmp = a / (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 <= 2.3) {
tmp = a / (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 <= 2.3: tmp = a / (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 <= 2.3) tmp = Float64(a / 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 <= 2.3) tmp = a / (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, 2.3], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $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 2.3:\\
\;\;\;\;\frac{a}{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 < 2.2999999999999998Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 66.0%
if 2.2999999999999998 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 24.1%
Taylor expanded in a around 0 32.2%
Final simplification55.2%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ 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.1) {
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.1d0) 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.1) {
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.1: 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.1) 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.1) 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.1], 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.1:\\
\;\;\;\;\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.10000000000000009Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 66.0%
Taylor expanded in k around 0 39.9%
*-commutative39.9%
Simplified39.9%
if 2.10000000000000009 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 24.1%
Taylor expanded in k around inf 24.1%
mul-1-neg24.1%
distribute-lft-in11.9%
*-commutative11.9%
*-commutative11.9%
distribute-neg-in11.9%
distribute-lft-neg-in11.9%
*-commutative11.9%
distribute-lft-neg-in11.9%
distribute-rgt-in24.1%
distribute-neg-in24.1%
*-commutative24.1%
distribute-rgt1-in24.1%
metadata-eval24.1%
*-commutative24.1%
distribute-rgt-neg-in24.1%
metadata-eval24.1%
Simplified24.1%
Final simplification34.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ 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.1) {
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.1d0) 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.1) {
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.1: 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.1) 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.1) 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.1], 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.1:\\
\;\;\;\;\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 < 2.10000000000000009Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 66.0%
if 2.10000000000000009 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 24.1%
Taylor expanded in k around inf 24.1%
mul-1-neg24.1%
distribute-lft-in11.9%
*-commutative11.9%
*-commutative11.9%
distribute-neg-in11.9%
distribute-lft-neg-in11.9%
*-commutative11.9%
distribute-lft-neg-in11.9%
distribute-rgt-in24.1%
distribute-neg-in24.1%
*-commutative24.1%
distribute-rgt1-in24.1%
metadata-eval24.1%
*-commutative24.1%
distribute-rgt-neg-in24.1%
metadata-eval24.1%
Simplified24.1%
Final simplification52.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.15e+43) (/ a (+ 1.0 (* k 10.0))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e+43) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-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 <= 2.15d+43) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e+43) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.15e+43: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.15e+43) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.15e+43) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.15e+43], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.15 \cdot 10^{+43}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 2.15e43Initial program 97.8%
associate-/l*97.8%
remove-double-neg97.8%
distribute-frac-neg297.8%
distribute-neg-frac297.8%
remove-double-neg97.8%
sqr-neg97.8%
associate-+l+97.8%
sqr-neg97.8%
distribute-rgt-out97.8%
Simplified97.8%
Taylor expanded in m around 0 63.6%
Taylor expanded in k around 0 38.5%
*-commutative38.5%
Simplified38.5%
if 2.15e43 < m Initial program 73.3%
associate-/l*73.3%
remove-double-neg73.3%
distribute-frac-neg273.3%
distribute-neg-frac273.3%
remove-double-neg73.3%
sqr-neg73.3%
associate-+l+73.3%
sqr-neg73.3%
distribute-rgt-out73.3%
Simplified73.3%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.5%
Final simplification30.0%
(FPCore (a k m) :precision binary64 (+ a (* -10.0 (* k a))))
double code(double a, double k, double m) {
return a + (-10.0 * (k * 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 + ((-10.0d0) * (k * a))
end function
public static double code(double a, double k, double m) {
return a + (-10.0 * (k * a));
}
def code(a, k, m): return a + (-10.0 * (k * a))
function code(a, k, m) return Float64(a + Float64(-10.0 * Float64(k * a))) end
function tmp = code(a, k, m) tmp = a + (-10.0 * (k * a)); end
code[a_, k_, m_] := N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a + -10 \cdot \left(k \cdot a\right)
\end{array}
Initial program 90.7%
associate-/l*90.6%
remove-double-neg90.6%
distribute-frac-neg290.6%
distribute-neg-frac290.6%
remove-double-neg90.6%
sqr-neg90.6%
associate-+l+90.6%
sqr-neg90.6%
distribute-rgt-out90.6%
Simplified90.6%
Taylor expanded in m around 0 45.9%
Taylor expanded in k around 0 20.5%
Final simplification20.5%
(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 90.7%
associate-/l*90.6%
remove-double-neg90.6%
distribute-frac-neg290.6%
distribute-neg-frac290.6%
remove-double-neg90.6%
sqr-neg90.6%
associate-+l+90.6%
sqr-neg90.6%
distribute-rgt-out90.6%
Simplified90.6%
Taylor expanded in m around 0 45.9%
Taylor expanded in k around 0 19.4%
Final simplification19.4%
herbie shell --seed 2024075
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))