
(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))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 2e+226)
(* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0)))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+226) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if ((t_0 / ((k * k) + (1.0d0 + (k * 10.0d0)))) <= 2d+226) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+226) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+226: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 2e+226) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+226) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+226], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 2 \cdot 10^{+226}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 1.99999999999999992e226Initial program 98.4%
associate-/l*98.4%
remove-double-neg98.4%
distribute-frac-neg298.4%
distribute-neg-frac298.4%
remove-double-neg98.4%
sqr-neg98.4%
associate-+l+98.4%
sqr-neg98.4%
distribute-rgt-out98.4%
Simplified98.4%
if 1.99999999999999992e226 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 63.1%
associate-/l*63.1%
remove-double-neg63.1%
distribute-frac-neg263.1%
distribute-neg-frac263.1%
remove-double-neg63.1%
sqr-neg63.1%
associate-+l+63.1%
sqr-neg63.1%
distribute-rgt-out63.1%
Simplified63.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (a k m)
:precision binary64
(if (<= m -1e-17)
(* a (/ (pow k m) (+ 1.0 (* k 10.0))))
(if (<= m 2.15e-14)
(* 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 <= -1e-17) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 2.15e-14) {
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 <= (-1d-17)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 2.15d-14) 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 <= -1e-17) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 2.15e-14) {
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 <= -1e-17: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 2.15e-14: 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 <= -1e-17) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 2.15e-14) 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 <= -1e-17) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 2.15e-14) 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, -1e-17], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.15e-14], 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 -1 \cdot 10^{-17}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 2.15 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.00000000000000007e-17Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.00000000000000007e-17 < m < 2.14999999999999999e-14Initial program 96.4%
associate-/l*96.4%
remove-double-neg96.4%
distribute-frac-neg296.4%
distribute-neg-frac296.4%
remove-double-neg96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out96.4%
Simplified96.4%
Taylor expanded in m around 0 96.4%
if 2.14999999999999999e-14 < m Initial program 75.8%
associate-/l*75.8%
remove-double-neg75.8%
distribute-frac-neg275.8%
distribute-neg-frac275.8%
remove-double-neg75.8%
sqr-neg75.8%
associate-+l+75.8%
sqr-neg75.8%
distribute-rgt-out75.8%
Simplified75.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -5200000000.0) (not (<= m 2.1e-14))) (* 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 <= -5200000000.0) || !(m <= 2.1e-14)) {
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 <= (-5200000000.0d0)) .or. (.not. (m <= 2.1d-14))) 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 <= -5200000000.0) || !(m <= 2.1e-14)) {
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 <= -5200000000.0) or not (m <= 2.1e-14): 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 <= -5200000000.0) || !(m <= 2.1e-14)) 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 <= -5200000000.0) || ~((m <= 2.1e-14))) 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, -5200000000.0], N[Not[LessEqual[m, 2.1e-14]], $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 -5200000000 \lor \neg \left(m \leq 2.1 \cdot 10^{-14}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.2e9 or 2.0999999999999999e-14 < m Initial program 85.8%
associate-/l*85.8%
remove-double-neg85.8%
distribute-frac-neg285.8%
distribute-neg-frac285.8%
remove-double-neg85.8%
sqr-neg85.8%
associate-+l+85.8%
sqr-neg85.8%
distribute-rgt-out85.8%
Simplified85.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -5.2e9 < m < 2.0999999999999999e-14Initial program 96.6%
associate-/l*96.6%
remove-double-neg96.6%
distribute-frac-neg296.6%
distribute-neg-frac296.6%
remove-double-neg96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
Taylor expanded in m around 0 95.6%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 2.15e-14) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* a (- 1.0 (* k (+ 10.0 (* k -99.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * (1.0 - (k * (10.0 + (k * -99.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.15d-14) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a * (1.0d0 - (k * (10.0d0 + (k * (-99.0d0)))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * (1.0 - (k * (10.0 + (k * -99.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.15e-14: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a * (1.0 - (k * (10.0 + (k * -99.0)))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.15e-14) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * Float64(1.0 - Float64(k * Float64(10.0 + Float64(k * -99.0))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.15e-14) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a * (1.0 - (k * (10.0 + (k * -99.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.15e-14], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 - N[(k * N[(10.0 + N[(k * -99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.15 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 - k \cdot \left(10 + k \cdot -99\right)\right)\\
\end{array}
\end{array}
if m < 2.14999999999999999e-14Initial program 98.1%
associate-/l*98.1%
remove-double-neg98.1%
distribute-frac-neg298.1%
distribute-neg-frac298.1%
remove-double-neg98.1%
sqr-neg98.1%
associate-+l+98.1%
sqr-neg98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in m around 0 68.1%
if 2.14999999999999999e-14 < m Initial program 75.8%
associate-/l*75.8%
remove-double-neg75.8%
distribute-frac-neg275.8%
distribute-neg-frac275.8%
remove-double-neg75.8%
sqr-neg75.8%
associate-+l+75.8%
sqr-neg75.8%
distribute-rgt-out75.8%
Simplified75.8%
Taylor expanded in m around 0 4.2%
Taylor expanded in k around 0 29.5%
cancel-sign-sub-inv29.5%
mul-1-neg29.5%
distribute-rgt1-in29.5%
metadata-eval29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in a around 0 34.3%
metadata-eval34.3%
cancel-sign-sub-inv34.3%
associate-*r*34.3%
neg-mul-134.3%
cancel-sign-sub-inv34.3%
metadata-eval34.3%
*-commutative34.3%
Simplified34.3%
Final simplification55.0%
(FPCore (a k m) :precision binary64 (if (<= m 2.15e-14) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.15d-14) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.15e-14: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.15e-14) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.15e-14) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.15e-14], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.15 \cdot 10^{-14}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 2.14999999999999999e-14Initial program 98.1%
associate-/l*98.1%
remove-double-neg98.1%
distribute-frac-neg298.1%
distribute-neg-frac298.1%
remove-double-neg98.1%
sqr-neg98.1%
associate-+l+98.1%
sqr-neg98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in m around 0 68.1%
if 2.14999999999999999e-14 < m Initial program 75.8%
associate-/l*75.8%
remove-double-neg75.8%
distribute-frac-neg275.8%
distribute-neg-frac275.8%
remove-double-neg75.8%
sqr-neg75.8%
associate-+l+75.8%
sqr-neg75.8%
distribute-rgt-out75.8%
Simplified75.8%
Taylor expanded in m around 0 4.2%
Taylor expanded in k around 0 29.5%
cancel-sign-sub-inv29.5%
mul-1-neg29.5%
distribute-rgt1-in29.5%
metadata-eval29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in k around inf 29.5%
Final simplification53.2%
(FPCore (a k m) :precision binary64 (if (<= m 2.15e-14) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.15d-14) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.15e-14) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.15e-14: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.15e-14) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.15e-14) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.15e-14], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.15 \cdot 10^{-14}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 2.14999999999999999e-14Initial program 98.1%
associate-/l*98.1%
remove-double-neg98.1%
distribute-frac-neg298.1%
distribute-neg-frac298.1%
remove-double-neg98.1%
sqr-neg98.1%
associate-+l+98.1%
sqr-neg98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in m around 0 68.1%
if 2.14999999999999999e-14 < m Initial program 75.8%
associate-/l*75.8%
remove-double-neg75.8%
distribute-frac-neg275.8%
distribute-neg-frac275.8%
remove-double-neg75.8%
sqr-neg75.8%
associate-+l+75.8%
sqr-neg75.8%
distribute-rgt-out75.8%
Simplified75.8%
Taylor expanded in m around 0 4.2%
Taylor expanded in k around 0 29.5%
cancel-sign-sub-inv29.5%
mul-1-neg29.5%
distribute-rgt1-in29.5%
metadata-eval29.5%
metadata-eval29.5%
Simplified29.5%
Taylor expanded in k around inf 29.5%
Final simplification53.2%
(FPCore (a k m) :precision binary64 (if (<= m 60000000000.0) (/ a (* k (+ 10.0 (/ 1.0 k)))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 60000000000.0) {
tmp = a / (k * (10.0 + (1.0 / k)));
} else {
tmp = a + (k * (99.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 <= 60000000000.0d0) then
tmp = a / (k * (10.0d0 + (1.0d0 / k)))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 60000000000.0) {
tmp = a / (k * (10.0 + (1.0 / k)));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 60000000000.0: tmp = a / (k * (10.0 + (1.0 / k))) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 60000000000.0) tmp = Float64(a / Float64(k * Float64(10.0 + Float64(1.0 / k)))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 60000000000.0) tmp = a / (k * (10.0 + (1.0 / k))); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 60000000000.0], N[(a / N[(k * N[(10.0 + N[(1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 60000000000:\\
\;\;\;\;\frac{a}{k \cdot \left(10 + \frac{1}{k}\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 6e10Initial program 98.1%
associate-/l*98.1%
remove-double-neg98.1%
distribute-frac-neg298.1%
distribute-neg-frac298.1%
remove-double-neg98.1%
sqr-neg98.1%
associate-+l+98.1%
sqr-neg98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around 0 45.8%
*-commutative84.3%
Simplified45.8%
Taylor expanded in k around inf 46.4%
if 6e10 < m Initial program 74.7%
associate-/l*74.7%
remove-double-neg74.7%
distribute-frac-neg274.7%
distribute-neg-frac274.7%
remove-double-neg74.7%
sqr-neg74.7%
associate-+l+74.7%
sqr-neg74.7%
distribute-rgt-out74.7%
Simplified74.7%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 29.3%
cancel-sign-sub-inv29.3%
mul-1-neg29.3%
distribute-rgt1-in29.3%
metadata-eval29.3%
metadata-eval29.3%
Simplified29.3%
Taylor expanded in k around inf 29.3%
(FPCore (a k m) :precision binary64 (if (<= m 2.3e-11) (/ a (+ 1.0 (* k 10.0))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.3e-11) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.3d-11) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.3e-11) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.3e-11: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.3e-11) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.3e-11) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.3e-11], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.3 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 2.30000000000000014e-11Initial program 98.1%
associate-/l*98.1%
remove-double-neg98.1%
distribute-frac-neg298.1%
distribute-neg-frac298.1%
remove-double-neg98.1%
sqr-neg98.1%
associate-+l+98.1%
sqr-neg98.1%
distribute-rgt-out98.1%
Simplified98.1%
Taylor expanded in m around 0 68.1%
Taylor expanded in k around 0 46.3%
*-commutative84.0%
Simplified46.3%
if 2.30000000000000014e-11 < m Initial program 75.5%
associate-/l*75.5%
remove-double-neg75.5%
distribute-frac-neg275.5%
distribute-neg-frac275.5%
remove-double-neg75.5%
sqr-neg75.5%
associate-+l+75.5%
sqr-neg75.5%
distribute-rgt-out75.5%
Simplified75.5%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 29.0%
cancel-sign-sub-inv29.0%
mul-1-neg29.0%
distribute-rgt1-in29.0%
metadata-eval29.0%
metadata-eval29.0%
Simplified29.0%
Taylor expanded in k around inf 29.0%
(FPCore (a k m) :precision binary64 (if (<= m 2.5e+15) (/ a (+ 1.0 (* k 10.0))) (+ a (* (* a k) -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.5e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + ((a * 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 <= 2.5d+15) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + ((a * k) * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.5e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + ((a * k) * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.5e+15: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + ((a * k) * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.5e+15) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(Float64(a * k) * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.5e+15) tmp = a / (1.0 + (k * 10.0)); else tmp = a + ((a * k) * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.5e+15], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(a * k), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + \left(a \cdot k\right) \cdot -10\\
\end{array}
\end{array}
if m < 2.5e15Initial program 97.5%
associate-/l*97.6%
remove-double-neg97.6%
distribute-frac-neg297.6%
distribute-neg-frac297.6%
remove-double-neg97.6%
sqr-neg97.6%
associate-+l+97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
Simplified97.6%
Taylor expanded in m around 0 66.4%
Taylor expanded in k around 0 45.3%
*-commutative84.5%
Simplified45.3%
if 2.5e15 < m Initial program 75.3%
associate-/l*75.3%
remove-double-neg75.3%
distribute-frac-neg275.3%
distribute-neg-frac275.3%
remove-double-neg75.3%
sqr-neg75.3%
associate-+l+75.3%
sqr-neg75.3%
distribute-rgt-out75.3%
Simplified75.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 12.4%
*-commutative12.4%
Simplified12.4%
Final simplification33.3%
(FPCore (a k m) :precision binary64 (if (<= k 0.0031) (+ a (* (* a k) -10.0)) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a + ((a * k) * -10.0);
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.0031d0) then
tmp = a + ((a * k) * (-10.0d0))
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a + ((a * k) * -10.0);
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.0031: tmp = a + ((a * k) * -10.0) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.0031) tmp = Float64(a + Float64(Float64(a * k) * -10.0)); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.0031) tmp = a + ((a * k) * -10.0); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.0031], N[(a + N[(N[(a * k), $MachinePrecision] * -10.0), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.0031:\\
\;\;\;\;a + \left(a \cdot k\right) \cdot -10\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.00309999999999999989Initial program 92.1%
associate-/l*92.2%
remove-double-neg92.2%
distribute-frac-neg292.2%
distribute-neg-frac292.2%
remove-double-neg92.2%
sqr-neg92.2%
associate-+l+92.2%
sqr-neg92.2%
distribute-rgt-out92.2%
Simplified92.2%
Taylor expanded in m around 0 32.7%
Taylor expanded in k around 0 32.2%
*-commutative32.2%
Simplified32.2%
if 0.00309999999999999989 < k Initial program 84.5%
associate-/l*84.5%
remove-double-neg84.5%
distribute-frac-neg284.5%
distribute-neg-frac284.5%
remove-double-neg84.5%
sqr-neg84.5%
associate-+l+84.5%
sqr-neg84.5%
distribute-rgt-out84.5%
Simplified84.5%
Taylor expanded in m around 0 63.1%
Taylor expanded in k around 0 32.1%
*-commutative72.1%
Simplified32.1%
Taylor expanded in k around inf 31.1%
clear-num32.3%
un-div-inv32.3%
Applied egg-rr32.3%
Final simplification32.2%
(FPCore (a k m) :precision binary64 (if (<= k 0.0031) a (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.0031d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.0031: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.0031) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.0031) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.0031], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.0031:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.00309999999999999989Initial program 92.1%
associate-/l*92.2%
remove-double-neg92.2%
distribute-frac-neg292.2%
distribute-neg-frac292.2%
remove-double-neg92.2%
sqr-neg92.2%
associate-+l+92.2%
sqr-neg92.2%
distribute-rgt-out92.2%
Simplified92.2%
Taylor expanded in m around 0 32.7%
Taylor expanded in k around 0 27.0%
if 0.00309999999999999989 < k Initial program 84.5%
associate-/l*84.5%
remove-double-neg84.5%
distribute-frac-neg284.5%
distribute-neg-frac284.5%
remove-double-neg84.5%
sqr-neg84.5%
associate-+l+84.5%
sqr-neg84.5%
distribute-rgt-out84.5%
Simplified84.5%
Taylor expanded in m around 0 63.1%
Taylor expanded in k around 0 32.1%
*-commutative72.1%
Simplified32.1%
Taylor expanded in k around inf 31.1%
clear-num32.3%
un-div-inv32.3%
Applied egg-rr32.3%
(FPCore (a k m) :precision binary64 (if (<= k 0.0031) a (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.0031d0) then
tmp = a
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.0031) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.0031: tmp = a else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.0031) tmp = a; else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.0031) tmp = a; else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.0031], a, N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.0031:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.00309999999999999989Initial program 92.1%
associate-/l*92.2%
remove-double-neg92.2%
distribute-frac-neg292.2%
distribute-neg-frac292.2%
remove-double-neg92.2%
sqr-neg92.2%
associate-+l+92.2%
sqr-neg92.2%
distribute-rgt-out92.2%
Simplified92.2%
Taylor expanded in m around 0 32.7%
Taylor expanded in k around 0 27.0%
if 0.00309999999999999989 < k Initial program 84.5%
associate-/l*84.5%
remove-double-neg84.5%
distribute-frac-neg284.5%
distribute-neg-frac284.5%
remove-double-neg84.5%
sqr-neg84.5%
associate-+l+84.5%
sqr-neg84.5%
distribute-rgt-out84.5%
Simplified84.5%
Taylor expanded in m around 0 63.1%
Taylor expanded in k around 0 32.1%
*-commutative72.1%
Simplified32.1%
Taylor expanded in k around inf 31.1%
(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 89.5%
associate-/l*89.5%
remove-double-neg89.5%
distribute-frac-neg289.5%
distribute-neg-frac289.5%
remove-double-neg89.5%
sqr-neg89.5%
associate-+l+89.5%
sqr-neg89.5%
distribute-rgt-out89.5%
Simplified89.5%
Taylor expanded in m around 0 43.4%
Taylor expanded in k around 0 19.2%
herbie shell --seed 2024100
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))