
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+278) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+278) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+278) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+278) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+278: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+278) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+278) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+278], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+278}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.99999999999999993e278Initial program 98.6%
if 1.99999999999999993e278 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 66.7%
associate-/l*66.7%
sqr-neg66.7%
associate-+l+66.7%
sqr-neg66.7%
distribute-rgt-out66.7%
Simplified66.7%
Taylor expanded in k around 0 100.0%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.5e-9) (/ a (/ (+ 1.0 (* k (+ k 10.0))) (pow k m))) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.5e-9) {
tmp = a / ((1.0 + (k * (k + 10.0))) / pow(k, m));
} else {
tmp = a * pow(k, (m - 2.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 <= 2.5d-9) then
tmp = a / ((1.0d0 + (k * (k + 10.0d0))) / (k ** m))
else
tmp = a * (k ** (m - 2.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.5e-9) {
tmp = a / ((1.0 + (k * (k + 10.0))) / Math.pow(k, m));
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.5e-9: tmp = a / ((1.0 + (k * (k + 10.0))) / math.pow(k, m)) else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.5e-9) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / (k ^ m))); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.5e-9) tmp = a / ((1.0 + (k * (k + 10.0))) / (k ^ m)); else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.5e-9], N[(a / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot \left(k + 10\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if m < 2.5000000000000001e-9Initial program 98.3%
associate-/l*98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
if 2.5000000000000001e-9 < m Initial program 79.7%
associate-/l*79.7%
sqr-neg79.7%
associate-+l+79.7%
sqr-neg79.7%
distribute-rgt-out79.7%
Simplified79.7%
distribute-lft-in79.7%
associate-+l+79.7%
associate-/l*79.7%
*-commutative79.7%
associate-*l/79.7%
associate-+l+79.7%
distribute-lft-in79.7%
+-commutative79.7%
+-commutative79.7%
fma-udef79.7%
Applied egg-rr79.7%
div-inv79.7%
Applied egg-rr79.7%
Taylor expanded in k around inf 60.8%
un-div-inv60.8%
pow-div100.0%
Applied egg-rr100.0%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (* a (/ (/ (pow k m) k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = a * ((pow(k, m) / k) / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.0d0) then
tmp = a * (k ** m)
else
tmp = a * (((k ** m) / k) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * ((Math.pow(k, m) / k) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = a * ((math.pow(k, m) / k) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(Float64((k ^ m) / k) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = a * (((k ^ m) / k) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{\frac{{k}^{m}}{k}}{k}\\
\end{array}
\end{array}
if k < 1Initial program 97.1%
associate-/l*97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in k around 0 99.3%
if 1 < k Initial program 83.4%
associate-/l*83.4%
sqr-neg83.4%
associate-+l+83.4%
sqr-neg83.4%
distribute-rgt-out83.4%
Simplified83.4%
distribute-lft-in83.4%
associate-+l+83.4%
associate-/l*83.4%
*-commutative83.4%
associate-*l/83.4%
associate-+l+83.4%
distribute-lft-in83.4%
+-commutative83.4%
+-commutative83.4%
fma-udef83.4%
Applied egg-rr83.4%
div-inv83.4%
Applied egg-rr83.4%
Taylor expanded in k around inf 82.0%
un-div-inv82.0%
pow282.0%
associate-/r*95.1%
Applied egg-rr95.1%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -9.5e-7) (not (<= m 0.0152))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -9.5e-7) || !(m <= 0.0152)) {
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 <= (-9.5d-7)) .or. (.not. (m <= 0.0152d0))) 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 <= -9.5e-7) || !(m <= 0.0152)) {
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 <= -9.5e-7) or not (m <= 0.0152): 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 <= -9.5e-7) || !(m <= 0.0152)) 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 <= -9.5e-7) || ~((m <= 0.0152))) 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, -9.5e-7], N[Not[LessEqual[m, 0.0152]], $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 -9.5 \cdot 10^{-7} \lor \neg \left(m \leq 0.0152\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -9.5000000000000001e-7 or 0.0152 < m Initial 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 k around 0 100.0%
if -9.5000000000000001e-7 < m < 0.0152Initial program 96.9%
associate-/l*96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
Taylor expanded in m around 0 94.3%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = a * pow(k, (m - 2.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.0d0) then
tmp = a * (k ** m)
else
tmp = a * (k ** (m - 2.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if k < 1Initial program 97.1%
associate-/l*97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in k around 0 99.3%
if 1 < k Initial program 83.4%
associate-/l*83.4%
sqr-neg83.4%
associate-+l+83.4%
sqr-neg83.4%
distribute-rgt-out83.4%
Simplified83.4%
distribute-lft-in83.4%
associate-+l+83.4%
associate-/l*83.4%
*-commutative83.4%
associate-*l/83.4%
associate-+l+83.4%
distribute-lft-in83.4%
+-commutative83.4%
+-commutative83.4%
fma-udef83.4%
Applied egg-rr83.4%
div-inv83.4%
Applied egg-rr83.4%
Taylor expanded in k around inf 82.0%
un-div-inv82.0%
pow-div94.5%
Applied egg-rr94.5%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (<= m 9e+19) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 9e+19) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / 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 <= 9d+19) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / 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 <= 9e+19) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 9e+19: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 9e+19) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / 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 <= 9e+19) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 9e+19], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9 \cdot 10^{+19}:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < 9e19Initial program 98.4%
associate-/l*98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 65.5%
clear-num65.7%
inv-pow65.7%
+-commutative65.7%
+-commutative65.7%
fma-udef65.7%
Applied egg-rr65.7%
unpow-165.7%
Simplified65.7%
Taylor expanded in a around 0 65.7%
if 9e19 < m Initial 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 2.8%
Taylor expanded in k around 0 10.3%
*-commutative10.3%
Simplified10.3%
associate-*r*10.3%
distribute-rgt1-in10.3%
Applied egg-rr10.3%
Final simplification49.2%
(FPCore (a k m) :precision binary64 (if (<= m -7.2e+44) (* 0.1 (/ a k)) (if (<= m 2.2e+22) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k -10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.2e+44) {
tmp = 0.1 * (a / k);
} else if (m <= 2.2e+22) {
tmp = a / (1.0 + (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 (m <= (-7.2d+44)) then
tmp = 0.1d0 * (a / k)
else if (m <= 2.2d+22) then
tmp = a / (1.0d0 + (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 (m <= -7.2e+44) {
tmp = 0.1 * (a / k);
} else if (m <= 2.2e+22) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -7.2e+44: tmp = 0.1 * (a / k) elif m <= 2.2e+22: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -7.2e+44) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 2.2e+22) tmp = Float64(a / Float64(1.0 + 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 (m <= -7.2e+44) tmp = 0.1 * (a / k); elseif (m <= 2.2e+22) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -7.2e+44], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.2e+22], N[(a / N[(1.0 + 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}\;m \leq -7.2 \cdot 10^{+44}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 2.2 \cdot 10^{+22}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -7.2e44Initial 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 31.3%
Taylor expanded in k around 0 13.2%
*-commutative13.2%
Simplified13.2%
Taylor expanded in k around inf 24.1%
if -7.2e44 < m < 2.2e22Initial program 97.2%
associate-/l*97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 88.9%
Taylor expanded in k around 0 63.7%
*-commutative63.7%
Simplified63.7%
if 2.2e22 < m Initial 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 2.8%
Taylor expanded in k around 0 10.3%
*-commutative10.3%
Simplified10.3%
associate-*r*10.3%
distribute-rgt1-in10.3%
Applied egg-rr10.3%
Final simplification36.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.9e+21) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.9e+21) {
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 (m <= 1.9d+21) 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 (m <= 1.9e+21) {
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 m <= 1.9e+21: 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 (m <= 1.9e+21) 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 (m <= 1.9e+21) 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[LessEqual[m, 1.9e+21], 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}\;m \leq 1.9 \cdot 10^{+21}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < 1.9e21Initial program 98.4%
associate-/l*98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 65.5%
if 1.9e21 < m Initial 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 2.8%
Taylor expanded in k around 0 10.3%
*-commutative10.3%
Simplified10.3%
associate-*r*10.3%
distribute-rgt1-in10.3%
Applied egg-rr10.3%
Final simplification49.1%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.3e-295) (not (<= k 0.1))) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.3e-295) || !(k <= 0.1)) {
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.3d-295) .or. (.not. (k <= 0.1d0))) 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.3e-295) || !(k <= 0.1)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.3e-295) or not (k <= 0.1): tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.3e-295) || !(k <= 0.1)) 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.3e-295) || ~((k <= 0.1))) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.3e-295], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.3 \cdot 10^{-295} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.29999999999999993e-295 or 0.10000000000000001 < k Initial program 88.6%
associate-/l*88.6%
sqr-neg88.6%
associate-+l+88.6%
sqr-neg88.6%
distribute-rgt-out88.6%
Simplified88.6%
Taylor expanded in m around 0 41.6%
Taylor expanded in k around 0 17.5%
*-commutative17.5%
Simplified17.5%
Taylor expanded in k around inf 17.0%
if 1.29999999999999993e-295 < k < 0.10000000000000001Initial program 100.0%
associate-/l*99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 56.7%
Taylor expanded in k around 0 55.3%
Final simplification30.5%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} 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 <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
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 <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = 0.1 * (a / 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(0.1 * Float64(a / 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 = 0.1 * (a / 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[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 97.1%
associate-/l*97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 40.6%
Taylor expanded in k around 0 34.4%
*-commutative34.4%
Simplified34.4%
associate-*r*34.4%
distribute-rgt1-in34.4%
Applied egg-rr34.4%
if 0.0749999999999999972 < k Initial program 83.4%
associate-/l*83.4%
sqr-neg83.4%
associate-+l+83.4%
sqr-neg83.4%
distribute-rgt-out83.4%
Simplified83.4%
Taylor expanded in m around 0 59.8%
Taylor expanded in k around 0 25.9%
*-commutative25.9%
Simplified25.9%
Taylor expanded in k around inf 24.8%
Final simplification31.3%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (+ a (* -10.0 (* a k))) (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} 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 <= 0.075d0) then
tmp = a + ((-10.0d0) * (a * k))
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 <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a + (-10.0 * (a * k)); else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 97.1%
associate-/l*97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 40.6%
Taylor expanded in k around 0 34.4%
*-commutative34.4%
Simplified34.4%
if 0.0749999999999999972 < k Initial program 83.4%
associate-/l*83.4%
sqr-neg83.4%
associate-+l+83.4%
sqr-neg83.4%
distribute-rgt-out83.4%
Simplified83.4%
Taylor expanded in m around 0 59.8%
Taylor expanded in k around 0 25.9%
*-commutative25.9%
Simplified25.9%
Taylor expanded in k around inf 24.8%
Final simplification31.3%
(FPCore (a k m) :precision binary64 (if (<= m 5.1e+22) (/ a (+ 1.0 (* k k))) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.1e+22) {
tmp = a / (1.0 + (k * k));
} 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 <= 5.1d+22) then
tmp = a / (1.0d0 + (k * k))
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 <= 5.1e+22) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.1e+22: tmp = a / (1.0 + (k * k)) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.1e+22) tmp = Float64(a / Float64(1.0 + Float64(k * k))); 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 <= 5.1e+22) tmp = a / (1.0 + (k * k)); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.1e+22], N[(a / N[(1.0 + N[(k * k), $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 5.1 \cdot 10^{+22}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < 5.1000000000000002e22Initial program 98.4%
*-commutative98.4%
Simplified98.4%
Taylor expanded in k around 0 97.0%
Taylor expanded in m around 0 64.2%
if 5.1000000000000002e22 < m Initial 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 2.8%
Taylor expanded in k around 0 10.3%
*-commutative10.3%
Simplified10.3%
associate-*r*10.3%
distribute-rgt1-in10.3%
Applied egg-rr10.3%
Final simplification48.2%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 92.6%
associate-/l*92.6%
sqr-neg92.6%
associate-+l+92.6%
sqr-neg92.6%
distribute-rgt-out92.6%
Simplified92.6%
Taylor expanded in m around 0 46.9%
Taylor expanded in k around 0 22.2%
Final simplification22.2%
herbie shell --seed 2023337
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))