
(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 11 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+231)
(/ a (/ (+ 1.0 (* k (+ k 10.0))) (pow k m)))
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+231) {
tmp = a / ((1.0 + (k * (k + 10.0))) / pow(k, m));
} 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+231) then
tmp = a / ((1.0d0 + (k * (k + 10.0d0))) / (k ** m))
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+231) {
tmp = a / ((1.0 + (k * (k + 10.0))) / Math.pow(k, m));
} 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+231: tmp = a / ((1.0 + (k * (k + 10.0))) / math.pow(k, m)) 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+231) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / (k ^ m))); 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+231) tmp = a / ((1.0 + (k * (k + 10.0))) / (k ^ m)); 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+231], N[(a / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $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^{+231}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot \left(k + 10\right)}{{k}^{m}}}\\
\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))) < 2.0000000000000001e231Initial program 96.7%
associate-/l*96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
if 2.0000000000000001e231 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 56.6%
associate-/l*56.6%
sqr-neg56.6%
associate-+l+56.6%
sqr-neg56.6%
distribute-rgt-out56.6%
Simplified56.6%
Taylor expanded in k around 0 100.0%
Final simplification97.4%
(FPCore (a k m) :precision binary64 (if (<= m -3.35e-16) (/ a (/ (+ 1.0 (* k 10.0)) (pow k m))) (if (<= m 1.2) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.35e-16) {
tmp = a / ((1.0 + (k * 10.0)) / pow(k, m));
} else if (m <= 1.2) {
tmp = a * (1.0 / (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 <= (-3.35d-16)) then
tmp = a / ((1.0d0 + (k * 10.0d0)) / (k ** m))
else if (m <= 1.2d0) then
tmp = a * (1.0d0 / (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 <= -3.35e-16) {
tmp = a / ((1.0 + (k * 10.0)) / Math.pow(k, m));
} else if (m <= 1.2) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.35e-16: tmp = a / ((1.0 + (k * 10.0)) / math.pow(k, m)) elif m <= 1.2: tmp = a * (1.0 / (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 <= -3.35e-16) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * 10.0)) / (k ^ m))); elseif (m <= 1.2) tmp = Float64(a * Float64(1.0 / 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 <= -3.35e-16) tmp = a / ((1.0 + (k * 10.0)) / (k ^ m)); elseif (m <= 1.2) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.35e-16], N[(a / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.2], N[(a * N[(1.0 / 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 -3.35 \cdot 10^{-16}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot 10}{{k}^{m}}}\\
\mathbf{elif}\;m \leq 1.2:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -3.3500000000000002e-16Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 98.9%
*-commutative16.3%
Simplified98.9%
if -3.3500000000000002e-16 < m < 1.19999999999999996Initial program 92.5%
associate-/l*92.5%
sqr-neg92.5%
associate-+l+92.5%
sqr-neg92.5%
distribute-rgt-out92.5%
Simplified92.5%
clear-num90.8%
associate-/r/92.5%
clear-num92.5%
+-commutative92.5%
+-commutative92.5%
fma-udef92.5%
Applied egg-rr92.5%
Taylor expanded in m around 0 92.4%
if 1.19999999999999996 < m Initial program 72.6%
associate-/l*72.6%
sqr-neg72.6%
associate-+l+72.6%
sqr-neg72.6%
distribute-rgt-out72.6%
Simplified72.6%
Taylor expanded in k around 0 100.0%
Final simplification97.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.35e-16) (not (<= m 1.2))) (* a (pow k m)) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.35e-16) || !(m <= 1.2)) {
tmp = a * pow(k, m);
} else {
tmp = a * (1.0 / (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 <= (-3.35d-16)) .or. (.not. (m <= 1.2d0))) then
tmp = a * (k ** m)
else
tmp = a * (1.0d0 / (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 <= -3.35e-16) || !(m <= 1.2)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -3.35e-16) or not (m <= 1.2): tmp = a * math.pow(k, m) else: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -3.35e-16) || !(m <= 1.2)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(1.0 / 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 <= -3.35e-16) || ~((m <= 1.2))) tmp = a * (k ^ m); else tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -3.35e-16], N[Not[LessEqual[m, 1.2]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.35 \cdot 10^{-16} \lor \neg \left(m \leq 1.2\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.3500000000000002e-16 or 1.19999999999999996 < m Initial program 86.2%
associate-/l*86.2%
sqr-neg86.2%
associate-+l+86.2%
sqr-neg86.2%
distribute-rgt-out86.2%
Simplified86.2%
Taylor expanded in k around 0 99.4%
if -3.3500000000000002e-16 < m < 1.19999999999999996Initial program 92.5%
associate-/l*92.5%
sqr-neg92.5%
associate-+l+92.5%
sqr-neg92.5%
distribute-rgt-out92.5%
Simplified92.5%
clear-num90.8%
associate-/r/92.5%
clear-num92.5%
+-commutative92.5%
+-commutative92.5%
fma-udef92.5%
Applied egg-rr92.5%
Taylor expanded in m around 0 92.4%
Final simplification97.0%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.15) (not (<= k 0.082))) (* a (/ 1.0 (* k (+ k 10.0)))) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.15) || !(k <= 0.082)) {
tmp = a * (1.0 / (k * (k + 10.0)));
} 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 ((k <= (-1.15d0)) .or. (.not. (k <= 0.082d0))) then
tmp = a * (1.0d0 / (k * (k + 10.0d0)))
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 ((k <= -1.15) || !(k <= 0.082)) {
tmp = a * (1.0 / (k * (k + 10.0)));
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.15) or not (k <= 0.082): tmp = a * (1.0 / (k * (k + 10.0))) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.15) || !(k <= 0.082)) tmp = Float64(a * Float64(1.0 / Float64(k * Float64(k + 10.0)))); 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 ((k <= -1.15) || ~((k <= 0.082))) tmp = a * (1.0 / (k * (k + 10.0))); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.15], N[Not[LessEqual[k, 0.082]], $MachinePrecision]], N[(a * N[(1.0 / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.15 \lor \neg \left(k \leq 0.082\right):\\
\;\;\;\;a \cdot \frac{1}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < -1.1499999999999999 or 0.0820000000000000034 < k Initial program 77.0%
associate-/l*77.0%
sqr-neg77.0%
associate-+l+77.0%
sqr-neg77.0%
distribute-rgt-out77.0%
Simplified77.0%
clear-num75.9%
associate-/r/77.0%
clear-num77.0%
+-commutative77.0%
+-commutative77.0%
fma-udef77.0%
Applied egg-rr77.0%
Taylor expanded in m around 0 51.8%
Taylor expanded in k around inf 51.2%
+-commutative51.2%
unpow251.2%
distribute-rgt-in51.2%
Simplified51.2%
if -1.1499999999999999 < k < 0.0820000000000000034Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 36.5%
Taylor expanded in k around 0 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification43.7%
(FPCore (a k m) :precision binary64 (if (<= m 3.8e+16) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.8e+16) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -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.8d+16) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = (-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.8e+16) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.8e+16: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.8e+16) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.8e+16) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.8e+16], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.8 \cdot 10^{+16}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 3.8e16Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
clear-num94.2%
associate-/r/95.0%
clear-num95.0%
+-commutative95.0%
+-commutative95.0%
fma-udef95.0%
Applied egg-rr95.0%
Taylor expanded in m around 0 63.3%
if 3.8e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification49.8%
(FPCore (a k m) :precision binary64 (if (<= m 4.4e+16) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.4e+16) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -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 <= 4.4d+16) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 4.4e+16) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 4.4e+16: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 4.4e+16) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 4.4e+16) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 4.4e+16], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 4.4e16Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 63.3%
if 4.4e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification49.8%
(FPCore (a k m) :precision binary64 (if (<= m -3.25e-6) (* 0.1 (/ a k)) (if (<= m 4e+16) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.25e-6) {
tmp = 0.1 * (a / k);
} else if (m <= 4e+16) {
tmp = a;
} else {
tmp = -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.25d-6)) then
tmp = 0.1d0 * (a / k)
else if (m <= 4d+16) then
tmp = a
else
tmp = (-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.25e-6) {
tmp = 0.1 * (a / k);
} else if (m <= 4e+16) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.25e-6: tmp = 0.1 * (a / k) elif m <= 4e+16: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.25e-6) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 4e+16) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.25e-6) tmp = 0.1 * (a / k); elseif (m <= 4e+16) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.25e-6], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4e+16], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.25 \cdot 10^{-6}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 4 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -3.2499999999999998e-6Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 33.7%
Taylor expanded in k around 0 15.2%
*-commutative15.2%
Simplified15.2%
Taylor expanded in k around inf 19.5%
if -3.2499999999999998e-6 < m < 4e16Initial program 90.7%
associate-/l*90.7%
sqr-neg90.7%
associate-+l+90.8%
sqr-neg90.8%
distribute-rgt-out90.8%
Simplified90.8%
Taylor expanded in m around 0 88.9%
Taylor expanded in k around 0 47.9%
if 4e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification30.3%
(FPCore (a k m) :precision binary64 (if (<= m -4.1e-6) (/ a (* k 10.0)) (if (<= m 3.8e+16) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e-6) {
tmp = a / (k * 10.0);
} else if (m <= 3.8e+16) {
tmp = a;
} else {
tmp = -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 <= (-4.1d-6)) then
tmp = a / (k * 10.0d0)
else if (m <= 3.8d+16) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e-6) {
tmp = a / (k * 10.0);
} else if (m <= 3.8e+16) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.1e-6: tmp = a / (k * 10.0) elif m <= 3.8e+16: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.1e-6) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 3.8e+16) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.1e-6) tmp = a / (k * 10.0); elseif (m <= 3.8e+16) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.1e-6], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.8e+16], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 3.8 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -4.0999999999999997e-6Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 33.7%
Taylor expanded in k around 0 15.2%
*-commutative15.2%
Simplified15.2%
Taylor expanded in k around inf 19.5%
*-commutative19.5%
Simplified19.5%
if -4.0999999999999997e-6 < m < 3.8e16Initial program 90.7%
associate-/l*90.7%
sqr-neg90.7%
associate-+l+90.8%
sqr-neg90.8%
distribute-rgt-out90.8%
Simplified90.8%
Taylor expanded in m around 0 88.9%
Taylor expanded in k around 0 47.9%
if 3.8e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification30.3%
(FPCore (a k m) :precision binary64 (if (<= m 5e+16) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5e+16) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -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 <= 5d+16) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 5e+16) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5e+16: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5e+16) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5e+16) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5e+16], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 5e16Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 63.3%
Taylor expanded in k around 0 38.6%
*-commutative38.6%
Simplified38.6%
if 5e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification32.9%
(FPCore (a k m) :precision binary64 (if (<= m 3.8e+16) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.8e+16) {
tmp = a;
} else {
tmp = -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.8d+16) then
tmp = a
else
tmp = (-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.8e+16) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.8e+16: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.8e+16) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.8e+16) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.8e+16], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.8 \cdot 10^{+16}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 3.8e16Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 63.3%
Taylor expanded in k around 0 27.3%
if 3.8e16 < m Initial program 74.1%
associate-/l*74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.6%
Taylor expanded in k around inf 20.7%
Final simplification25.3%
(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 88.4%
associate-/l*88.4%
sqr-neg88.4%
associate-+l+88.4%
sqr-neg88.4%
distribute-rgt-out88.4%
Simplified88.4%
Taylor expanded in m around 0 44.2%
Taylor expanded in k around 0 19.9%
Final simplification19.9%
herbie shell --seed 2023318
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))