
(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 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+229) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+229) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+229) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+229) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+229: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+229) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+229) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+229], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+229}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 2e229Initial program 98.1%
if 2e229 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 68.6%
associate-*l/60.8%
sqr-neg60.8%
associate-+l+60.8%
sqr-neg60.8%
distribute-rgt-out62.7%
Simplified62.7%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 6.1e-24) (* (pow k m) (/ a (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 6.1e-24) {
tmp = pow(k, m) * (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 <= 6.1d-24) then
tmp = (k ** m) * (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 <= 6.1e-24) {
tmp = Math.pow(k, m) * (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 <= 6.1e-24: tmp = math.pow(k, m) * (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 <= 6.1e-24) tmp = Float64((k ^ m) * Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6.1e-24) tmp = (k ^ m) * (a / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 6.1e-24], N[(N[Power[k, m], $MachinePrecision] * N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.1 \cdot 10^{-24}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 6.10000000000000036e-24Initial program 97.1%
associate-*l/97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.7%
Simplified97.7%
if 6.10000000000000036e-24 < m Initial program 83.1%
associate-*l/77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.15e-8) (not (<= m 6.1e-24))) (* a (pow k m)) (/ a (+ 1.0 (+ (* k 10.0) (* k k))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.15e-8) || !(m <= 6.1e-24)) {
tmp = a * pow(k, m);
} else {
tmp = a / (1.0 + ((k * 10.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) :: tmp
if ((m <= (-1.15d-8)) .or. (.not. (m <= 6.1d-24))) then
tmp = a * (k ** m)
else
tmp = a / (1.0d0 + ((k * 10.0d0) + (k * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1.15e-8) || !(m <= 6.1e-24)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / (1.0 + ((k * 10.0) + (k * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.15e-8) or not (m <= 6.1e-24): tmp = a * math.pow(k, m) else: tmp = a / (1.0 + ((k * 10.0) + (k * k))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.15e-8) || !(m <= 6.1e-24)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(1.0 + Float64(Float64(k * 10.0) + Float64(k * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.15e-8) || ~((m <= 6.1e-24))) tmp = a * (k ^ m); else tmp = a / (1.0 + ((k * 10.0) + (k * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.15e-8], N[Not[LessEqual[m, 6.1e-24]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(N[(k * 10.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.15 \cdot 10^{-8} \lor \neg \left(m \leq 6.1 \cdot 10^{-24}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + \left(k \cdot 10 + k \cdot k\right)}\\
\end{array}
\end{array}
if m < -1.15e-8 or 6.10000000000000036e-24 < m Initial program 90.6%
associate-*l/87.6%
sqr-neg87.6%
associate-+l+87.6%
sqr-neg87.6%
distribute-rgt-out88.2%
Simplified88.2%
Taylor expanded in k around 0 100.0%
if -1.15e-8 < m < 6.10000000000000036e-24Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in m around 0 95.5%
unpow295.5%
Applied egg-rr95.5%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m -1.5e+37) (* 0.1 (/ a k)) (if (<= m 2.5e+22) (/ a (+ 1.0 (* k 10.0))) (+ a (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.5e+37) {
tmp = 0.1 * (a / k);
} else if (m <= 2.5e+22) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.5d+37)) then
tmp = 0.1d0 * (a / k)
else if (m <= 2.5d+22) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.5e+37) {
tmp = 0.1 * (a / k);
} else if (m <= 2.5e+22) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.5e+37: tmp = 0.1 * (a / k) elif m <= 2.5e+22: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.5e+37) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 2.5e+22) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.5e+37) tmp = 0.1 * (a / k); elseif (m <= 2.5e+22) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.5e+37], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.5e+22], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.5 \cdot 10^{+37}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 2.5 \cdot 10^{+22}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.50000000000000011e37Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 30.7%
Taylor expanded in k around 0 14.3%
*-commutative14.3%
Simplified14.3%
Taylor expanded in k around inf 24.7%
if -1.50000000000000011e37 < m < 2.4999999999999998e22Initial program 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 88.6%
Taylor expanded in k around 0 54.0%
*-commutative54.0%
Simplified54.0%
if 2.4999999999999998e22 < m Initial program 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification31.7%
(FPCore (a k m) :precision binary64 (if (<= m 3.3e+23) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.3e+23) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3.3d+23) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.3e+23) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.3e+23: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.3e+23) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.3e+23) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.3e+23], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.3 \cdot 10^{+23}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 3.30000000000000029e23Initial program 97.2%
associate-*l/97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.8%
Simplified97.8%
Taylor expanded in a around 0 97.8%
+-commutative97.8%
distribute-lft-in97.2%
unpow297.2%
+-commutative97.2%
unpow297.2%
distribute-lft-in97.8%
fma-udef97.8%
associate-*r/97.8%
Simplified97.8%
Taylor expanded in m around 0 63.8%
un-div-inv63.8%
clear-num64.2%
+-commutative64.2%
+-commutative64.2%
fma-udef64.2%
Applied egg-rr64.2%
Taylor expanded in a around 0 64.2%
if 3.30000000000000029e23 < m Initial program 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification47.5%
(FPCore (a k m) :precision binary64 (if (<= m 2.3e+22) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.3e+22) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.3d+22) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.3e+22) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.3e+22: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.3e+22) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.3e+22) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.3e+22], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.3 \cdot 10^{+22}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 2.3000000000000002e22Initial program 97.2%
associate-*l/97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.8%
Simplified97.8%
Taylor expanded in m around 0 63.8%
if 2.3000000000000002e22 < m Initial program 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.7%
*-commutative10.7%
Simplified10.7%
Final simplification47.2%
(FPCore (a k m) :precision binary64 (if (<= m -1.35e-21) (* 0.1 (/ a k)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.35e-21) {
tmp = 0.1 * (a / k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.35d-21)) then
tmp = 0.1d0 * (a / k)
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.35e-21) {
tmp = 0.1 * (a / k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.35e-21: tmp = 0.1 * (a / k) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.35e-21) tmp = Float64(0.1 * Float64(a / k)); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.35e-21) tmp = 0.1 * (a / k); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.35e-21], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.35 \cdot 10^{-21}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.3500000000000001e-21Initial program 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in m around 0 32.2%
Taylor expanded in k around 0 13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 23.2%
if -1.3500000000000001e-21 < m Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in m around 0 50.3%
Taylor expanded in k around 0 27.8%
*-commutative27.8%
Simplified27.8%
Final simplification26.3%
(FPCore (a k m) :precision binary64 (if (<= m -1.35e-21) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.35e-21) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.35d-21)) then
tmp = 0.1d0 * (a / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.35e-21) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.35e-21: tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.35e-21) tmp = Float64(0.1 * Float64(a / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.35e-21) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.35e-21], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.35 \cdot 10^{-21}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -1.3500000000000001e-21Initial program 98.8%
*-commutative98.8%
Simplified98.8%
Taylor expanded in m around 0 32.2%
Taylor expanded in k around 0 13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 23.2%
if -1.3500000000000001e-21 < m Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in m around 0 50.3%
Taylor expanded in k around 0 25.6%
Final simplification24.8%
(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.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in m around 0 44.4%
Taylor expanded in k around 0 18.5%
Final simplification18.5%
herbie shell --seed 2024021
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))