
(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 9 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 (if (<= k 4.5e-7) (* a (pow k m)) (/ 1.0 (/ k (* a (pow k (+ m -1.0)))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 4.5e-7) {
tmp = a * pow(k, m);
} else {
tmp = 1.0 / (k / (a * pow(k, (m + -1.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 <= 4.5d-7) then
tmp = a * (k ** m)
else
tmp = 1.0d0 / (k / (a * (k ** (m + (-1.0d0)))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 4.5e-7) {
tmp = a * Math.pow(k, m);
} else {
tmp = 1.0 / (k / (a * Math.pow(k, (m + -1.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 4.5e-7: tmp = a * math.pow(k, m) else: tmp = 1.0 / (k / (a * math.pow(k, (m + -1.0)))) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 4.5e-7) tmp = Float64(a * (k ^ m)); else tmp = Float64(1.0 / Float64(k / Float64(a * (k ^ Float64(m + -1.0))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 4.5e-7) tmp = a * (k ^ m); else tmp = 1.0 / (k / (a * (k ^ (m + -1.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 4.5e-7], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(k / N[(a * N[Power[k, N[(m + -1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.5 \cdot 10^{-7}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{k}{a \cdot {k}^{\left(m + -1\right)}}}\\
\end{array}
\end{array}
if k < 4.4999999999999998e-7Initial program 95.6%
sqr-neg95.6%
associate-+l+95.6%
sqr-neg95.6%
distribute-rgt-out95.6%
Simplified95.6%
Taylor expanded in k around 0 99.5%
if 4.4999999999999998e-7 < k Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
add-sqr-sqrt85.9%
times-frac84.9%
+-commutative84.9%
fma-def84.9%
+-commutative84.9%
+-commutative84.9%
fma-def84.9%
+-commutative84.9%
Applied egg-rr84.9%
*-commutative84.9%
associate-*r/85.9%
associate-/l*84.9%
Simplified84.9%
Taylor expanded in k around inf 84.9%
Taylor expanded in k around inf 96.8%
clear-num95.4%
inv-pow95.4%
pow195.4%
pow-div95.4%
Applied egg-rr95.4%
unpow-195.4%
associate-/r*98.5%
sub-neg98.5%
metadata-eval98.5%
Simplified98.5%
Final simplification99.1%
(FPCore (a k m) :precision binary64 (if (<= k 4.5e-7) (* a (pow k m)) (* (pow k (+ m -1.0)) (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 4.5e-7) {
tmp = a * pow(k, m);
} else {
tmp = pow(k, (m + -1.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 (k <= 4.5d-7) then
tmp = a * (k ** m)
else
tmp = (k ** (m + (-1.0d0))) * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 4.5e-7) {
tmp = a * Math.pow(k, m);
} else {
tmp = Math.pow(k, (m + -1.0)) * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 4.5e-7: tmp = a * math.pow(k, m) else: tmp = math.pow(k, (m + -1.0)) * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 4.5e-7) tmp = Float64(a * (k ^ m)); else tmp = Float64((k ^ Float64(m + -1.0)) * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 4.5e-7) tmp = a * (k ^ m); else tmp = (k ^ (m + -1.0)) * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 4.5e-7], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[Power[k, N[(m + -1.0), $MachinePrecision]], $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.5 \cdot 10^{-7}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;{k}^{\left(m + -1\right)} \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 4.4999999999999998e-7Initial program 95.6%
sqr-neg95.6%
associate-+l+95.6%
sqr-neg95.6%
distribute-rgt-out95.6%
Simplified95.6%
Taylor expanded in k around 0 99.5%
if 4.4999999999999998e-7 < k Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
add-sqr-sqrt85.9%
times-frac84.9%
+-commutative84.9%
fma-def84.9%
+-commutative84.9%
+-commutative84.9%
fma-def84.9%
+-commutative84.9%
Applied egg-rr84.9%
*-commutative84.9%
associate-*r/85.9%
associate-/l*84.9%
Simplified84.9%
Taylor expanded in k around inf 84.9%
Taylor expanded in k around inf 96.8%
div-inv96.8%
clear-num96.8%
pow196.8%
pow-div96.8%
Applied egg-rr96.8%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.15e-6) (not (<= m 3.15e-6))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.15e-6) || !(m <= 3.15e-6)) {
tmp = a * pow(k, m);
} 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 <= (-1.15d-6)) .or. (.not. (m <= 3.15d-6))) then
tmp = a * (k ** m)
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 <= -1.15e-6) || !(m <= 3.15e-6)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.15e-6) or not (m <= 3.15e-6): tmp = a * math.pow(k, m) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.15e-6) || !(m <= 3.15e-6)) tmp = Float64(a * (k ^ m)); 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 <= -1.15e-6) || ~((m <= 3.15e-6))) tmp = a * (k ^ m); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.15e-6], N[Not[LessEqual[m, 3.15e-6]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $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 -1.15 \cdot 10^{-6} \lor \neg \left(m \leq 3.15 \cdot 10^{-6}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.15e-6 or 3.14999999999999991e-6 < m Initial program 91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in k around 0 100.0%
if -1.15e-6 < m < 3.14999999999999991e-6Initial program 94.1%
sqr-neg94.1%
associate-+l+94.1%
sqr-neg94.1%
distribute-rgt-out94.1%
Simplified94.1%
Taylor expanded in m around 0 94.1%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (<= m -23.5) (/ (/ 1.0 k) (/ k a)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -23.5) {
tmp = (1.0 / k) / (k / 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 <= (-23.5d0)) then
tmp = (1.0d0 / k) / (k / 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 <= -23.5) {
tmp = (1.0 / k) / (k / a);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -23.5: tmp = (1.0 / k) / (k / a) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -23.5) tmp = Float64(Float64(1.0 / k) / Float64(k / 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 <= -23.5) tmp = (1.0 / k) / (k / a); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -23.5], N[(N[(1.0 / k), $MachinePrecision] / N[(k / a), $MachinePrecision]), $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 -23.5:\\
\;\;\;\;\frac{\frac{1}{k}}{\frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -23.5Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
add-sqr-sqrt100.0%
times-frac100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
+-commutative100.0%
fma-def100.0%
+-commutative100.0%
Applied egg-rr100.0%
*-commutative100.0%
associate-*r/100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in k around inf 85.9%
Taylor expanded in k around inf 100.0%
Taylor expanded in m around 0 52.0%
if -23.5 < m Initial program 86.9%
sqr-neg86.9%
associate-+l+86.9%
sqr-neg86.9%
distribute-rgt-out86.9%
Simplified86.9%
Taylor expanded in m around 0 47.1%
Final simplification49.0%
(FPCore (a k m) :precision binary64 (if (<= m -4.1e-19) (* (/ a k) 0.1) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e-19) {
tmp = (a / k) * 0.1;
} 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 <= (-4.1d-19)) then
tmp = (a / k) * 0.1d0
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 <= -4.1e-19) {
tmp = (a / k) * 0.1;
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.1e-19: tmp = (a / k) * 0.1 else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.1e-19) tmp = Float64(Float64(a / k) * 0.1); 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 <= -4.1e-19) tmp = (a / k) * 0.1; else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.1e-19], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.1 \cdot 10^{-19}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -4.09999999999999985e-19Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 40.1%
Taylor expanded in k around 0 15.9%
*-commutative15.9%
Simplified15.9%
Taylor expanded in k around inf 24.7%
if -4.09999999999999985e-19 < m Initial program 86.7%
sqr-neg86.7%
associate-+l+86.7%
sqr-neg86.7%
distribute-rgt-out86.7%
Simplified86.7%
Taylor expanded in m around 0 46.7%
Taylor expanded in k around 0 27.3%
Final simplification26.3%
(FPCore (a k m) :precision binary64 (if (<= m -23.5) (* (/ a k) 0.1) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -23.5) {
tmp = (a / k) * 0.1;
} 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 (m <= (-23.5d0)) then
tmp = (a / k) * 0.1d0
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 (m <= -23.5) {
tmp = (a / k) * 0.1;
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -23.5: tmp = (a / k) * 0.1 else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -23.5) tmp = Float64(Float64(a / k) * 0.1); 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 (m <= -23.5) tmp = (a / k) * 0.1; else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -23.5], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -23.5:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -23.5Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 15.2%
*-commutative15.2%
Simplified15.2%
Taylor expanded in k around inf 24.3%
if -23.5 < m Initial program 86.9%
sqr-neg86.9%
associate-+l+86.9%
sqr-neg86.9%
distribute-rgt-out86.9%
Simplified86.9%
Taylor expanded in m around 0 47.1%
Taylor expanded in k around 0 33.2%
*-commutative33.2%
Simplified33.2%
Final simplification29.8%
(FPCore (a k m) :precision binary64 (if (<= m -2e-204) (/ (/ 1.0 k) (/ k a)) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2e-204) {
tmp = (1.0 / k) / (k / a);
} 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 (m <= (-2d-204)) then
tmp = (1.0d0 / k) / (k / a)
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 (m <= -2e-204) {
tmp = (1.0 / k) / (k / a);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2e-204: tmp = (1.0 / k) / (k / a) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2e-204) tmp = Float64(Float64(1.0 / k) / Float64(k / a)); 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 (m <= -2e-204) tmp = (1.0 / k) / (k / a); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2e-204], N[(N[(1.0 / k), $MachinePrecision] / N[(k / a), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2 \cdot 10^{-204}:\\
\;\;\;\;\frac{\frac{1}{k}}{\frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -2e-204Initial program 98.0%
sqr-neg98.0%
associate-+l+98.0%
sqr-neg98.0%
distribute-rgt-out98.0%
Simplified98.0%
add-sqr-sqrt98.0%
times-frac98.0%
+-commutative98.0%
fma-def98.0%
+-commutative98.0%
+-commutative98.0%
fma-def98.0%
+-commutative98.0%
Applied egg-rr98.0%
*-commutative98.0%
associate-*r/98.0%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in k around inf 79.8%
Taylor expanded in k around inf 92.6%
Taylor expanded in m around 0 55.1%
if -2e-204 < m Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 37.4%
Taylor expanded in k around 0 30.0%
*-commutative30.0%
Simplified30.0%
Final simplification42.6%
(FPCore (a k m) :precision binary64 (if (<= m -4.1e-19) (* (/ a k) 0.1) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e-19) {
tmp = (a / k) * 0.1;
} 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 (m <= (-4.1d-19)) then
tmp = (a / k) * 0.1d0
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e-19) {
tmp = (a / k) * 0.1;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.1e-19: tmp = (a / k) * 0.1 else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.1e-19) tmp = Float64(Float64(a / k) * 0.1); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.1e-19) tmp = (a / k) * 0.1; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.1e-19], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.1 \cdot 10^{-19}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -4.09999999999999985e-19Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 40.1%
Taylor expanded in k around 0 15.9%
*-commutative15.9%
Simplified15.9%
Taylor expanded in k around inf 24.7%
if -4.09999999999999985e-19 < m Initial program 86.7%
sqr-neg86.7%
associate-+l+86.7%
sqr-neg86.7%
distribute-rgt-out86.7%
Simplified86.7%
Taylor expanded in m around 0 46.7%
Taylor expanded in k around 0 26.1%
Final simplification25.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 92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
Simplified92.0%
Taylor expanded in m around 0 44.1%
Taylor expanded in k around 0 17.4%
Final simplification17.4%
herbie shell --seed 2023308
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))