
(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 16 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 (if (<= k 6e-10) (* a (* (fma k -10.0 1.0) (pow k m))) (/ (* (/ -1.0 (- (- (/ -1.0 k) k) 10.0)) (* a (pow k m))) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 6e-10) {
tmp = a * (fma(k, -10.0, 1.0) * pow(k, m));
} else {
tmp = ((-1.0 / (((-1.0 / k) - k) - 10.0)) * (a * pow(k, m))) / k;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 6e-10) tmp = Float64(a * Float64(fma(k, -10.0, 1.0) * (k ^ m))); else tmp = Float64(Float64(Float64(-1.0 / Float64(Float64(Float64(-1.0 / k) - k) - 10.0)) * Float64(a * (k ^ m))) / k); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 6e-10], N[(a * N[(N[(k * -10.0 + 1.0), $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / N[(N[(N[(-1.0 / k), $MachinePrecision] - k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision] * N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6 \cdot 10^{-10}:\\
\;\;\;\;a \cdot \left(\mathsf{fma}\left(k, -10, 1\right) \cdot {k}^{m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{\left(\frac{-1}{k} - k\right) - 10} \cdot \left(a \cdot {k}^{m}\right)}{k}\\
\end{array}
\end{array}
if k < 6e-10Initial program 91.1%
associate-/l*91.1%
remove-double-neg91.1%
distribute-frac-neg291.1%
distribute-neg-frac291.1%
remove-double-neg91.1%
sqr-neg91.1%
associate-+l+91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
Simplified91.1%
Taylor expanded in k around 0 85.9%
associate-*r*85.9%
distribute-lft1-in100.0%
*-commutative100.0%
fma-define100.0%
Simplified100.0%
if 6e-10 < k Initial program 81.5%
*-commutative81.5%
Simplified81.5%
Taylor expanded in k around inf 81.5%
add-sqr-sqrt54.5%
distribute-lft-out54.4%
times-frac63.8%
associate-+l+63.8%
Applied egg-rr63.8%
associate-*l/63.8%
div-inv63.8%
associate-*r*63.9%
add-sqr-sqrt99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= k 3e-25) t_0 (/ (* (/ -1.0 (- (- (/ -1.0 k) k) 10.0)) t_0) k))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (k <= 3e-25) {
tmp = t_0;
} else {
tmp = ((-1.0 / (((-1.0 / k) - k) - 10.0)) * t_0) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if (k <= 3d-25) then
tmp = t_0
else
tmp = (((-1.0d0) / ((((-1.0d0) / k) - k) - 10.0d0)) * t_0) / k
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 (k <= 3e-25) {
tmp = t_0;
} else {
tmp = ((-1.0 / (((-1.0 / k) - k) - 10.0)) * t_0) / k;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if k <= 3e-25: tmp = t_0 else: tmp = ((-1.0 / (((-1.0 / k) - k) - 10.0)) * t_0) / k return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (k <= 3e-25) tmp = t_0; else tmp = Float64(Float64(Float64(-1.0 / Float64(Float64(Float64(-1.0 / k) - k) - 10.0)) * t_0) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (k <= 3e-25) tmp = t_0; else tmp = ((-1.0 / (((-1.0 / k) - k) - 10.0)) * t_0) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 3e-25], t$95$0, N[(N[(N[(-1.0 / N[(N[(N[(-1.0 / k), $MachinePrecision] - k), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;k \leq 3 \cdot 10^{-25}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{\left(\frac{-1}{k} - k\right) - 10} \cdot t\_0}{k}\\
\end{array}
\end{array}
if k < 2.9999999999999998e-25Initial program 90.9%
associate-/l*90.9%
remove-double-neg90.9%
distribute-frac-neg290.9%
distribute-neg-frac290.9%
remove-double-neg90.9%
sqr-neg90.9%
associate-+l+90.9%
sqr-neg90.9%
distribute-rgt-out90.9%
Simplified90.9%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 2.9999999999999998e-25 < k Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in k around inf 82.3%
add-sqr-sqrt55.4%
distribute-lft-out55.4%
times-frac64.3%
associate-+l+64.3%
Applied egg-rr64.3%
associate-*l/63.9%
div-inv63.9%
associate-*r*64.0%
add-sqr-sqrt99.5%
+-commutative99.5%
Applied egg-rr99.5%
Final simplification99.8%
(FPCore (a k m) :precision binary64 (if (<= k 5e-25) (* a (pow k m)) (* (/ (pow k m) k) (/ a (+ 10.0 (+ k (/ 1.0 k)))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 5e-25) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) / k) * (a / (10.0 + (k + (1.0 / 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 <= 5d-25) then
tmp = a * (k ** m)
else
tmp = ((k ** m) / k) * (a / (10.0d0 + (k + (1.0d0 / k))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 5e-25) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) / k) * (a / (10.0 + (k + (1.0 / k))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 5e-25: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) / k) * (a / (10.0 + (k + (1.0 / k)))) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 5e-25) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) / k) * Float64(a / Float64(10.0 + Float64(k + Float64(1.0 / k))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 5e-25) tmp = a * (k ^ m); else tmp = ((k ^ m) / k) * (a / (10.0 + (k + (1.0 / k)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 5e-25], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision] * N[(a / N[(10.0 + N[(k + N[(1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5 \cdot 10^{-25}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{k} \cdot \frac{a}{10 + \left(k + \frac{1}{k}\right)}\\
\end{array}
\end{array}
if k < 4.99999999999999962e-25Initial program 91.0%
associate-/l*91.0%
remove-double-neg91.0%
distribute-frac-neg291.0%
distribute-neg-frac291.0%
remove-double-neg91.0%
sqr-neg91.0%
associate-+l+91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
Simplified91.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 4.99999999999999962e-25 < k Initial program 82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in k around inf 82.1%
*-commutative82.1%
distribute-lft-out82.1%
times-frac97.2%
associate-+l+97.2%
Applied egg-rr97.2%
Final simplification99.0%
(FPCore (a k m) :precision binary64 (if (<= k 4e-26) (* a (pow k m)) (/ (* (pow k m) (/ a (+ k (- 10.0 (/ -1.0 k))))) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 4e-26) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) * (a / (k + (10.0 - (-1.0 / 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 <= 4d-26) then
tmp = a * (k ** m)
else
tmp = ((k ** m) * (a / (k + (10.0d0 - ((-1.0d0) / k))))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 4e-26) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) * (a / (k + (10.0 - (-1.0 / k))))) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 4e-26: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) * (a / (k + (10.0 - (-1.0 / k))))) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 4e-26) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) * Float64(a / Float64(k + Float64(10.0 - Float64(-1.0 / k))))) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 4e-26) tmp = a * (k ^ m); else tmp = ((k ^ m) * (a / (k + (10.0 - (-1.0 / k))))) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 4e-26], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] * N[(a / N[(k + N[(10.0 - N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-26}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \frac{a}{k + \left(10 - \frac{-1}{k}\right)}}{k}\\
\end{array}
\end{array}
if k < 4.0000000000000002e-26Initial program 90.9%
associate-/l*90.9%
remove-double-neg90.9%
distribute-frac-neg290.9%
distribute-neg-frac290.9%
remove-double-neg90.9%
sqr-neg90.9%
associate-+l+90.9%
sqr-neg90.9%
distribute-rgt-out90.9%
Simplified90.9%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 4.0000000000000002e-26 < k Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in k around inf 82.3%
add-sqr-sqrt55.4%
distribute-lft-out55.4%
times-frac64.3%
associate-+l+64.3%
Applied egg-rr64.3%
Taylor expanded in a around 0 82.3%
*-commutative82.3%
times-frac97.2%
associate-*r/97.2%
+-commutative97.2%
associate-+l+97.2%
+-commutative97.2%
Simplified97.2%
Final simplification99.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 3.8) (/ t_0 (+ (* k k) 1.0)) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 3.8) {
tmp = t_0 / ((k * k) + 1.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 (m <= 3.8d0) then
tmp = t_0 / ((k * k) + 1.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 (m <= 3.8) {
tmp = t_0 / ((k * k) + 1.0);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 3.8: tmp = t_0 / ((k * k) + 1.0) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 3.8) tmp = Float64(t_0 / Float64(Float64(k * k) + 1.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 (m <= 3.8) tmp = t_0 / ((k * k) + 1.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[m, 3.8], N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 3.8:\\
\;\;\;\;\frac{t\_0}{k \cdot k + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 3.7999999999999998Initial program 95.8%
*-commutative95.8%
Simplified95.8%
Taylor expanded in k around inf 95.8%
Taylor expanded in k around 0 94.1%
if 3.7999999999999998 < m Initial program 73.0%
associate-/l*73.0%
remove-double-neg73.0%
distribute-frac-neg273.0%
distribute-neg-frac273.0%
remove-double-neg73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification96.1%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= k 1.0) t_0 (/ (* (/ 1.0 k) t_0) k))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (k <= 1.0) {
tmp = t_0;
} else {
tmp = ((1.0 / k) * t_0) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if (k <= 1.0d0) then
tmp = t_0
else
tmp = ((1.0d0 / k) * t_0) / k
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 (k <= 1.0) {
tmp = t_0;
} else {
tmp = ((1.0 / k) * t_0) / k;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if k <= 1.0: tmp = t_0 else: tmp = ((1.0 / k) * t_0) / k return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (k <= 1.0) tmp = t_0; else tmp = Float64(Float64(Float64(1.0 / k) * t_0) / k); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (k <= 1.0) tmp = t_0; else tmp = ((1.0 / k) * t_0) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, 1.0], t$95$0, N[(N[(N[(1.0 / k), $MachinePrecision] * t$95$0), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;k \leq 1:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{k} \cdot t\_0}{k}\\
\end{array}
\end{array}
if k < 1Initial program 91.3%
associate-/l*91.3%
remove-double-neg91.3%
distribute-frac-neg291.3%
distribute-neg-frac291.3%
remove-double-neg91.3%
sqr-neg91.3%
associate-+l+91.3%
sqr-neg91.3%
distribute-rgt-out91.3%
Simplified91.3%
Taylor expanded in k around 0 99.1%
*-commutative99.1%
Simplified99.1%
if 1 < k Initial program 80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in k around inf 80.6%
add-sqr-sqrt54.7%
distribute-lft-out54.7%
times-frac64.5%
associate-+l+64.5%
Applied egg-rr64.5%
associate-*l/64.5%
div-inv64.5%
associate-*r*64.6%
add-sqr-sqrt99.9%
+-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in k around inf 98.1%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.55e-9) (not (<= m 0.015))) (* a (pow k m)) (/ a (+ (* k (+ k 10.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.55e-9) || !(m <= 0.015)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((k * (k + 10.0)) + 1.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.55d-9)) .or. (.not. (m <= 0.015d0))) then
tmp = a * (k ** m)
else
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1.55e-9) || !(m <= 0.015)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((k * (k + 10.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.55e-9) or not (m <= 0.015): tmp = a * math.pow(k, m) else: tmp = a / ((k * (k + 10.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.55e-9) || !(m <= 0.015)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.55e-9) || ~((m <= 0.015))) tmp = a * (k ^ m); else tmp = a / ((k * (k + 10.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.55e-9], N[Not[LessEqual[m, 0.015]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.55 \cdot 10^{-9} \lor \neg \left(m \leq 0.015\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\end{array}
\end{array}
if m < -1.55000000000000002e-9 or 0.014999999999999999 < m Initial program 86.0%
associate-/l*86.0%
remove-double-neg86.0%
distribute-frac-neg286.0%
distribute-neg-frac286.0%
remove-double-neg86.0%
sqr-neg86.0%
associate-+l+86.0%
sqr-neg86.0%
distribute-rgt-out86.0%
Simplified86.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.55000000000000002e-9 < m < 0.014999999999999999Initial program 91.7%
associate-/l*91.7%
remove-double-neg91.7%
distribute-frac-neg291.7%
distribute-neg-frac291.7%
remove-double-neg91.7%
sqr-neg91.7%
associate-+l+91.7%
sqr-neg91.7%
distribute-rgt-out91.7%
Simplified91.7%
Taylor expanded in m around 0 90.6%
Final simplification96.9%
(FPCore (a k m)
:precision binary64
(if (<= m -3.65e+199)
(/ (- (/ (- (* 0.001 (/ a k)) (* a 0.01)) k) (* a -0.1)) k)
(if (<= m 2.6)
(/ a (+ (* k (+ k 10.0)) 1.0))
(if (or (<= m 6e+182) (not (<= m 1.35e+271)))
(* a (+ (* k (- (* k 99.0) 10.0)) 1.0))
(/ (/ a (+ (/ 1.0 k) (+ k 10.0))) k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.65e+199) {
tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k;
} else if (m <= 2.6) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else if ((m <= 6e+182) || !(m <= 1.35e+271)) {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0);
} else {
tmp = (a / ((1.0 / k) + (k + 10.0))) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-3.65d+199)) then
tmp = ((((0.001d0 * (a / k)) - (a * 0.01d0)) / k) - (a * (-0.1d0))) / k
else if (m <= 2.6d0) then
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
else if ((m <= 6d+182) .or. (.not. (m <= 1.35d+271))) then
tmp = a * ((k * ((k * 99.0d0) - 10.0d0)) + 1.0d0)
else
tmp = (a / ((1.0d0 / k) + (k + 10.0d0))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.65e+199) {
tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k;
} else if (m <= 2.6) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else if ((m <= 6e+182) || !(m <= 1.35e+271)) {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0);
} else {
tmp = (a / ((1.0 / k) + (k + 10.0))) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.65e+199: tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k elif m <= 2.6: tmp = a / ((k * (k + 10.0)) + 1.0) elif (m <= 6e+182) or not (m <= 1.35e+271): tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0) else: tmp = (a / ((1.0 / k) + (k + 10.0))) / k return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.65e+199) tmp = Float64(Float64(Float64(Float64(Float64(0.001 * Float64(a / k)) - Float64(a * 0.01)) / k) - Float64(a * -0.1)) / k); elseif (m <= 2.6) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); elseif ((m <= 6e+182) || !(m <= 1.35e+271)) tmp = Float64(a * Float64(Float64(k * Float64(Float64(k * 99.0) - 10.0)) + 1.0)); else tmp = Float64(Float64(a / Float64(Float64(1.0 / k) + Float64(k + 10.0))) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.65e+199) tmp = ((((0.001 * (a / k)) - (a * 0.01)) / k) - (a * -0.1)) / k; elseif (m <= 2.6) tmp = a / ((k * (k + 10.0)) + 1.0); elseif ((m <= 6e+182) || ~((m <= 1.35e+271))) tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0); else tmp = (a / ((1.0 / k) + (k + 10.0))) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.65e+199], N[(N[(N[(N[(N[(0.001 * N[(a / k), $MachinePrecision]), $MachinePrecision] - N[(a * 0.01), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision] - N[(a * -0.1), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 2.6], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 6e+182], N[Not[LessEqual[m, 1.35e+271]], $MachinePrecision]], N[(a * N[(N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(1.0 / k), $MachinePrecision] + N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.65 \cdot 10^{+199}:\\
\;\;\;\;\frac{\frac{0.001 \cdot \frac{a}{k} - a \cdot 0.01}{k} - a \cdot -0.1}{k}\\
\mathbf{elif}\;m \leq 2.6:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{elif}\;m \leq 6 \cdot 10^{+182} \lor \neg \left(m \leq 1.35 \cdot 10^{+271}\right):\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99 - 10\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\frac{1}{k} + \left(k + 10\right)}}{k}\\
\end{array}
\end{array}
if m < -3.6500000000000001e199Initial 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 25.6%
Taylor expanded in k around 0 18.4%
*-commutative18.4%
Simplified18.4%
Taylor expanded in k around -inf 46.5%
if -3.6500000000000001e199 < m < 2.60000000000000009Initial program 95.0%
associate-/l*95.0%
remove-double-neg95.0%
distribute-frac-neg295.0%
distribute-neg-frac295.0%
remove-double-neg95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 69.8%
if 2.60000000000000009 < m < 6.0000000000000004e182 or 1.34999999999999995e271 < m Initial program 66.2%
associate-/l*66.2%
remove-double-neg66.2%
distribute-frac-neg266.2%
distribute-neg-frac266.2%
remove-double-neg66.2%
sqr-neg66.2%
associate-+l+66.2%
sqr-neg66.2%
distribute-rgt-out66.2%
Simplified66.2%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 32.7%
cancel-sign-sub-inv32.7%
mul-1-neg32.7%
distribute-rgt1-in32.7%
metadata-eval32.7%
metadata-eval32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in k around 0 32.7%
distribute-lft-in28.1%
*-commutative28.1%
metadata-eval28.1%
distribute-lft-neg-in28.1%
associate-*r*28.1%
*-commutative28.1%
associate-*r*28.1%
distribute-lft-in32.7%
distribute-rgt-neg-in32.7%
distribute-lft-out32.7%
distribute-lft-neg-in32.7%
metadata-eval32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in a around 0 42.7%
if 6.0000000000000004e182 < m < 1.34999999999999995e271Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in k around inf 91.7%
add-sqr-sqrt79.2%
distribute-lft-out79.2%
times-frac79.2%
associate-+l+79.2%
Applied egg-rr79.2%
associate-*l/79.2%
div-inv79.2%
associate-*r*79.2%
add-sqr-sqrt100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 39.3%
+-commutative39.3%
+-commutative39.3%
associate-+l+39.3%
Simplified39.3%
Final simplification57.6%
(FPCore (a k m)
:precision binary64
(if (<= m 1.85)
(/ a (+ (* k (+ k 10.0)) 1.0))
(if (or (<= m 4.6e+180) (not (<= m 6.5e+269)))
(* a (+ (* k (- (* k 99.0) 10.0)) 1.0))
(/ (/ a (+ (/ 1.0 k) (+ k 10.0))) k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else if ((m <= 4.6e+180) || !(m <= 6.5e+269)) {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0);
} else {
tmp = (a / ((1.0 / k) + (k + 10.0))) / 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.85d0) then
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
else if ((m <= 4.6d+180) .or. (.not. (m <= 6.5d+269))) then
tmp = a * ((k * ((k * 99.0d0) - 10.0d0)) + 1.0d0)
else
tmp = (a / ((1.0d0 / k) + (k + 10.0d0))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else if ((m <= 4.6e+180) || !(m <= 6.5e+269)) {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0);
} else {
tmp = (a / ((1.0 / k) + (k + 10.0))) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.85: tmp = a / ((k * (k + 10.0)) + 1.0) elif (m <= 4.6e+180) or not (m <= 6.5e+269): tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0) else: tmp = (a / ((1.0 / k) + (k + 10.0))) / k return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.85) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); elseif ((m <= 4.6e+180) || !(m <= 6.5e+269)) tmp = Float64(a * Float64(Float64(k * Float64(Float64(k * 99.0) - 10.0)) + 1.0)); else tmp = Float64(Float64(a / Float64(Float64(1.0 / k) + Float64(k + 10.0))) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.85) tmp = a / ((k * (k + 10.0)) + 1.0); elseif ((m <= 4.6e+180) || ~((m <= 6.5e+269))) tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0); else tmp = (a / ((1.0 / k) + (k + 10.0))) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.85], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 4.6e+180], N[Not[LessEqual[m, 6.5e+269]], $MachinePrecision]], N[(a * N[(N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(1.0 / k), $MachinePrecision] + N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.85:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{elif}\;m \leq 4.6 \cdot 10^{+180} \lor \neg \left(m \leq 6.5 \cdot 10^{+269}\right):\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99 - 10\right) + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\frac{1}{k} + \left(k + 10\right)}}{k}\\
\end{array}
\end{array}
if m < 1.8500000000000001Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in m around 0 62.7%
if 1.8500000000000001 < m < 4.5999999999999998e180 or 6.5000000000000003e269 < m Initial program 66.2%
associate-/l*66.2%
remove-double-neg66.2%
distribute-frac-neg266.2%
distribute-neg-frac266.2%
remove-double-neg66.2%
sqr-neg66.2%
associate-+l+66.2%
sqr-neg66.2%
distribute-rgt-out66.2%
Simplified66.2%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 32.7%
cancel-sign-sub-inv32.7%
mul-1-neg32.7%
distribute-rgt1-in32.7%
metadata-eval32.7%
metadata-eval32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in k around 0 32.7%
distribute-lft-in28.1%
*-commutative28.1%
metadata-eval28.1%
distribute-lft-neg-in28.1%
associate-*r*28.1%
*-commutative28.1%
associate-*r*28.1%
distribute-lft-in32.7%
distribute-rgt-neg-in32.7%
distribute-lft-out32.7%
distribute-lft-neg-in32.7%
metadata-eval32.7%
*-commutative32.7%
Simplified32.7%
Taylor expanded in a around 0 42.7%
if 4.5999999999999998e180 < m < 6.5000000000000003e269Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in k around inf 91.7%
add-sqr-sqrt79.2%
distribute-lft-out79.2%
times-frac79.2%
associate-+l+79.2%
Applied egg-rr79.2%
associate-*l/79.2%
div-inv79.2%
associate-*r*79.2%
add-sqr-sqrt100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 39.3%
+-commutative39.3%
+-commutative39.3%
associate-+l+39.3%
Simplified39.3%
Final simplification55.4%
(FPCore (a k m) :precision binary64 (if (<= m 1.85) (/ a (+ (* k (+ k 10.0)) 1.0)) (* a (+ (* k (- (* k 99.0) 10.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.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.85d0) then
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
else
tmp = a * ((k * ((k * 99.0d0) - 10.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.85) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.85: tmp = a / ((k * (k + 10.0)) + 1.0) else: tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.85) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); else tmp = Float64(a * Float64(Float64(k * Float64(Float64(k * 99.0) - 10.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.85) tmp = a / ((k * (k + 10.0)) + 1.0); else tmp = a * ((k * ((k * 99.0) - 10.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.85], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.85:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k \cdot 99 - 10\right) + 1\right)\\
\end{array}
\end{array}
if m < 1.8500000000000001Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in m around 0 62.7%
if 1.8500000000000001 < m Initial program 73.0%
associate-/l*73.0%
remove-double-neg73.0%
distribute-frac-neg273.0%
distribute-neg-frac273.0%
remove-double-neg73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 28.5%
cancel-sign-sub-inv28.5%
mul-1-neg28.5%
distribute-rgt1-in28.5%
metadata-eval28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in k around 0 28.5%
distribute-lft-in22.8%
*-commutative22.8%
metadata-eval22.8%
distribute-lft-neg-in22.8%
associate-*r*22.8%
*-commutative22.8%
associate-*r*22.8%
distribute-lft-in28.5%
distribute-rgt-neg-in28.5%
distribute-lft-out28.5%
distribute-lft-neg-in28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in a around 0 35.8%
Final simplification53.3%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.8e-295) (not (<= k 0.1))) (* (/ a k) 0.1) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.8e-295) || !(k <= 0.1)) {
tmp = (a / k) * 0.1;
} 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.8d-295) .or. (.not. (k <= 0.1d0))) then
tmp = (a / k) * 0.1d0
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 1.8e-295) || !(k <= 0.1)) {
tmp = (a / k) * 0.1;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.8e-295) or not (k <= 0.1): tmp = (a / k) * 0.1 else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.8e-295) || !(k <= 0.1)) tmp = Float64(Float64(a / k) * 0.1); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 1.8e-295) || ~((k <= 0.1))) tmp = (a / k) * 0.1; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.8e-295], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.8 \cdot 10^{-295} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.8000000000000001e-295 or 0.10000000000000001 < k Initial program 82.0%
associate-/l*82.0%
remove-double-neg82.0%
distribute-frac-neg282.0%
distribute-neg-frac282.0%
remove-double-neg82.0%
sqr-neg82.0%
associate-+l+82.0%
sqr-neg82.0%
distribute-rgt-out82.0%
Simplified82.0%
Taylor expanded in m around 0 38.2%
Taylor expanded in k around 0 16.1%
*-commutative16.1%
Simplified16.1%
Taylor expanded in k around inf 16.3%
if 1.8000000000000001e-295 < k < 0.10000000000000001Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 49.9%
Taylor expanded in k around 0 48.2%
Final simplification26.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.5) (/ a (+ (* k 10.0) 1.0)) (+ a (* k (* 99.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.5) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = a + (k * (99.0 * (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 (m <= 2.5d0) then
tmp = a / ((k * 10.0d0) + 1.0d0)
else
tmp = a + (k * (99.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.5) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = a + (k * (99.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.5: tmp = a / ((k * 10.0) + 1.0) else: tmp = a + (k * (99.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.5) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.0)); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.5) tmp = a / ((k * 10.0) + 1.0); else tmp = a + (k * (99.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.5], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.5:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 2.5Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in m around 0 62.7%
Taylor expanded in k around 0 39.8%
*-commutative39.8%
Simplified39.8%
if 2.5 < m Initial program 73.0%
associate-/l*73.0%
remove-double-neg73.0%
distribute-frac-neg273.0%
distribute-neg-frac273.0%
remove-double-neg73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 28.5%
cancel-sign-sub-inv28.5%
mul-1-neg28.5%
distribute-rgt1-in28.5%
metadata-eval28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in k around inf 28.5%
Final simplification35.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ (* k (+ k 10.0)) 1.0)) (+ a (* k (* 99.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a + (k * (99.0 * (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 (m <= 2.2d0) then
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
else
tmp = a + (k * (99.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a + (k * (99.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / ((k * (k + 10.0)) + 1.0) else: tmp = a + (k * (99.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / ((k * (k + 10.0)) + 1.0); else tmp = a + (k * (99.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in m around 0 62.7%
if 2.2000000000000002 < m Initial program 73.0%
associate-/l*73.0%
remove-double-neg73.0%
distribute-frac-neg273.0%
distribute-neg-frac273.0%
remove-double-neg73.0%
sqr-neg73.0%
associate-+l+73.0%
sqr-neg73.0%
distribute-rgt-out73.0%
Simplified73.0%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 28.5%
cancel-sign-sub-inv28.5%
mul-1-neg28.5%
distribute-rgt1-in28.5%
metadata-eval28.5%
metadata-eval28.5%
*-commutative28.5%
Simplified28.5%
Taylor expanded in k around inf 28.5%
Final simplification50.8%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ (* k -10.0) 1.0)) (* (/ a k) 0.1)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * ((k * -10.0) + 1.0);
} else {
tmp = (a / k) * 0.1;
}
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 * ((k * (-10.0d0)) + 1.0d0)
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * ((k * -10.0) + 1.0);
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * ((k * -10.0) + 1.0) else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a * Float64(Float64(k * -10.0) + 1.0)); else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a * ((k * -10.0) + 1.0); else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a * N[(N[(k * -10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(k \cdot -10 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 91.3%
associate-/l*91.3%
remove-double-neg91.3%
distribute-frac-neg291.3%
distribute-neg-frac291.3%
remove-double-neg91.3%
sqr-neg91.3%
associate-+l+91.3%
sqr-neg91.3%
distribute-rgt-out91.3%
Simplified91.3%
Taylor expanded in k around 0 85.3%
associate-*r*85.3%
distribute-lft1-in99.7%
*-commutative99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in m around 0 29.6%
if 0.0749999999999999972 < k Initial program 80.6%
associate-/l*80.6%
remove-double-neg80.6%
distribute-frac-neg280.6%
distribute-neg-frac280.6%
remove-double-neg80.6%
sqr-neg80.6%
associate-+l+80.6%
sqr-neg80.6%
distribute-rgt-out80.6%
Simplified80.6%
Taylor expanded in m around 0 59.9%
Taylor expanded in k around 0 23.0%
*-commutative23.0%
Simplified23.0%
Taylor expanded in k around inf 23.0%
Final simplification27.5%
(FPCore (a k m) :precision binary64 (if (<= m 3.2e+23) (/ a (+ (* k 10.0) 1.0)) (* a (+ (* k -10.0) 1.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.2e+23) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = a * ((k * -10.0) + 1.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.2d+23) then
tmp = a / ((k * 10.0d0) + 1.0d0)
else
tmp = a * ((k * (-10.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.2e+23) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = a * ((k * -10.0) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.2e+23: tmp = a / ((k * 10.0) + 1.0) else: tmp = a * ((k * -10.0) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.2e+23) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.0)); else tmp = Float64(a * Float64(Float64(k * -10.0) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.2e+23) tmp = a / ((k * 10.0) + 1.0); else tmp = a * ((k * -10.0) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.2e+23], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(k * -10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot -10 + 1\right)\\
\end{array}
\end{array}
if m < 3.2e23Initial program 95.4%
associate-/l*95.4%
remove-double-neg95.4%
distribute-frac-neg295.4%
distribute-neg-frac295.4%
remove-double-neg95.4%
sqr-neg95.4%
associate-+l+95.4%
sqr-neg95.4%
distribute-rgt-out95.4%
Simplified95.4%
Taylor expanded in m around 0 61.0%
Taylor expanded in k around 0 38.7%
*-commutative38.7%
Simplified38.7%
if 3.2e23 < m Initial program 72.6%
associate-/l*72.6%
remove-double-neg72.6%
distribute-frac-neg272.6%
distribute-neg-frac272.6%
remove-double-neg72.6%
sqr-neg72.6%
associate-+l+72.6%
sqr-neg72.6%
distribute-rgt-out72.6%
Simplified72.6%
Taylor expanded in k around 0 79.8%
associate-*r*79.8%
distribute-lft1-in79.8%
*-commutative79.8%
fma-define79.8%
Simplified79.8%
Taylor expanded in m around 0 11.6%
Final simplification29.8%
(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 87.9%
associate-/l*87.9%
remove-double-neg87.9%
distribute-frac-neg287.9%
distribute-neg-frac287.9%
remove-double-neg87.9%
sqr-neg87.9%
associate-+l+87.9%
sqr-neg87.9%
distribute-rgt-out87.9%
Simplified87.9%
Taylor expanded in m around 0 42.0%
Taylor expanded in k around 0 18.8%
Final simplification18.8%
herbie shell --seed 2024080
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))