
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ 1.0 t_0))) (if (<= k 1e-47) t_0 (/ 1.0 (+ t_1 (* k (+ (* 10.0 t_1) (/ k t_0))))))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-47) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = 1.0d0 / t_0
if (k <= 1d-47) then
tmp = t_0
else
tmp = 1.0d0 / (t_1 + (k * ((10.0d0 * t_1) + (k / t_0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-47) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = 1.0 / t_0 tmp = 0 if k <= 1e-47: tmp = t_0 else: tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))) return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 1e-47) tmp = t_0; else tmp = Float64(1.0 / Float64(t_1 + Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / t_0))))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 1e-47) tmp = t_0; else tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 1e-47], t$95$0, N[(1.0 / N[(t$95$1 + N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 10^{-47}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right)}\\
\end{array}
\end{array}
if k < 9.9999999999999997e-48Initial program 90.1%
associate-/l*90.1%
remove-double-neg90.1%
distribute-frac-neg290.1%
distribute-neg-frac290.1%
remove-double-neg90.1%
sqr-neg90.1%
associate-+l+90.1%
sqr-neg90.1%
distribute-rgt-out90.8%
Simplified90.8%
Taylor expanded in k around 0 98.7%
if 9.9999999999999997e-48 < k Initial program 87.7%
associate-/l*87.8%
remove-double-neg87.8%
distribute-frac-neg287.8%
distribute-neg-frac287.8%
remove-double-neg87.8%
sqr-neg87.8%
associate-+l+87.8%
sqr-neg87.8%
distribute-rgt-out87.8%
Simplified87.8%
distribute-lft-in87.8%
associate-+l+87.8%
associate-*r/87.7%
clear-num87.8%
associate-+l+87.8%
distribute-lft-in87.8%
+-commutative87.8%
fma-define87.8%
+-commutative87.8%
*-commutative87.8%
Applied egg-rr87.8%
Taylor expanded in k around 0 99.9%
Final simplification99.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 5e+203)
(* a (/ (pow k m) (+ 1.0 (+ (pow k 2.0) (* 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)))) <= 5e+203) {
tmp = a * (pow(k, m) / (1.0 + (pow(k, 2.0) + (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)))) <= 5d+203) then
tmp = a * ((k ** m) / (1.0d0 + ((k ** 2.0d0) + (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)))) <= 5e+203) {
tmp = a * (Math.pow(k, m) / (1.0 + (Math.pow(k, 2.0) + (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)))) <= 5e+203: tmp = a * (math.pow(k, m) / (1.0 + (math.pow(k, 2.0) + (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)))) <= 5e+203) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64((k ^ 2.0) + 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)))) <= 5e+203) tmp = a * ((k ^ m) / (1.0 + ((k ^ 2.0) + (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], 5e+203], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(N[Power[k, 2.0], $MachinePrecision] + 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 5 \cdot 10^{+203}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + \left({k}^{2} + k \cdot 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))) < 4.99999999999999994e203Initial program 97.6%
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%
distribute-lft-in97.6%
+-commutative97.6%
pow297.6%
Applied egg-rr97.6%
if 4.99999999999999994e203 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 58.2%
associate-/l*58.2%
remove-double-neg58.2%
distribute-frac-neg258.2%
distribute-neg-frac258.2%
remove-double-neg58.2%
sqr-neg58.2%
associate-+l+58.2%
sqr-neg58.2%
distribute-rgt-out60.0%
Simplified60.0%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 5e+203)
(* 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)))) <= 5e+203) {
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)))) <= 5d+203) 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)))) <= 5e+203) {
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)))) <= 5e+203: 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)))) <= 5e+203) 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)))) <= 5e+203) 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], 5e+203], 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 5 \cdot 10^{+203}:\\
\;\;\;\;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))) < 4.99999999999999994e203Initial program 97.6%
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%
if 4.99999999999999994e203 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 58.2%
associate-/l*58.2%
remove-double-neg58.2%
distribute-frac-neg258.2%
distribute-neg-frac258.2%
remove-double-neg58.2%
sqr-neg58.2%
associate-+l+58.2%
sqr-neg58.2%
distribute-rgt-out60.0%
Simplified60.0%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m)
:precision binary64
(if (<= m -1.05e-13)
(* a (/ (pow k m) (+ 1.0 (* k 10.0))))
(if (<= m 1.9e-5)
(* a (/ 1.0 (+ 1.0 (+ (pow k 2.0) (* k 10.0)))))
(* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-13) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 1.9e-5) {
tmp = a * (1.0 / (1.0 + (pow(k, 2.0) + (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 <= (-1.05d-13)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 1.9d-5) then
tmp = a * (1.0d0 / (1.0d0 + ((k ** 2.0d0) + (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 <= -1.05e-13) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 1.9e-5) {
tmp = a * (1.0 / (1.0 + (Math.pow(k, 2.0) + (k * 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.05e-13: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 1.9e-5: tmp = a * (1.0 / (1.0 + (math.pow(k, 2.0) + (k * 10.0)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.05e-13) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 1.9e-5) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64((k ^ 2.0) + 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 <= -1.05e-13) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 1.9e-5) tmp = a * (1.0 / (1.0 + ((k ^ 2.0) + (k * 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.05e-13], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9e-5], N[(a * N[(1.0 / N[(1.0 + N[(N[Power[k, 2.0], $MachinePrecision] + 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.05 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 1.9 \cdot 10^{-5}:\\
\;\;\;\;a \cdot \frac{1}{1 + \left({k}^{2} + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.04999999999999994e-13Initial program 99.0%
associate-/l*99.0%
remove-double-neg99.0%
distribute-frac-neg299.0%
distribute-neg-frac299.0%
remove-double-neg99.0%
sqr-neg99.0%
associate-+l+99.0%
sqr-neg99.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.04999999999999994e-13 < m < 1.9000000000000001e-5Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.4%
Simplified94.4%
distribute-lft-in94.5%
+-commutative94.5%
pow294.5%
Applied egg-rr94.5%
Taylor expanded in m around 0 94.5%
if 1.9000000000000001e-5 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in k around 0 98.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.05e-13) (* a (/ (pow k m) (+ 1.0 (* k 10.0)))) (if (<= m 0.032) (* 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 <= -1.05e-13) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.032) {
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 <= (-1.05d-13)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 0.032d0) 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 <= -1.05e-13) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.032) {
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 <= -1.05e-13: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 0.032: 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 <= -1.05e-13) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 0.032) 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 <= -1.05e-13) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 0.032) 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, -1.05e-13], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.032], 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.05 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 0.032:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.04999999999999994e-13Initial program 99.0%
associate-/l*99.0%
remove-double-neg99.0%
distribute-frac-neg299.0%
distribute-neg-frac299.0%
remove-double-neg99.0%
sqr-neg99.0%
associate-+l+99.0%
sqr-neg99.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.04999999999999994e-13 < m < 0.032000000000000001Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
if 0.032000000000000001 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in k around 0 98.9%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.05e-13) (not (<= m 0.0058))) (* 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 <= -1.05e-13) || !(m <= 0.0058)) {
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 <= (-1.05d-13)) .or. (.not. (m <= 0.0058d0))) 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 <= -1.05e-13) || !(m <= 0.0058)) {
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 <= -1.05e-13) or not (m <= 0.0058): 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 <= -1.05e-13) || !(m <= 0.0058)) 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 <= -1.05e-13) || ~((m <= 0.0058))) 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, -1.05e-13], N[Not[LessEqual[m, 0.0058]], $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 -1.05 \cdot 10^{-13} \lor \neg \left(m \leq 0.0058\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.04999999999999994e-13 or 0.0058 < m Initial program 87.2%
associate-/l*87.2%
remove-double-neg87.2%
distribute-frac-neg287.2%
distribute-neg-frac287.2%
remove-double-neg87.2%
sqr-neg87.2%
associate-+l+87.2%
sqr-neg87.2%
distribute-rgt-out87.7%
Simplified87.7%
Taylor expanded in k around 0 99.0%
if -1.04999999999999994e-13 < m < 0.0058Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.6) (* a (/ 1.0 (+ 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.6) {
tmp = a * (1.0 / (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.6d0) then
tmp = a * (1.0d0 / (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.6) {
tmp = a * (1.0 / (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.6: tmp = a * (1.0 / (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.6) tmp = Float64(a * Float64(1.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) tmp = 0.0; if (m <= 1.6) tmp = a * (1.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_] := If[LessEqual[m, 1.6], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $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.6:\\
\;\;\;\;a \cdot \frac{1}{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.6000000000000001Initial program 97.2%
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.8%
Simplified97.8%
Taylor expanded in m around 0 59.5%
if 1.6000000000000001 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 24.2%
Taylor expanded in a around 0 33.3%
Final simplification51.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.6) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (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 <= 1.6d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.6: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.6) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.6) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.6], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.6:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.6000000000000001Initial program 97.2%
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.8%
Simplified97.8%
Taylor expanded in m around 0 59.5%
if 1.6000000000000001 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 24.2%
Taylor expanded in a around 0 33.3%
Taylor expanded in k around inf 33.3%
*-commutative33.3%
Simplified33.3%
Final simplification51.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.6) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (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 <= 1.6d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.6: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.6) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.6) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.6], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.6:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.6000000000000001Initial program 97.2%
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.8%
Simplified97.8%
Taylor expanded in m around 0 59.4%
if 1.6000000000000001 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 24.2%
Taylor expanded in a around 0 33.3%
Taylor expanded in k around inf 33.3%
*-commutative33.3%
Simplified33.3%
Final simplification51.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.6) (* a (/ 1.0 (+ 1.0 (* k k)))) (+ a (* a (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = a + (a * (k * (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 <= 1.6d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * k)))
else
tmp = a + (a * (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.6) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = a + (a * (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.6: tmp = a * (1.0 / (1.0 + (k * k))) else: tmp = a + (a * (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.6) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * k)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.6) tmp = a * (1.0 / (1.0 + (k * k))); else tmp = a + (a * (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.6], N[(a * N[(1.0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.6:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.6000000000000001Initial program 97.2%
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.8%
Simplified97.8%
Taylor expanded in m around 0 59.5%
Taylor expanded in k around inf 57.6%
if 1.6000000000000001 < m Initial program 72.1%
associate-/l*72.1%
remove-double-neg72.1%
distribute-frac-neg272.1%
distribute-neg-frac272.1%
remove-double-neg72.1%
sqr-neg72.1%
associate-+l+72.1%
sqr-neg72.1%
distribute-rgt-out72.1%
Simplified72.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 24.2%
Taylor expanded in a around 0 33.3%
Taylor expanded in k around inf 33.3%
*-commutative33.3%
Simplified33.3%
(FPCore (a k m) :precision binary64 (if (<= m 3.5e+15) (* a (/ 1.0 (+ 1.0 (* k k)))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.5e+15) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = -10.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 <= 3.5d+15) then
tmp = a * (1.0d0 / (1.0d0 + (k * k)))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.5e+15) {
tmp = a * (1.0 / (1.0 + (k * k)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.5e+15: tmp = a * (1.0 / (1.0 + (k * k))) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.5e+15) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * k)))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.5e+15) tmp = a * (1.0 / (1.0 + (k * k))); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.5e+15], N[(a * N[(1.0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.5 \cdot 10^{+15}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 3.5e15Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out97.3%
Simplified97.3%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around inf 56.1%
if 3.5e15 < m Initial program 71.4%
associate-/l*71.4%
remove-double-neg71.4%
distribute-frac-neg271.4%
distribute-neg-frac271.4%
remove-double-neg71.4%
sqr-neg71.4%
associate-+l+71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
Simplified71.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.0%
Taylor expanded in k around inf 22.4%
Final simplification45.9%
(FPCore (a k m) :precision binary64 (if (<= m 7e+14) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7e+14) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.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 <= 7d+14) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7e+14) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7e+14: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7e+14) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7e+14) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7e+14], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 7e14Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out97.3%
Simplified97.3%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around inf 56.1%
if 7e14 < m Initial program 71.4%
associate-/l*71.4%
remove-double-neg71.4%
distribute-frac-neg271.4%
distribute-neg-frac271.4%
remove-double-neg71.4%
sqr-neg71.4%
associate-+l+71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
Simplified71.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.0%
Taylor expanded in k around inf 22.4%
Final simplification45.9%
(FPCore (a k m) :precision binary64 (if (<= m 6e+14) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 6e+14) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.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 <= 6d+14) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 6e+14) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 6e+14: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 6e+14) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6e+14) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 6e+14], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 6e14Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out97.3%
Simplified97.3%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around 0 30.2%
*-commutative81.9%
Simplified30.2%
if 6e14 < m Initial program 71.4%
associate-/l*71.4%
remove-double-neg71.4%
distribute-frac-neg271.4%
distribute-neg-frac271.4%
remove-double-neg71.4%
sqr-neg71.4%
associate-+l+71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
Simplified71.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.0%
Taylor expanded in k around inf 22.4%
Final simplification27.8%
(FPCore (a k m) :precision binary64 (if (<= m 7.8e+14) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.8e+14) {
tmp = a;
} else {
tmp = -10.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 <= 7.8d+14) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.8e+14) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.8e+14: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.8e+14) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.8e+14) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.8e+14], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.8 \cdot 10^{+14}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 7.8e14Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out97.3%
Simplified97.3%
Taylor expanded in m around 0 57.9%
Taylor expanded in k around 0 18.0%
if 7.8e14 < m Initial program 71.4%
associate-/l*71.4%
remove-double-neg71.4%
distribute-frac-neg271.4%
distribute-neg-frac271.4%
remove-double-neg71.4%
sqr-neg71.4%
associate-+l+71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
Simplified71.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.0%
Taylor expanded in k around inf 22.4%
Final simplification19.3%
(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.1%
associate-/l*89.2%
remove-double-neg89.2%
distribute-frac-neg289.2%
distribute-neg-frac289.2%
remove-double-neg89.2%
sqr-neg89.2%
associate-+l+89.2%
sqr-neg89.2%
distribute-rgt-out89.5%
Simplified89.5%
Taylor expanded in m around 0 41.4%
Taylor expanded in k around 0 13.6%
herbie shell --seed 2024129
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))