
(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 12 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))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 2e+101)
(/ t_0 (+ 1.0 (* k (+ k 10.0))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+101) {
tmp = t_0 / (1.0 + (k * (k + 10.0)));
} 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) :: tmp
t_0 = a * (k ** m)
if ((t_0 / ((k * k) + (1.0d0 + (k * 10.0d0)))) <= 2d+101) then
tmp = t_0 / (1.0d0 + (k * (k + 10.0d0)))
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 tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+101) {
tmp = t_0 / (1.0 + (k * (k + 10.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+101: tmp = t_0 / (1.0 + (k * (k + 10.0))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 2e+101) tmp = Float64(t_0 / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+101) tmp = t_0 / (1.0 + (k * (k + 10.0))); 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]}, If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+101], N[(t$95$0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t_0}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 2 \cdot 10^{+101}:\\
\;\;\;\;\frac{t_0}{1 + k \cdot \left(k + 10\right)}\\
\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))) < 2e101Initial program 97.6%
sqr-neg97.6%
associate-+l+97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
Simplified97.6%
if 2e101 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 63.3%
sqr-neg63.3%
associate-+l+63.3%
sqr-neg63.3%
distribute-rgt-out63.3%
Simplified63.3%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -8.5e-7) (not (<= m 1.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 <= -8.5e-7) || !(m <= 1.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 <= (-8.5d-7)) .or. (.not. (m <= 1.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 <= -8.5e-7) || !(m <= 1.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 <= -8.5e-7) or not (m <= 1.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 <= -8.5e-7) || !(m <= 1.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 <= -8.5e-7) || ~((m <= 1.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, -8.5e-7], N[Not[LessEqual[m, 1.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 -8.5 \cdot 10^{-7} \lor \neg \left(m \leq 1.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 < -8.50000000000000014e-7 or 1.15e-6 < m Initial program 88.8%
sqr-neg88.8%
associate-+l+88.8%
sqr-neg88.8%
distribute-rgt-out88.8%
Simplified88.8%
Taylor expanded in k around 0 100.0%
if -8.50000000000000014e-7 < m < 1.15e-6Initial program 94.9%
sqr-neg94.9%
associate-+l+94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
Simplified94.9%
Taylor expanded in m around 0 94.5%
Final simplification97.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -0.4)
(/ 1.0 (* t_0 (/ 1.0 a)))
(if (<= m 4.6e+21)
(/ a (+ 1.0 t_0))
(/ 1.0 (/ (- (* (- a) (* k 10.0)) a) (* a (- a))))))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.4) {
tmp = 1.0 / (t_0 * (1.0 / a));
} else if (m <= 4.6e+21) {
tmp = a / (1.0 + t_0);
} else {
tmp = 1.0 / (((-a * (k * 10.0)) - a) / (a * -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) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-0.4d0)) then
tmp = 1.0d0 / (t_0 * (1.0d0 / a))
else if (m <= 4.6d+21) then
tmp = a / (1.0d0 + t_0)
else
tmp = 1.0d0 / (((-a * (k * 10.0d0)) - a) / (a * -a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.4) {
tmp = 1.0 / (t_0 * (1.0 / a));
} else if (m <= 4.6e+21) {
tmp = a / (1.0 + t_0);
} else {
tmp = 1.0 / (((-a * (k * 10.0)) - a) / (a * -a));
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.4: tmp = 1.0 / (t_0 * (1.0 / a)) elif m <= 4.6e+21: tmp = a / (1.0 + t_0) else: tmp = 1.0 / (((-a * (k * 10.0)) - a) / (a * -a)) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.4) tmp = Float64(1.0 / Float64(t_0 * Float64(1.0 / a))); elseif (m <= 4.6e+21) tmp = Float64(a / Float64(1.0 + t_0)); else tmp = Float64(1.0 / Float64(Float64(Float64(Float64(-a) * Float64(k * 10.0)) - a) / Float64(a * Float64(-a)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.4) tmp = 1.0 / (t_0 * (1.0 / a)); elseif (m <= 4.6e+21) tmp = a / (1.0 + t_0); else tmp = 1.0 / (((-a * (k * 10.0)) - a) / (a * -a)); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.4], N[(1.0 / N[(t$95$0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.6e+21], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(N[((-a) * N[(k * 10.0), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / N[(a * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -0.4:\\
\;\;\;\;\frac{1}{t_0 \cdot \frac{1}{a}}\\
\mathbf{elif}\;m \leq 4.6 \cdot 10^{+21}:\\
\;\;\;\;\frac{a}{1 + t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\left(-a\right) \cdot \left(k \cdot 10\right) - a}{a \cdot \left(-a\right)}}\\
\end{array}
\end{array}
if m < -0.40000000000000002Initial 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 38.2%
clear-num38.3%
+-commutative38.3%
+-commutative38.3%
fma-udef38.3%
inv-pow38.3%
Applied egg-rr38.3%
unpow-138.3%
Simplified38.3%
div-inv38.3%
Applied egg-rr38.3%
Taylor expanded in k around inf 47.1%
+-commutative47.1%
unpow247.1%
distribute-rgt-in47.1%
Simplified47.1%
if -0.40000000000000002 < m < 4.6e21Initial 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 90.8%
if 4.6e21 < m Initial program 79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 2.8%
clear-num2.8%
+-commutative2.8%
+-commutative2.8%
fma-udef2.8%
inv-pow2.8%
Applied egg-rr2.8%
unpow-12.8%
Simplified2.8%
Taylor expanded in k around 0 2.6%
+-commutative2.6%
frac-2neg2.6%
metadata-eval2.6%
associate-*r/2.6%
frac-add11.5%
neg-mul-111.5%
*-commutative11.5%
Applied egg-rr11.5%
Final simplification52.6%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* k (+ k 10.0)))) (if (<= m -0.28) (/ 1.0 (* t_0 (/ 1.0 a))) (/ a (+ 1.0 t_0)))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.28) {
tmp = 1.0 / (t_0 * (1.0 / a));
} else {
tmp = a / (1.0 + 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) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-0.28d0)) then
tmp = 1.0d0 / (t_0 * (1.0d0 / a))
else
tmp = a / (1.0d0 + t_0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.28) {
tmp = 1.0 / (t_0 * (1.0 / a));
} else {
tmp = a / (1.0 + t_0);
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.28: tmp = 1.0 / (t_0 * (1.0 / a)) else: tmp = a / (1.0 + t_0) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.28) tmp = Float64(1.0 / Float64(t_0 * Float64(1.0 / a))); else tmp = Float64(a / Float64(1.0 + t_0)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.28) tmp = 1.0 / (t_0 * (1.0 / a)); else tmp = a / (1.0 + t_0); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.28], N[(1.0 / N[(t$95$0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -0.28:\\
\;\;\;\;\frac{1}{t_0 \cdot \frac{1}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + t_0}\\
\end{array}
\end{array}
if m < -0.28000000000000003Initial 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 38.2%
clear-num38.3%
+-commutative38.3%
+-commutative38.3%
fma-udef38.3%
inv-pow38.3%
Applied egg-rr38.3%
unpow-138.3%
Simplified38.3%
div-inv38.3%
Applied egg-rr38.3%
Taylor expanded in k around inf 47.1%
+-commutative47.1%
unpow247.1%
distribute-rgt-in47.1%
Simplified47.1%
if -0.28000000000000003 < m Initial program 87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 50.9%
Final simplification49.8%
(FPCore (a k m) :precision binary64 (if (<= m -0.192) (/ 1.0 (* 10.0 (/ k a))) (/ 1.0 (/ (+ 1.0 (* k 10.0)) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.192) {
tmp = 1.0 / (10.0 * (k / a));
} else {
tmp = 1.0 / ((1.0 + (k * 10.0)) / 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 <= (-0.192d0)) then
tmp = 1.0d0 / (10.0d0 * (k / a))
else
tmp = 1.0d0 / ((1.0d0 + (k * 10.0d0)) / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.192) {
tmp = 1.0 / (10.0 * (k / a));
} else {
tmp = 1.0 / ((1.0 + (k * 10.0)) / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.192: tmp = 1.0 / (10.0 * (k / a)) else: tmp = 1.0 / ((1.0 + (k * 10.0)) / a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.192) tmp = Float64(1.0 / Float64(10.0 * Float64(k / a))); else tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * 10.0)) / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.192) tmp = 1.0 / (10.0 * (k / a)); else tmp = 1.0 / ((1.0 + (k * 10.0)) / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.192], N[(1.0 / N[(10.0 * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.192:\\
\;\;\;\;\frac{1}{10 \cdot \frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot 10}{a}}\\
\end{array}
\end{array}
if m < -0.192Initial 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 38.2%
clear-num38.3%
+-commutative38.3%
+-commutative38.3%
fma-udef38.3%
inv-pow38.3%
Applied egg-rr38.3%
unpow-138.3%
Simplified38.3%
Taylor expanded in k around 0 18.8%
Taylor expanded in k around inf 27.6%
if -0.192 < m Initial program 87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 50.9%
clear-num50.6%
+-commutative50.6%
+-commutative50.6%
fma-udef50.6%
inv-pow50.6%
Applied egg-rr50.6%
unpow-150.6%
Simplified50.6%
Taylor expanded in k around 0 35.4%
Taylor expanded in a around 0 35.4%
*-commutative35.4%
Simplified35.4%
Final simplification33.2%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (/ (* a 0.1) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a * 0.1) / 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 <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = (a * 0.1d0) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a * 0.1) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a * 0.1) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(Float64(a * 0.1) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a * (1.0 + (k * -10.0)); else tmp = (a * 0.1) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 0.1), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot 0.1}{k}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 98.7%
sqr-neg98.7%
associate-+l+98.7%
sqr-neg98.7%
distribute-rgt-out98.7%
Simplified98.7%
expm1-log1p-u72.6%
expm1-udef58.0%
associate-/l*58.0%
associate-/r/58.0%
+-commutative58.0%
fma-def58.0%
+-commutative58.0%
Applied egg-rr58.0%
expm1-def72.6%
expm1-log1p98.0%
associate-*l/98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in m around 0 38.5%
Taylor expanded in k around 0 36.1%
*-commutative36.1%
Simplified36.1%
if 0.0749999999999999972 < k Initial program 79.7%
sqr-neg79.7%
associate-+l+79.7%
sqr-neg79.7%
distribute-rgt-out79.7%
Simplified79.7%
Taylor expanded in m around 0 60.2%
clear-num59.9%
+-commutative59.9%
+-commutative59.9%
fma-udef59.9%
inv-pow59.9%
Applied egg-rr59.9%
unpow-159.9%
Simplified59.9%
Taylor expanded in k around 0 22.2%
Taylor expanded in k around inf 21.4%
associate-*r/21.4%
Simplified21.4%
Final simplification30.2%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (/ 1.0 (* 10.0 (/ k a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 1.0 / (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 (k <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = 1.0d0 / (10.0d0 * (k / a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 1.0 / (10.0 * (k / a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = 1.0 / (10.0 * (k / a)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(1.0 / Float64(10.0 * Float64(k / a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a * (1.0 + (k * -10.0)); else tmp = 1.0 / (10.0 * (k / a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(10.0 * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{10 \cdot \frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 98.7%
sqr-neg98.7%
associate-+l+98.7%
sqr-neg98.7%
distribute-rgt-out98.7%
Simplified98.7%
expm1-log1p-u72.6%
expm1-udef58.0%
associate-/l*58.0%
associate-/r/58.0%
+-commutative58.0%
fma-def58.0%
+-commutative58.0%
Applied egg-rr58.0%
expm1-def72.6%
expm1-log1p98.0%
associate-*l/98.7%
associate-*r/98.7%
Simplified98.7%
Taylor expanded in m around 0 38.5%
Taylor expanded in k around 0 36.1%
*-commutative36.1%
Simplified36.1%
if 0.0749999999999999972 < k Initial program 79.7%
sqr-neg79.7%
associate-+l+79.7%
sqr-neg79.7%
distribute-rgt-out79.7%
Simplified79.7%
Taylor expanded in m around 0 60.2%
clear-num59.9%
+-commutative59.9%
+-commutative59.9%
fma-udef59.9%
inv-pow59.9%
Applied egg-rr59.9%
unpow-159.9%
Simplified59.9%
Taylor expanded in k around 0 22.2%
Taylor expanded in k around inf 22.2%
Final simplification30.5%
(FPCore (a k m) :precision binary64 (if (<= m -0.455) (/ 1.0 (* 10.0 (/ k a))) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.455) {
tmp = 1.0 / (10.0 * (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 <= (-0.455d0)) then
tmp = 1.0d0 / (10.0d0 * (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 <= -0.455) {
tmp = 1.0 / (10.0 * (k / a));
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.455: tmp = 1.0 / (10.0 * (k / a)) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.455) tmp = Float64(1.0 / Float64(10.0 * 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 <= -0.455) tmp = 1.0 / (10.0 * (k / a)); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.455], N[(1.0 / N[(10.0 * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.455:\\
\;\;\;\;\frac{1}{10 \cdot \frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -0.455000000000000016Initial 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 38.2%
clear-num38.3%
+-commutative38.3%
+-commutative38.3%
fma-udef38.3%
inv-pow38.3%
Applied egg-rr38.3%
unpow-138.3%
Simplified38.3%
Taylor expanded in k around 0 18.8%
Taylor expanded in k around inf 27.6%
if -0.455000000000000016 < m Initial program 87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 50.9%
Taylor expanded in k around 0 35.2%
*-commutative35.2%
Simplified35.2%
Final simplification33.0%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k (+ k 10.0)))))
double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a / (1.0d0 + (k * (k + 10.0d0)))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
def code(a, k, m): return a / (1.0 + (k * (k + 10.0)))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * (k + 10.0))); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot \left(k + 10\right)}
\end{array}
Initial program 91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in m around 0 47.3%
Final simplification47.3%
(FPCore (a k m) :precision binary64 (if (<= k 12500000000.0) a (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 12500000000.0) {
tmp = a;
} else {
tmp = 0.1 * (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 <= 12500000000.0d0) then
tmp = a
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 12500000000.0) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 12500000000.0: tmp = a else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 12500000000.0) tmp = a; else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 12500000000.0) tmp = a; else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 12500000000.0], a, N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 12500000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 1.25e10Initial program 98.7%
sqr-neg98.7%
associate-+l+98.7%
sqr-neg98.7%
distribute-rgt-out98.7%
Simplified98.7%
Taylor expanded in m around 0 38.3%
Taylor expanded in k around 0 33.7%
if 1.25e10 < k Initial program 79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 60.8%
clear-num60.4%
+-commutative60.4%
+-commutative60.4%
fma-udef60.4%
inv-pow60.4%
Applied egg-rr60.4%
unpow-160.4%
Simplified60.4%
Taylor expanded in k around 0 22.4%
Taylor expanded in k around inf 21.6%
Final simplification28.9%
(FPCore (a k m) :precision binary64 (if (<= k 12500000000.0) a (/ (* a 0.1) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 12500000000.0) {
tmp = a;
} else {
tmp = (a * 0.1) / 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 <= 12500000000.0d0) then
tmp = a
else
tmp = (a * 0.1d0) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 12500000000.0) {
tmp = a;
} else {
tmp = (a * 0.1) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 12500000000.0: tmp = a else: tmp = (a * 0.1) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 12500000000.0) tmp = a; else tmp = Float64(Float64(a * 0.1) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 12500000000.0) tmp = a; else tmp = (a * 0.1) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 12500000000.0], a, N[(N[(a * 0.1), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 12500000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a \cdot 0.1}{k}\\
\end{array}
\end{array}
if k < 1.25e10Initial program 98.7%
sqr-neg98.7%
associate-+l+98.7%
sqr-neg98.7%
distribute-rgt-out98.7%
Simplified98.7%
Taylor expanded in m around 0 38.3%
Taylor expanded in k around 0 33.7%
if 1.25e10 < k Initial program 79.5%
sqr-neg79.5%
associate-+l+79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
Simplified79.5%
Taylor expanded in m around 0 60.8%
clear-num60.4%
+-commutative60.4%
+-commutative60.4%
fma-udef60.4%
inv-pow60.4%
Applied egg-rr60.4%
unpow-160.4%
Simplified60.4%
Taylor expanded in k around 0 22.4%
Taylor expanded in k around inf 21.6%
associate-*r/21.6%
Simplified21.6%
Final simplification28.9%
(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%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in m around 0 47.3%
Taylor expanded in k around 0 21.9%
Final simplification21.9%
herbie shell --seed 2023320
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))