
(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 (if (<= m -3e+29) (* (pow k m) a) (if (<= m 7e-7) (/ a (+ 1.0 (* k (+ k 10.0)))) (/ a (pow k (- m))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3e+29) {
tmp = pow(k, m) * a;
} else if (m <= 7e-7) {
tmp = a / (1.0 + (k * (k + 10.0)));
} 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 <= (-3d+29)) then
tmp = (k ** m) * a
else if (m <= 7d-7) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
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 <= -3e+29) {
tmp = Math.pow(k, m) * a;
} else if (m <= 7e-7) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a / Math.pow(k, -m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3e+29: tmp = math.pow(k, m) * a elif m <= 7e-7: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a / math.pow(k, -m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3e+29) tmp = Float64((k ^ m) * a); elseif (m <= 7e-7) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3e+29) tmp = (k ^ m) * a; elseif (m <= 7e-7) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a / (k ^ -m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3e+29], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], If[LessEqual[m, 7e-7], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3 \cdot 10^{+29}:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{elif}\;m \leq 7 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < -2.9999999999999999e29Initial 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 k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -2.9999999999999999e29 < m < 6.99999999999999968e-7Initial program 72.0%
associate-/l*72.0%
remove-double-neg72.0%
distribute-frac-neg272.0%
distribute-neg-frac272.0%
remove-double-neg72.0%
sqr-neg72.0%
associate-+l+72.0%
sqr-neg72.0%
distribute-rgt-out72.0%
Simplified72.0%
Taylor expanded in m around 0 95.6%
if 6.99999999999999968e-7 < m Initial program 73.8%
associate-/l*73.8%
remove-double-neg73.8%
distribute-frac-neg273.8%
distribute-neg-frac273.8%
remove-double-neg73.8%
sqr-neg73.8%
associate-+l+73.8%
sqr-neg73.8%
distribute-rgt-out73.8%
Simplified73.8%
clear-num73.8%
un-div-inv73.8%
+-commutative73.8%
+-commutative73.8%
fma-undefine73.8%
Applied egg-rr73.8%
Taylor expanded in k around 0 97.8%
Taylor expanded in k around inf 61.5%
rec-exp61.5%
mul-1-neg61.5%
remove-double-neg61.5%
log-rec61.5%
*-commutative61.5%
distribute-lft-neg-in61.5%
distribute-rgt-neg-out61.5%
exp-to-pow97.8%
Simplified97.8%
Final simplification97.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -3e+29) (not (<= m 1.18e-8))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3e+29) || !(m <= 1.18e-8)) {
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 <= (-3d+29)) .or. (.not. (m <= 1.18d-8))) 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 <= -3e+29) || !(m <= 1.18e-8)) {
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 <= -3e+29) or not (m <= 1.18e-8): 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 <= -3e+29) || !(m <= 1.18e-8)) 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 <= -3e+29) || ~((m <= 1.18e-8))) 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, -3e+29], N[Not[LessEqual[m, 1.18e-8]], $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 -3 \cdot 10^{+29} \lor \neg \left(m \leq 1.18 \cdot 10^{-8}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -2.9999999999999999e29 or 1.18e-8 < m Initial program 85.6%
associate-/l*85.6%
remove-double-neg85.6%
distribute-frac-neg285.6%
distribute-neg-frac285.6%
remove-double-neg85.6%
sqr-neg85.6%
associate-+l+85.6%
sqr-neg85.6%
distribute-rgt-out85.6%
Simplified85.6%
Taylor expanded in k around 0 98.8%
*-commutative98.8%
Simplified98.8%
if -2.9999999999999999e29 < m < 1.18e-8Initial program 72.0%
associate-/l*72.0%
remove-double-neg72.0%
distribute-frac-neg272.0%
distribute-neg-frac272.0%
remove-double-neg72.0%
sqr-neg72.0%
associate-+l+72.0%
sqr-neg72.0%
distribute-rgt-out72.0%
Simplified72.0%
Taylor expanded in m around 0 95.6%
Final simplification97.6%
(FPCore (a k m) :precision binary64 (if (<= m 1.85) (/ 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 <= 1.85) {
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 <= 1.85d0) 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 <= 1.85) {
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 <= 1.85: 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 <= 1.85) 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 <= 1.85) 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, 1.85], 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 1.85:\\
\;\;\;\;\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 < 1.8500000000000001Initial program 84.1%
associate-/l*84.2%
remove-double-neg84.2%
distribute-frac-neg284.2%
distribute-neg-frac284.2%
remove-double-neg84.2%
sqr-neg84.2%
associate-+l+84.2%
sqr-neg84.2%
distribute-rgt-out84.2%
Simplified84.2%
Taylor expanded in m around 0 71.8%
if 1.8500000000000001 < 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%
flip-+58.1%
associate-/r/58.1%
metadata-eval58.1%
pow258.1%
+-commutative58.1%
+-commutative58.1%
Applied egg-rr58.1%
associate-*l/58.1%
associate-/l*58.1%
Simplified58.1%
Taylor expanded in m around 0 5.5%
associate-/l*2.2%
+-commutative2.2%
*-commutative2.2%
+-commutative2.2%
*-commutative2.2%
unpow22.2%
unpow22.2%
swap-sqr2.2%
unpow22.2%
Simplified2.2%
Taylor expanded in k around 0 36.1%
Final simplification59.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.4) (/ a (+ 1.0 (* k 10.0))) (+ a (* k (* 99.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.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.4d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + (k * (99.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.4: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (k * (99.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.4) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.4) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (k * (99.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.4], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 84.1%
associate-/l*84.2%
remove-double-neg84.2%
distribute-frac-neg284.2%
distribute-neg-frac284.2%
remove-double-neg84.2%
sqr-neg84.2%
associate-+l+84.2%
sqr-neg84.2%
distribute-rgt-out84.2%
Simplified84.2%
Taylor expanded in m around 0 71.8%
Taylor expanded in k around 0 47.4%
*-commutative47.4%
Simplified47.4%
if 2.39999999999999991 < 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 2.7%
Taylor expanded in k around 0 28.5%
cancel-sign-sub-inv28.5%
metadata-eval28.5%
mul-1-neg28.5%
distribute-rgt1-in28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in k around inf 28.5%
Final simplification41.0%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 99.0 (* k a))))))
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 * (99.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.1d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (99.0d0 * (k * a)))
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 * (99.0 * (k * a)));
}
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 * (99.0 * (k * a))) 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(99.0 * Float64(k * a)))); 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 * (99.0 * (k * a))); 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[(99.0 * N[(k * a), $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(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 2.10000000000000009Initial program 84.1%
associate-/l*84.2%
remove-double-neg84.2%
distribute-frac-neg284.2%
distribute-neg-frac284.2%
remove-double-neg84.2%
sqr-neg84.2%
associate-+l+84.2%
sqr-neg84.2%
distribute-rgt-out84.2%
Simplified84.2%
Taylor expanded in m around 0 71.8%
if 2.10000000000000009 < 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 2.7%
Taylor expanded in k around 0 28.5%
cancel-sign-sub-inv28.5%
metadata-eval28.5%
mul-1-neg28.5%
distribute-rgt1-in28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in k around inf 28.5%
Final simplification57.3%
(FPCore (a k m) :precision binary64 (if (<= m 190000000.0) (/ a (+ 1.0 (* k 10.0))) (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 190000000.0) {
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 <= 190000000.0d0) 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 <= 190000000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 190000000.0: 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 <= 190000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 190000000.0) 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, 190000000.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 190000000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 1.9e8Initial program 83.5%
associate-/l*83.5%
remove-double-neg83.5%
distribute-frac-neg283.5%
distribute-neg-frac283.5%
remove-double-neg83.5%
sqr-neg83.5%
associate-+l+83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
Simplified83.5%
Taylor expanded in m around 0 69.9%
Taylor expanded in k around 0 46.1%
*-commutative46.1%
Simplified46.1%
if 1.9e8 < m Initial program 74.1%
associate-/l*74.1%
remove-double-neg74.1%
distribute-frac-neg274.1%
distribute-neg-frac274.1%
remove-double-neg74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 7.2%
Taylor expanded in k around inf 14.9%
Final simplification36.2%
(FPCore (a k m) :precision binary64 (if (<= m 1.95e+26) a (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95e+26) {
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 <= 1.95d+26) 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 <= 1.95e+26) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95e+26: tmp = a else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95e+26) tmp = a; else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95e+26) tmp = a; else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95e+26], a, N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95 \cdot 10^{+26}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 1.95e26Initial program 83.9%
associate-/l*83.9%
remove-double-neg83.9%
distribute-frac-neg283.9%
distribute-neg-frac283.9%
remove-double-neg83.9%
sqr-neg83.9%
associate-+l+83.9%
sqr-neg83.9%
distribute-rgt-out83.9%
Simplified83.9%
Taylor expanded in m around 0 68.0%
Taylor expanded in k around 0 26.2%
if 1.95e26 < m Initial program 72.4%
associate-/l*72.4%
remove-double-neg72.4%
distribute-frac-neg272.4%
distribute-neg-frac272.4%
remove-double-neg72.4%
sqr-neg72.4%
associate-+l+72.4%
sqr-neg72.4%
distribute-rgt-out72.4%
Simplified72.4%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 7.5%
Taylor expanded in k around inf 15.6%
Final simplification23.1%
(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 80.5%
associate-/l*80.5%
remove-double-neg80.5%
distribute-frac-neg280.5%
distribute-neg-frac280.5%
remove-double-neg80.5%
sqr-neg80.5%
associate-+l+80.5%
sqr-neg80.5%
distribute-rgt-out80.5%
Simplified80.5%
Taylor expanded in m around 0 48.6%
Taylor expanded in k around 0 19.6%
Final simplification19.6%
herbie shell --seed 2024061
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))