
(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 15 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 (* (/ 1.0 (hypot 1.0 k)) (/ (* a (pow k m)) (hypot 1.0 k))))
double code(double a, double k, double m) {
return (1.0 / hypot(1.0, k)) * ((a * pow(k, m)) / hypot(1.0, k));
}
public static double code(double a, double k, double m) {
return (1.0 / Math.hypot(1.0, k)) * ((a * Math.pow(k, m)) / Math.hypot(1.0, k));
}
def code(a, k, m): return (1.0 / math.hypot(1.0, k)) * ((a * math.pow(k, m)) / math.hypot(1.0, k))
function code(a, k, m) return Float64(Float64(1.0 / hypot(1.0, k)) * Float64(Float64(a * (k ^ m)) / hypot(1.0, k))) end
function tmp = code(a, k, m) tmp = (1.0 / hypot(1.0, k)) * ((a * (k ^ m)) / hypot(1.0, k)); end
code[a_, k_, m_] := N[(N[(1.0 / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a \cdot {k}^{m}}{\mathsf{hypot}\left(1, k\right)}
\end{array}
Initial program 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in k around 0 87.2%
*-un-lft-identity87.2%
add-sqr-sqrt87.2%
times-frac87.2%
hypot-1-def87.2%
hypot-1-def99.1%
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (a k m) :precision binary64 (if (<= m 0.0023) (* (/ (pow k m) (hypot 1.0 k)) (/ a (hypot 1.0 k))) (/ a (pow k (- m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.0023) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a / hypot(1.0, k));
} else {
tmp = a / pow(k, -m);
}
return tmp;
}
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.0023) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a / Math.hypot(1.0, k));
} else {
tmp = a / Math.pow(k, -m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.0023: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a / math.hypot(1.0, k)) else: tmp = a / math.pow(k, -m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.0023) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a / hypot(1.0, k))); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.0023) tmp = ((k ^ m) / hypot(1.0, k)) * (a / hypot(1.0, k)); else tmp = a / (k ^ -m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.0023], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.0023:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 0.0023Initial program 94.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in k around 0 93.1%
*-commutative93.1%
add-sqr-sqrt93.1%
times-frac93.1%
hypot-1-def93.1%
hypot-1-def98.7%
Applied egg-rr98.7%
if 0.0023 < m Initial program 71.8%
associate-/l*71.8%
sqr-neg71.8%
associate-+l+71.8%
sqr-neg71.8%
distribute-rgt-out71.8%
Simplified71.8%
Taylor expanded in k around 0 100.0%
Taylor expanded in k around inf 53.5%
rec-exp53.5%
mul-1-neg53.5%
remove-double-neg53.5%
*-commutative53.5%
log-rec53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-out53.5%
exp-to-pow100.0%
Simplified100.0%
Final simplification99.1%
(FPCore (a k m) :precision binary64 (if (<= m 0.0023) (* (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 <= 0.0023) {
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 <= 0.0023d0) 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 <= 0.0023) {
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 <= 0.0023: 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 <= 0.0023) tmp = Float64((k ^ m) * 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 <= 0.0023) 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, 0.0023], 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 0.0023:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 0.0023Initial program 94.2%
associate-*l/94.2%
*-commutative94.2%
sqr-neg94.2%
associate-+l+94.2%
+-commutative94.2%
sqr-neg94.2%
distribute-rgt-out94.2%
fma-def94.2%
+-commutative94.2%
Simplified94.2%
Taylor expanded in a around 0 94.2%
if 0.0023 < m Initial program 71.8%
associate-/l*71.8%
sqr-neg71.8%
associate-+l+71.8%
sqr-neg71.8%
distribute-rgt-out71.8%
Simplified71.8%
Taylor expanded in k around 0 100.0%
Taylor expanded in k around inf 53.5%
rec-exp53.5%
mul-1-neg53.5%
remove-double-neg53.5%
*-commutative53.5%
log-rec53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-out53.5%
exp-to-pow100.0%
Simplified100.0%
Final simplification95.8%
(FPCore (a k m) :precision binary64 (if (<= m -8e-17) (/ a (/ (+ 1.0 (* k 10.0)) (pow k m))) (if (<= m 2.4e-18) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -8e-17) {
tmp = a / ((1.0 + (k * 10.0)) / pow(k, m));
} else if (m <= 2.4e-18) {
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 <= (-8d-17)) then
tmp = a / ((1.0d0 + (k * 10.0d0)) / (k ** m))
else if (m <= 2.4d-18) 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 <= -8e-17) {
tmp = a / ((1.0 + (k * 10.0)) / Math.pow(k, m));
} else if (m <= 2.4e-18) {
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 <= -8e-17: tmp = a / ((1.0 + (k * 10.0)) / math.pow(k, m)) elif m <= 2.4e-18: 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 <= -8e-17) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * 10.0)) / (k ^ m))); elseif (m <= 2.4e-18) tmp = 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 <= -8e-17) tmp = a / ((1.0 + (k * 10.0)) / (k ^ m)); elseif (m <= 2.4e-18) 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, -8e-17], N[(a / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.4e-18], 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 -8 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot 10}{{k}^{m}}}\\
\mathbf{elif}\;m \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -8.00000000000000057e-17Initial program 99.1%
associate-/l*99.1%
sqr-neg99.1%
associate-+l+99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in k around 0 97.9%
*-commutative18.3%
Simplified97.9%
if -8.00000000000000057e-17 < m < 2.39999999999999994e-18Initial program 90.2%
associate-/l*90.2%
sqr-neg90.2%
associate-+l+90.2%
sqr-neg90.2%
distribute-rgt-out90.2%
Simplified90.2%
Taylor expanded in m around 0 90.2%
if 2.39999999999999994e-18 < m Initial program 72.1%
associate-*l/69.4%
*-commutative69.4%
sqr-neg69.4%
associate-+l+69.4%
+-commutative69.4%
sqr-neg69.4%
distribute-rgt-out69.4%
fma-def69.4%
+-commutative69.4%
Simplified69.4%
Taylor expanded in k around 0 98.1%
Final simplification95.2%
(FPCore (a k m) :precision binary64 (if (<= m 0.0023) (/ (* a (pow k m)) (+ 1.0 (* k k))) (/ a (pow k (- m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.0023) {
tmp = (a * pow(k, m)) / (1.0 + (k * k));
} 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 <= 0.0023d0) then
tmp = (a * (k ** m)) / (1.0d0 + (k * k))
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 <= 0.0023) {
tmp = (a * Math.pow(k, m)) / (1.0 + (k * k));
} else {
tmp = a / Math.pow(k, -m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.0023: tmp = (a * math.pow(k, m)) / (1.0 + (k * k)) else: tmp = a / math.pow(k, -m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.0023) tmp = Float64(Float64(a * (k ^ m)) / Float64(1.0 + Float64(k * k))); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.0023) tmp = (a * (k ^ m)) / (1.0 + (k * k)); else tmp = a / (k ^ -m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.0023], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.0023:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 0.0023Initial program 94.2%
*-commutative94.2%
Simplified94.2%
Taylor expanded in k around 0 93.1%
if 0.0023 < m Initial program 71.8%
associate-/l*71.8%
sqr-neg71.8%
associate-+l+71.8%
sqr-neg71.8%
distribute-rgt-out71.8%
Simplified71.8%
Taylor expanded in k around 0 100.0%
Taylor expanded in k around inf 53.5%
rec-exp53.5%
mul-1-neg53.5%
remove-double-neg53.5%
*-commutative53.5%
log-rec53.5%
distribute-lft-neg-in53.5%
distribute-rgt-neg-out53.5%
exp-to-pow100.0%
Simplified100.0%
Final simplification95.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -47000.0) (not (<= m 2.4e-18))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -47000.0) || !(m <= 2.4e-18)) {
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 <= (-47000.0d0)) .or. (.not. (m <= 2.4d-18))) 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 <= -47000.0) || !(m <= 2.4e-18)) {
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 <= -47000.0) or not (m <= 2.4e-18): 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 <= -47000.0) || !(m <= 2.4e-18)) 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 <= -47000.0) || ~((m <= 2.4e-18))) 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, -47000.0], N[Not[LessEqual[m, 2.4e-18]], $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 -47000 \lor \neg \left(m \leq 2.4 \cdot 10^{-18}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -47000 or 2.39999999999999994e-18 < m Initial program 86.7%
associate-*l/85.5%
*-commutative85.5%
sqr-neg85.5%
associate-+l+85.5%
+-commutative85.5%
sqr-neg85.5%
distribute-rgt-out85.5%
fma-def85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in k around 0 99.1%
if -47000 < m < 2.39999999999999994e-18Initial program 90.0%
associate-/l*90.0%
sqr-neg90.0%
associate-+l+90.0%
sqr-neg90.0%
distribute-rgt-out90.0%
Simplified90.0%
Taylor expanded in m around 0 88.4%
Final simplification95.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -1.04e+18)
(/ a t_0)
(if (<= m 2.1)
(/ a (+ 1.0 t_0))
(+ (* a -0.01) (+ (* 0.001 (* k a)) (* 0.1 (/ a k))))))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -1.04e+18) {
tmp = a / t_0;
} else if (m <= 2.1) {
tmp = a / (1.0 + t_0);
} else {
tmp = (a * -0.01) + ((0.001 * (k * a)) + (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) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-1.04d+18)) then
tmp = a / t_0
else if (m <= 2.1d0) then
tmp = a / (1.0d0 + t_0)
else
tmp = (a * (-0.01d0)) + ((0.001d0 * (k * a)) + (0.1d0 * (a / k)))
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 <= -1.04e+18) {
tmp = a / t_0;
} else if (m <= 2.1) {
tmp = a / (1.0 + t_0);
} else {
tmp = (a * -0.01) + ((0.001 * (k * a)) + (0.1 * (a / k)));
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -1.04e+18: tmp = a / t_0 elif m <= 2.1: tmp = a / (1.0 + t_0) else: tmp = (a * -0.01) + ((0.001 * (k * a)) + (0.1 * (a / k))) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -1.04e+18) tmp = Float64(a / t_0); elseif (m <= 2.1) tmp = Float64(a / Float64(1.0 + t_0)); else tmp = Float64(Float64(a * -0.01) + Float64(Float64(0.001 * Float64(k * a)) + Float64(0.1 * Float64(a / k)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -1.04e+18) tmp = a / t_0; elseif (m <= 2.1) tmp = a / (1.0 + t_0); else tmp = (a * -0.01) + ((0.001 * (k * a)) + (0.1 * (a / k))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -1.04e+18], N[(a / t$95$0), $MachinePrecision], If[LessEqual[m, 2.1], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(a * -0.01), $MachinePrecision] + N[(N[(0.001 * N[(k * a), $MachinePrecision]), $MachinePrecision] + N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -1.04 \cdot 10^{+18}:\\
\;\;\;\;\frac{a}{t_0}\\
\mathbf{elif}\;m \leq 2.1:\\
\;\;\;\;\frac{a}{1 + t_0}\\
\mathbf{else}:\\
\;\;\;\;a \cdot -0.01 + \left(0.001 \cdot \left(k \cdot a\right) + 0.1 \cdot \frac{a}{k}\right)\\
\end{array}
\end{array}
if m < -1.04e18Initial 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 29.3%
clear-num29.3%
inv-pow29.3%
+-commutative29.3%
+-commutative29.3%
fma-udef29.3%
Applied egg-rr29.3%
unpow-129.3%
Simplified29.3%
Taylor expanded in k around inf 42.9%
+-commutative42.9%
unpow242.9%
distribute-rgt-in42.9%
Simplified42.9%
Taylor expanded in a around 0 42.9%
associate-/r*39.5%
+-commutative39.5%
associate-/r*42.9%
Simplified42.9%
if -1.04e18 < m < 2.10000000000000009Initial program 89.8%
associate-/l*89.8%
sqr-neg89.8%
associate-+l+89.8%
sqr-neg89.8%
distribute-rgt-out89.8%
Simplified89.8%
Taylor expanded in m around 0 84.8%
if 2.10000000000000009 < m Initial program 71.4%
associate-/l*71.4%
sqr-neg71.4%
associate-+l+71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
Simplified71.4%
Taylor expanded in m around 0 3.0%
clear-num3.0%
inv-pow3.0%
+-commutative3.0%
+-commutative3.0%
fma-udef3.0%
Applied egg-rr3.0%
unpow-13.0%
Simplified3.0%
Taylor expanded in k around inf 2.3%
+-commutative2.3%
unpow22.3%
distribute-rgt-in2.3%
Simplified2.3%
Taylor expanded in k around 0 9.8%
Final simplification51.0%
(FPCore (a k m) :precision binary64 (if (<= k -0.245) (/ a (* k (+ k 10.0))) (if (<= k 3.5) (/ a (+ 1.0 (* k 10.0))) (* (/ a k) (/ 1.0 (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= -0.245) {
tmp = a / (k * (k + 10.0));
} else if (k <= 3.5) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) * (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 <= (-0.245d0)) then
tmp = a / (k * (k + 10.0d0))
else if (k <= 3.5d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / k) * (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 <= -0.245) {
tmp = a / (k * (k + 10.0));
} else if (k <= 3.5) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) * (1.0 / (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -0.245: tmp = a / (k * (k + 10.0)) elif k <= 3.5: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) * (1.0 / (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -0.245) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (k <= 3.5) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) * Float64(1.0 / Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -0.245) tmp = a / (k * (k + 10.0)); elseif (k <= 3.5) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) * (1.0 / (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -0.245], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.5], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(1.0 / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -0.245:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 3.5:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{1}{k + 10}\\
\end{array}
\end{array}
if k < -0.245Initial program 78.9%
associate-/l*78.9%
sqr-neg78.9%
associate-+l+78.9%
sqr-neg78.9%
distribute-rgt-out78.9%
Simplified78.9%
Taylor expanded in m around 0 41.4%
clear-num41.4%
inv-pow41.4%
+-commutative41.4%
+-commutative41.4%
fma-udef41.4%
Applied egg-rr41.4%
unpow-141.4%
Simplified41.4%
Taylor expanded in k around inf 41.4%
+-commutative41.4%
unpow241.4%
distribute-rgt-in41.4%
Simplified41.4%
Taylor expanded in a around 0 41.4%
associate-/r*36.4%
+-commutative36.4%
associate-/r*41.4%
Simplified41.4%
if -0.245 < k < 3.5Initial 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 37.5%
Taylor expanded in k around 0 36.8%
*-commutative36.8%
Simplified36.8%
if 3.5 < k Initial program 76.6%
associate-/l*76.6%
sqr-neg76.6%
associate-+l+76.6%
sqr-neg76.6%
distribute-rgt-out76.6%
Simplified76.6%
Taylor expanded in m around 0 55.4%
clear-num54.0%
inv-pow54.0%
+-commutative54.0%
+-commutative54.0%
fma-udef54.0%
Applied egg-rr54.0%
unpow-154.0%
Simplified54.0%
Taylor expanded in k around inf 54.0%
+-commutative54.0%
unpow254.0%
distribute-rgt-in54.0%
Simplified54.0%
associate-/l*55.4%
*-commutative55.4%
times-frac63.6%
Applied egg-rr63.6%
Final simplification47.6%
(FPCore (a k m) :precision binary64 (if (or (<= k -33000000000000.0) (not (<= k 0.075))) (* 0.1 (/ a k)) (+ a (* (* k a) -10.0))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -33000000000000.0) || !(k <= 0.075)) {
tmp = 0.1 * (a / k);
} else {
tmp = a + ((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 ((k <= (-33000000000000.0d0)) .or. (.not. (k <= 0.075d0))) then
tmp = 0.1d0 * (a / k)
else
tmp = a + ((k * a) * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -33000000000000.0) || !(k <= 0.075)) {
tmp = 0.1 * (a / k);
} else {
tmp = a + ((k * a) * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -33000000000000.0) or not (k <= 0.075): tmp = 0.1 * (a / k) else: tmp = a + ((k * a) * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -33000000000000.0) || !(k <= 0.075)) tmp = Float64(0.1 * Float64(a / k)); else tmp = Float64(a + Float64(Float64(k * a) * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -33000000000000.0) || ~((k <= 0.075))) tmp = 0.1 * (a / k); else tmp = a + ((k * a) * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -33000000000000.0], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -33000000000000 \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a + \left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if k < -3.3e13 or 0.0749999999999999972 < k Initial program 77.3%
associate-/l*77.3%
sqr-neg77.3%
associate-+l+77.3%
sqr-neg77.3%
distribute-rgt-out77.3%
Simplified77.3%
Taylor expanded in m around 0 51.4%
clear-num50.4%
inv-pow50.4%
+-commutative50.4%
+-commutative50.4%
fma-udef50.4%
Applied egg-rr50.4%
unpow-150.4%
Simplified50.4%
Taylor expanded in k around inf 50.4%
+-commutative50.4%
unpow250.4%
distribute-rgt-in50.4%
Simplified50.4%
Taylor expanded in k around 0 21.2%
if -3.3e13 < k < 0.0749999999999999972Initial 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 37.5%
Taylor expanded in k around 0 36.7%
Final simplification28.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -5000000.0) (not (<= k 0.075))) (/ a (* k (+ k 10.0))) (+ a (* (* k a) -10.0))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -5000000.0) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + ((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 ((k <= (-5000000.0d0)) .or. (.not. (k <= 0.075d0))) then
tmp = a / (k * (k + 10.0d0))
else
tmp = a + ((k * a) * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -5000000.0) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + ((k * a) * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -5000000.0) or not (k <= 0.075): tmp = a / (k * (k + 10.0)) else: tmp = a + ((k * a) * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -5000000.0) || !(k <= 0.075)) tmp = Float64(a / Float64(k * Float64(k + 10.0))); else tmp = Float64(a + Float64(Float64(k * a) * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -5000000.0) || ~((k <= 0.075))) tmp = a / (k * (k + 10.0)); else tmp = a + ((k * a) * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -5000000.0], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -5000000 \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + \left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if k < -5e6 or 0.0749999999999999972 < k Initial program 77.3%
associate-/l*77.3%
sqr-neg77.3%
associate-+l+77.3%
sqr-neg77.3%
distribute-rgt-out77.3%
Simplified77.3%
Taylor expanded in m around 0 51.4%
clear-num50.4%
inv-pow50.4%
+-commutative50.4%
+-commutative50.4%
fma-udef50.4%
Applied egg-rr50.4%
unpow-150.4%
Simplified50.4%
Taylor expanded in k around inf 50.4%
+-commutative50.4%
unpow250.4%
distribute-rgt-in50.4%
Simplified50.4%
Taylor expanded in a around 0 51.4%
associate-/r*56.0%
+-commutative56.0%
associate-/r*51.4%
Simplified51.4%
if -5e6 < k < 0.0749999999999999972Initial 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 37.5%
Taylor expanded in k around 0 36.7%
Final simplification44.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -0.14) (not (<= k 3.5))) (/ a (* k (+ k 10.0))) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -0.14) || !(k <= 3.5)) {
tmp = a / (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 <= (-0.14d0)) .or. (.not. (k <= 3.5d0))) then
tmp = a / (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 <= -0.14) || !(k <= 3.5)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -0.14) or not (k <= 3.5): tmp = a / (k * (k + 10.0)) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -0.14) || !(k <= 3.5)) tmp = Float64(a / 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 <= -0.14) || ~((k <= 3.5))) tmp = a / (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, -0.14], N[Not[LessEqual[k, 3.5]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $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 -0.14 \lor \neg \left(k \leq 3.5\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < -0.14000000000000001 or 3.5 < k Initial program 77.3%
associate-/l*77.3%
sqr-neg77.3%
associate-+l+77.3%
sqr-neg77.3%
distribute-rgt-out77.3%
Simplified77.3%
Taylor expanded in m around 0 51.4%
clear-num50.4%
inv-pow50.4%
+-commutative50.4%
+-commutative50.4%
fma-udef50.4%
Applied egg-rr50.4%
unpow-150.4%
Simplified50.4%
Taylor expanded in k around inf 50.4%
+-commutative50.4%
unpow250.4%
distribute-rgt-in50.4%
Simplified50.4%
Taylor expanded in a around 0 51.4%
associate-/r*56.0%
+-commutative56.0%
associate-/r*51.4%
Simplified51.4%
if -0.14000000000000001 < k < 3.5Initial 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 37.5%
Taylor expanded in k around 0 36.8%
*-commutative36.8%
Simplified36.8%
Final simplification44.5%
(FPCore (a k m) :precision binary64 (if (<= k -6.4e+15) (* 0.1 (/ a k)) (if (<= k 0.075) (+ a (* (* k a) -10.0)) (/ 1.0 (/ (* k 10.0) a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -6.4e+15) {
tmp = 0.1 * (a / k);
} else if (k <= 0.075) {
tmp = a + ((k * a) * -10.0);
} else {
tmp = 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 (k <= (-6.4d+15)) then
tmp = 0.1d0 * (a / k)
else if (k <= 0.075d0) then
tmp = a + ((k * a) * (-10.0d0))
else
tmp = 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 (k <= -6.4e+15) {
tmp = 0.1 * (a / k);
} else if (k <= 0.075) {
tmp = a + ((k * a) * -10.0);
} else {
tmp = 1.0 / ((k * 10.0) / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -6.4e+15: tmp = 0.1 * (a / k) elif k <= 0.075: tmp = a + ((k * a) * -10.0) else: tmp = 1.0 / ((k * 10.0) / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -6.4e+15) tmp = Float64(0.1 * Float64(a / k)); elseif (k <= 0.075) tmp = Float64(a + Float64(Float64(k * a) * -10.0)); else tmp = Float64(1.0 / Float64(Float64(k * 10.0) / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -6.4e+15) tmp = 0.1 * (a / k); elseif (k <= 0.075) tmp = a + ((k * a) * -10.0); else tmp = 1.0 / ((k * 10.0) / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -6.4e+15], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(k * 10.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -6.4 \cdot 10^{+15}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + \left(k \cdot a\right) \cdot -10\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{k \cdot 10}{a}}\\
\end{array}
\end{array}
if k < -6.4e15Initial program 78.4%
associate-/l*78.4%
sqr-neg78.4%
associate-+l+78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
Simplified78.4%
Taylor expanded in m around 0 42.4%
clear-num42.4%
inv-pow42.4%
+-commutative42.4%
+-commutative42.4%
fma-udef42.4%
Applied egg-rr42.4%
unpow-142.4%
Simplified42.4%
Taylor expanded in k around inf 42.4%
+-commutative42.4%
unpow242.4%
distribute-rgt-in42.4%
Simplified42.4%
Taylor expanded in k around 0 19.4%
if -6.4e15 < k < 0.0749999999999999972Initial 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 37.5%
Taylor expanded in k around 0 36.7%
if 0.0749999999999999972 < k Initial program 76.9%
associate-/l*76.9%
sqr-neg76.9%
associate-+l+76.9%
sqr-neg76.9%
distribute-rgt-out76.9%
Simplified76.9%
Taylor expanded in m around 0 54.8%
clear-num53.5%
inv-pow53.5%
+-commutative53.5%
+-commutative53.5%
fma-udef53.5%
Applied egg-rr53.5%
unpow-153.5%
Simplified53.5%
Taylor expanded in k around inf 53.5%
+-commutative53.5%
unpow253.5%
distribute-rgt-in53.5%
Simplified53.5%
Taylor expanded in k around 0 23.2%
associate-*r/23.2%
*-commutative23.2%
Simplified23.2%
Final simplification29.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* k (+ k 10.0)))) (if (<= m -5.2e+19) (/ a t_0) (/ a (+ 1.0 t_0)))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -5.2e+19) {
tmp = a / t_0;
} 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 <= (-5.2d+19)) then
tmp = a / t_0
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 <= -5.2e+19) {
tmp = a / t_0;
} else {
tmp = a / (1.0 + t_0);
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -5.2e+19: tmp = a / t_0 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 <= -5.2e+19) tmp = Float64(a / t_0); 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 <= -5.2e+19) tmp = a / t_0; 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, -5.2e+19], N[(a / t$95$0), $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 -5.2 \cdot 10^{+19}:\\
\;\;\;\;\frac{a}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + t_0}\\
\end{array}
\end{array}
if m < -5.2e19Initial 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 29.3%
clear-num29.3%
inv-pow29.3%
+-commutative29.3%
+-commutative29.3%
fma-udef29.3%
Applied egg-rr29.3%
unpow-129.3%
Simplified29.3%
Taylor expanded in k around inf 42.9%
+-commutative42.9%
unpow242.9%
distribute-rgt-in42.9%
Simplified42.9%
Taylor expanded in a around 0 42.9%
associate-/r*39.5%
+-commutative39.5%
associate-/r*42.9%
Simplified42.9%
if -5.2e19 < m Initial program 82.5%
associate-/l*82.5%
sqr-neg82.5%
associate-+l+82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
Simplified82.5%
Taylor expanded in m around 0 52.1%
Final simplification49.2%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.45e+16) (not (<= k 3.5))) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.45e+16) || !(k <= 3.5)) {
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 ((k <= (-1.45d+16)) .or. (.not. (k <= 3.5d0))) 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 ((k <= -1.45e+16) || !(k <= 3.5)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.45e+16) or not (k <= 3.5): tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.45e+16) || !(k <= 3.5)) 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 ((k <= -1.45e+16) || ~((k <= 3.5))) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.45e+16], N[Not[LessEqual[k, 3.5]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.45 \cdot 10^{+16} \lor \neg \left(k \leq 3.5\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -1.45e16 or 3.5 < k Initial program 77.1%
associate-/l*77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 51.8%
clear-num50.8%
inv-pow50.8%
+-commutative50.8%
+-commutative50.8%
fma-udef50.8%
Applied egg-rr50.8%
unpow-150.8%
Simplified50.8%
Taylor expanded in k around inf 50.8%
+-commutative50.8%
unpow250.8%
distribute-rgt-in50.8%
Simplified50.8%
Taylor expanded in k around 0 21.4%
if -1.45e16 < k < 3.5Initial 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 37.2%
Taylor expanded in k around 0 36.1%
Final simplification28.4%
(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.0%
associate-/l*88.0%
sqr-neg88.0%
associate-+l+88.0%
sqr-neg88.0%
distribute-rgt-out88.0%
Simplified88.0%
Taylor expanded in m around 0 44.8%
Taylor expanded in k around 0 19.3%
Final simplification19.3%
herbie shell --seed 2023322
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))