
(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 14 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 (+ (+ 1.0 (* k 10.0)) (* k k))) INFINITY)
(/ t_0 (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (* k (- (* k 99.0) 10.0)))))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= ((double) INFINITY)) {
tmp = t_0 / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= Double.POSITIVE_INFINITY) {
tmp = t_0 / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= math.inf: tmp = t_0 / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= Inf) tmp = Float64(t_0 / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= Inf) tmp = t_0 / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 99.0) - 10.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[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq \infty:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\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))) < +inf.0Initial program 99.3%
associate-/l*99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
distribute-neg-frac299.3%
remove-double-neg99.3%
sqr-neg99.3%
associate-+l+99.3%
sqr-neg99.3%
distribute-rgt-out99.3%
Simplified99.3%
Taylor expanded in a around 0 99.3%
if +inf.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 0.0%
associate-/l*0.0%
remove-double-neg0.0%
distribute-frac-neg20.0%
distribute-neg-frac20.0%
remove-double-neg0.0%
sqr-neg0.0%
associate-+l+0.0%
sqr-neg0.0%
distribute-rgt-out0.0%
Simplified0.0%
Taylor expanded in m around 0 1.6%
Taylor expanded in k around 0 74.2%
cancel-sign-sub-inv74.2%
metadata-eval74.2%
associate-*r*74.2%
neg-mul-174.2%
distribute-rgt1-in74.2%
metadata-eval74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in a around 0 100.0%
Final simplification99.4%
(FPCore (a k m) :precision binary64 (if (<= m 3.5) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.5) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3.5d0) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.5) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.5: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.5) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.5) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.5], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.5:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 3.5Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
if 3.5 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 1.0) (/ t_0 (+ 1.0 (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 1.0) {
tmp = t_0 / (1.0 + (k * k));
} 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 (m <= 1.0d0) then
tmp = t_0 / (1.0d0 + (k * k))
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 (m <= 1.0) {
tmp = t_0 / (1.0 + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 1.0: tmp = t_0 / (1.0 + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 1.0) tmp = Float64(t_0 / Float64(1.0 + Float64(k * k))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= 1.0) tmp = t_0 / (1.0 + (k * k)); 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[m, 1.0], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 1:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 1Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in a around 0 99.0%
Taylor expanded in k around inf 97.7%
if 1 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 6.6) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 6.6) {
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 <= 6.6d0) 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 <= 6.6) {
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 <= 6.6: 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 <= 6.6) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * k)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6.6) 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, 6.6], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6.6:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 6.5999999999999996Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in k around inf 97.6%
if 6.5999999999999996 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.6e+20) (not (<= m 8.4e-13))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.6e+20) || !(m <= 8.4e-13)) {
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 <= (-3.6d+20)) .or. (.not. (m <= 8.4d-13))) 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 <= -3.6e+20) || !(m <= 8.4e-13)) {
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 <= -3.6e+20) or not (m <= 8.4e-13): 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 <= -3.6e+20) || !(m <= 8.4e-13)) 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 <= -3.6e+20) || ~((m <= 8.4e-13))) 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, -3.6e+20], N[Not[LessEqual[m, 8.4e-13]], $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 -3.6 \cdot 10^{+20} \lor \neg \left(m \leq 8.4 \cdot 10^{-13}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.6e20 or 8.39999999999999955e-13 < m Initial program 89.8%
associate-/l*89.8%
remove-double-neg89.8%
distribute-frac-neg289.8%
distribute-neg-frac289.8%
remove-double-neg89.8%
sqr-neg89.8%
associate-+l+89.8%
sqr-neg89.8%
distribute-rgt-out89.8%
Simplified89.8%
Taylor expanded in k around 0 99.5%
*-commutative99.5%
Simplified99.5%
if -3.6e20 < m < 8.39999999999999955e-13Initial program 97.9%
associate-/l*97.9%
remove-double-neg97.9%
distribute-frac-neg297.9%
distribute-neg-frac297.9%
remove-double-neg97.9%
sqr-neg97.9%
associate-+l+97.9%
sqr-neg97.9%
distribute-rgt-out97.9%
Simplified97.9%
Taylor expanded in m around 0 97.3%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.3) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 100.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.3) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - 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.3d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 100.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.3) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.3: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 100.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.3) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.3) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 100.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.3], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.3:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.2999999999999998Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 67.2%
if 2.2999999999999998 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 23.3%
Taylor expanded in a around 0 28.2%
Final simplification52.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.95) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 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.95d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 99.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 1.94999999999999996Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 67.2%
if 1.94999999999999996 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 23.3%
cancel-sign-sub-inv23.3%
metadata-eval23.3%
associate-*r*23.3%
neg-mul-123.3%
distribute-rgt1-in23.3%
metadata-eval23.3%
*-commutative23.3%
Simplified23.3%
Taylor expanded in a around 0 28.2%
Final simplification52.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 100.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (100.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.2d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (100.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (100.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (100.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(100.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (100.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(100.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(100 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 67.2%
if 2.2000000000000002 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 23.3%
Taylor expanded in k around inf 23.3%
Final simplification50.9%
(FPCore (a k m) :precision binary64 (if (<= m 1.92) (/ a (+ 1.0 (* k k))) (+ a (* k (* 100.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.92) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (100.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 <= 1.92d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (100.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.92) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (100.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.92: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (100.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.92) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(100.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.92) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (100.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.92], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(100.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.92:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(100 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 1.9199999999999999Initial program 99.0%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around inf 65.9%
if 1.9199999999999999 < m Initial program 81.1%
associate-/l*81.1%
remove-double-neg81.1%
distribute-frac-neg281.1%
distribute-neg-frac281.1%
remove-double-neg81.1%
sqr-neg81.1%
associate-+l+81.1%
sqr-neg81.1%
distribute-rgt-out81.1%
Simplified81.1%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 23.3%
Taylor expanded in k around inf 23.3%
(FPCore (a k m) :precision binary64 (if (<= m 2.2e+35) (/ a (+ 1.0 (* k k))) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2e+35) {
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 <= 2.2d+35) 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 <= 2.2e+35) {
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 <= 2.2e+35: 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 <= 2.2e+35) 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 <= 2.2e+35) 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, 2.2e+35], 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 2.2 \cdot 10^{+35}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < 2.1999999999999999e35Initial program 97.3%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 63.9%
Taylor expanded in k around inf 62.6%
if 2.1999999999999999e35 < m Initial program 82.6%
associate-/l*82.6%
remove-double-neg82.6%
distribute-frac-neg282.6%
distribute-neg-frac282.6%
remove-double-neg82.6%
sqr-neg82.6%
associate-+l+82.6%
sqr-neg82.6%
distribute-rgt-out82.6%
Simplified82.6%
Taylor expanded in k around 0 79.1%
associate-*r*79.1%
*-lft-identity79.1%
distribute-rgt-out79.1%
*-commutative79.1%
fma-define79.1%
Simplified79.1%
Taylor expanded in m around 0 11.9%
Final simplification45.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.7e+42) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.7e+42) {
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 <= 2.7d+42) 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 <= 2.7e+42) {
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 <= 2.7e+42: 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 <= 2.7e+42) 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 <= 2.7e+42) 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, 2.7e+42], 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 2.7 \cdot 10^{+42}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < 2.7000000000000001e42Initial program 97.3%
associate-/l*97.3%
remove-double-neg97.3%
distribute-frac-neg297.3%
distribute-neg-frac297.3%
remove-double-neg97.3%
sqr-neg97.3%
associate-+l+97.3%
sqr-neg97.3%
distribute-rgt-out97.3%
Simplified97.3%
Taylor expanded in m around 0 63.2%
Taylor expanded in k around 0 34.6%
*-commutative34.6%
Simplified34.6%
if 2.7000000000000001e42 < m Initial program 82.1%
associate-/l*82.1%
remove-double-neg82.1%
distribute-frac-neg282.1%
distribute-neg-frac282.1%
remove-double-neg82.1%
sqr-neg82.1%
associate-+l+82.1%
sqr-neg82.1%
distribute-rgt-out82.1%
Simplified82.1%
Taylor expanded in k around 0 78.6%
associate-*r*78.6%
*-lft-identity78.6%
distribute-rgt-out78.6%
*-commutative78.6%
fma-define78.6%
Simplified78.6%
Taylor expanded in m around 0 12.1%
Final simplification27.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.00044) (* 0.1 (/ a k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.00044) {
tmp = 0.1 * (a / 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 <= (-0.00044d0)) then
tmp = 0.1d0 * (a / 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 <= -0.00044) {
tmp = 0.1 * (a / k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.00044: tmp = 0.1 * (a / k) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.00044) tmp = Float64(0.1 * Float64(a / 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 <= -0.00044) tmp = 0.1 * (a / k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.00044], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00044:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -4.40000000000000016e-4Initial 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 m around 0 39.4%
Taylor expanded in k around 0 13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 18.0%
if -4.40000000000000016e-4 < m Initial program 88.7%
associate-/l*88.7%
remove-double-neg88.7%
distribute-frac-neg288.7%
distribute-neg-frac288.7%
remove-double-neg88.7%
sqr-neg88.7%
associate-+l+88.7%
sqr-neg88.7%
distribute-rgt-out88.7%
Simplified88.7%
Taylor expanded in k around 0 66.6%
associate-*r*66.6%
*-lft-identity66.6%
distribute-rgt-out66.6%
*-commutative66.6%
fma-define66.6%
Simplified66.6%
Taylor expanded in m around 0 31.4%
Final simplification27.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.00021) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.00021) {
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 (m <= (-0.00021d0)) 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 (m <= -0.00021) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.00021: tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.00021) 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 (m <= -0.00021) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.00021], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00021:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -2.1000000000000001e-4Initial 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 m around 0 39.4%
Taylor expanded in k around 0 13.6%
*-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 18.0%
if -2.1000000000000001e-4 < m Initial program 88.7%
associate-/l*88.7%
remove-double-neg88.7%
distribute-frac-neg288.7%
distribute-neg-frac288.7%
remove-double-neg88.7%
sqr-neg88.7%
associate-+l+88.7%
sqr-neg88.7%
distribute-rgt-out88.7%
Simplified88.7%
Taylor expanded in m around 0 45.3%
Taylor expanded in k around 0 27.5%
(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.3%
associate-/l*92.3%
remove-double-neg92.3%
distribute-frac-neg292.3%
distribute-neg-frac292.3%
remove-double-neg92.3%
sqr-neg92.3%
associate-+l+92.3%
sqr-neg92.3%
distribute-rgt-out92.3%
Simplified92.3%
Taylor expanded in m around 0 43.4%
Taylor expanded in k around 0 19.8%
herbie shell --seed 2024117
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))