
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m)
:precision binary64
(let* ((t_0 (hypot k (sqrt (fma k 10.0 1.0)))))
(if (<= m -4.7e-7)
(/ a (pow k (- m)))
(if (<= m 4.4) (* (/ (pow k m) t_0) (/ a t_0)) (* a (pow k m))))))
double code(double a, double k, double m) {
double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double tmp;
if (m <= -4.7e-7) {
tmp = a / pow(k, -m);
} else if (m <= 4.4) {
tmp = (pow(k, m) / t_0) * (a / t_0);
} else {
tmp = a * pow(k, m);
}
return tmp;
}
function code(a, k, m) t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0))) tmp = 0.0 if (m <= -4.7e-7) tmp = Float64(a / (k ^ Float64(-m))); elseif (m <= 4.4) tmp = Float64(Float64((k ^ m) / t_0) * Float64(a / t_0)); else tmp = Float64(a * (k ^ m)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[m, -4.7e-7], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.4], N[(N[(N[Power[k, m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(a / t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
\mathbf{if}\;m \leq -4.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\mathbf{elif}\;m \leq 4.4:\\
\;\;\;\;\frac{{k}^{m}}{t\_0} \cdot \frac{a}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -4.7e-7Initial 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%
clear-num100.0%
un-div-inv100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 100.0%
Taylor expanded in k around inf 49.3%
rec-exp49.3%
mul-1-neg49.3%
remove-double-neg49.3%
log-rec49.3%
*-commutative49.3%
distribute-lft-neg-in49.3%
distribute-rgt-neg-out49.3%
exp-to-pow100.0%
Simplified100.0%
if -4.7e-7 < m < 4.4000000000000004Initial program 94.4%
associate-/l*94.3%
remove-double-neg94.3%
distribute-frac-neg294.3%
distribute-neg-frac294.3%
remove-double-neg94.3%
sqr-neg94.3%
associate-+l+94.3%
sqr-neg94.3%
distribute-rgt-out94.3%
Simplified94.3%
distribute-lft-in94.3%
associate-+l+94.3%
associate-*r/94.4%
add-sqr-sqrt94.3%
associate-/r*94.3%
*-commutative94.3%
associate-+l+94.3%
distribute-lft-in94.3%
+-commutative94.3%
fma-define94.3%
+-commutative94.3%
associate-+l+94.3%
distribute-lft-in94.3%
+-commutative94.3%
fma-define94.3%
+-commutative94.3%
Applied egg-rr94.3%
associate-/l/94.3%
times-frac94.3%
fma-undefine94.3%
+-commutative94.3%
+-commutative94.3%
distribute-lft-in94.3%
associate-+l+94.3%
+-commutative94.3%
add-sqr-sqrt94.3%
hypot-define94.3%
+-commutative94.3%
fma-define94.3%
fma-undefine94.3%
+-commutative94.3%
+-commutative94.3%
distribute-lft-in94.3%
Applied egg-rr99.8%
if 4.4000000000000004 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 2.4) (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 2.4) {
tmp = t_0 / ((k * k) + (1.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 (m <= 2.4d0) then
tmp = t_0 / ((k * k) + (1.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 (m <= 2.4) {
tmp = t_0 / ((k * k) + (1.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 m <= 2.4: tmp = t_0 / ((k * k) + (1.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 (m <= 2.4) tmp = Float64(t_0 / Float64(Float64(k * k) + Float64(1.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 (m <= 2.4) tmp = t_0 / ((k * k) + (1.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[m, 2.4], N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;\frac{t\_0}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 96.8%
if 2.39999999999999991 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m 3.85) (* 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.85) {
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.85d0) 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.85) {
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.85: 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.85) 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.85) 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.85], 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.85:\\
\;\;\;\;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.85000000000000009Initial 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-out96.8%
Simplified96.8%
if 3.85000000000000009 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.3e-11) (not (<= m 2.35e-5))) (* a (pow k m)) (/ a (+ (* k k) (+ 1.0 (* k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.3e-11) || !(m <= 2.35e-5)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((k * k) + (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.3d-11)) .or. (.not. (m <= 2.35d-5))) then
tmp = a * (k ** m)
else
tmp = a / ((k * k) + (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.3e-11) || !(m <= 2.35e-5)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -2.3e-11) or not (m <= 2.35e-5): tmp = a * math.pow(k, m) else: tmp = a / ((k * k) + (1.0 + (k * 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -2.3e-11) || !(m <= 2.35e-5)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -2.3e-11) || ~((m <= 2.35e-5))) tmp = a * (k ^ m); else tmp = a / ((k * k) + (1.0 + (k * 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -2.3e-11], N[Not[LessEqual[m, 2.35e-5]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.3 \cdot 10^{-11} \lor \neg \left(m \leq 2.35 \cdot 10^{-5}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\end{array}
\end{array}
if m < -2.30000000000000014e-11 or 2.34999999999999986e-5 < m Initial program 88.1%
associate-/l*88.1%
remove-double-neg88.1%
distribute-frac-neg288.1%
distribute-neg-frac288.1%
remove-double-neg88.1%
sqr-neg88.1%
associate-+l+88.1%
sqr-neg88.1%
distribute-rgt-out88.1%
Simplified88.1%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -2.30000000000000014e-11 < m < 2.34999999999999986e-5Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.6e-7) (/ a (pow k (- m))) (if (<= m 0.0037) (/ a (+ (* k k) (+ 1.0 (* k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.6e-7) {
tmp = a / pow(k, -m);
} else if (m <= 0.0037) {
tmp = a / ((k * k) + (1.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.6d-7)) then
tmp = a / (k ** -m)
else if (m <= 0.0037d0) then
tmp = a / ((k * k) + (1.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.6e-7) {
tmp = a / Math.pow(k, -m);
} else if (m <= 0.0037) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.6e-7: tmp = a / math.pow(k, -m) elif m <= 0.0037: tmp = a / ((k * k) + (1.0 + (k * 10.0))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.6e-7) tmp = Float64(a / (k ^ Float64(-m))); elseif (m <= 0.0037) tmp = Float64(a / Float64(Float64(k * k) + Float64(1.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.6e-7) tmp = a / (k ^ -m); elseif (m <= 0.0037) tmp = a / ((k * k) + (1.0 + (k * 10.0))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.6e-7], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.0037], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\mathbf{elif}\;m \leq 0.0037:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.6e-7Initial 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%
clear-num100.0%
un-div-inv100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in k around 0 100.0%
Taylor expanded in k around inf 49.3%
rec-exp49.3%
mul-1-neg49.3%
remove-double-neg49.3%
log-rec49.3%
*-commutative49.3%
distribute-lft-neg-in49.3%
distribute-rgt-neg-out49.3%
exp-to-pow100.0%
Simplified100.0%
if -1.6e-7 < m < 0.0037000000000000002Initial program 94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
if 0.0037000000000000002 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.9%
(FPCore (a k m)
:precision binary64
(if (<= m -3.3e+102)
(/ a (+ 1.0 (* k k)))
(if (<= m -8.2e+72)
(* k (+ (* a -10.0) (/ a k)))
(if (<= m 2.0)
(/ a (+ (* k k) (+ 1.0 (* k 10.0))))
(+ a (* a (* k (- (* k 99.0) 10.0))))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 2.0) {
tmp = a / ((k * k) + (1.0 + (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 <= (-3.3d+102)) then
tmp = a / (1.0d0 + (k * k))
else if (m <= (-8.2d+72)) then
tmp = k * ((a * (-10.0d0)) + (a / k))
else if (m <= 2.0d0) then
tmp = a / ((k * k) + (1.0d0 + (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 <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 2.0) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.3e+102: tmp = a / (1.0 + (k * k)) elif m <= -8.2e+72: tmp = k * ((a * -10.0) + (a / k)) elif m <= 2.0: tmp = a / ((k * k) + (1.0 + (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 <= -3.3e+102) tmp = Float64(a / Float64(1.0 + Float64(k * k))); elseif (m <= -8.2e+72) tmp = Float64(k * Float64(Float64(a * -10.0) + Float64(a / k))); elseif (m <= 2.0) tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + 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 <= -3.3e+102) tmp = a / (1.0 + (k * k)); elseif (m <= -8.2e+72) tmp = k * ((a * -10.0) + (a / k)); elseif (m <= 2.0) tmp = a / ((k * k) + (1.0 + (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, -3.3e+102], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -8.2e+72], N[(k * N[(N[(a * -10.0), $MachinePrecision] + N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.0], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + 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 -3.3 \cdot 10^{+102}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq -8.2 \cdot 10^{+72}:\\
\;\;\;\;k \cdot \left(a \cdot -10 + \frac{a}{k}\right)\\
\mathbf{elif}\;m \leq 2:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < -3.29999999999999999e102Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.1%
Taylor expanded in k around 0 30.1%
if -3.29999999999999999e102 < m < -8.19999999999999926e72Initial 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 5.0%
Taylor expanded in k around 0 5.0%
Taylor expanded in k around inf 56.9%
if -8.19999999999999926e72 < m < 2Initial program 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in m around 0 86.8%
if 2 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 30.6%
cancel-sign-sub-inv30.6%
associate-*r*30.6%
metadata-eval30.6%
mul-1-neg30.6%
distribute-rgt1-in30.6%
metadata-eval30.6%
*-commutative30.6%
Simplified30.6%
Taylor expanded in a around 0 31.7%
Final simplification56.4%
(FPCore (a k m)
:precision binary64
(if (<= m -3.3e+102)
(/ a (+ 1.0 (* k k)))
(if (<= m -8.2e+72)
(* k (+ (* a -10.0) (/ a k)))
(if (<= m 2.3)
(/ 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 <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 2.3) {
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 <= (-3.3d+102)) then
tmp = a / (1.0d0 + (k * k))
else if (m <= (-8.2d+72)) then
tmp = k * ((a * (-10.0d0)) + (a / k))
else if (m <= 2.3d0) 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 <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 2.3) {
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 <= -3.3e+102: tmp = a / (1.0 + (k * k)) elif m <= -8.2e+72: tmp = k * ((a * -10.0) + (a / k)) elif m <= 2.3: 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 <= -3.3e+102) tmp = Float64(a / Float64(1.0 + Float64(k * k))); elseif (m <= -8.2e+72) tmp = Float64(k * Float64(Float64(a * -10.0) + Float64(a / k))); elseif (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 * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.3e+102) tmp = a / (1.0 + (k * k)); elseif (m <= -8.2e+72) tmp = k * ((a * -10.0) + (a / k)); elseif (m <= 2.3) 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, -3.3e+102], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -8.2e+72], N[(k * N[(N[(a * -10.0), $MachinePrecision] + N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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 * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.3 \cdot 10^{+102}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq -8.2 \cdot 10^{+72}:\\
\;\;\;\;k \cdot \left(a \cdot -10 + \frac{a}{k}\right)\\
\mathbf{elif}\;m \leq 2.3:\\
\;\;\;\;\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 < -3.29999999999999999e102Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.1%
Taylor expanded in k around 0 30.1%
if -3.29999999999999999e102 < m < -8.19999999999999926e72Initial 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 5.0%
Taylor expanded in k around 0 5.0%
Taylor expanded in k around inf 56.9%
if -8.19999999999999926e72 < m < 2.2999999999999998Initial program 95.2%
associate-/l*95.1%
remove-double-neg95.1%
distribute-frac-neg295.1%
distribute-neg-frac295.1%
remove-double-neg95.1%
sqr-neg95.1%
associate-+l+95.1%
sqr-neg95.1%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in m around 0 86.8%
if 2.2999999999999998 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 30.6%
cancel-sign-sub-inv30.6%
associate-*r*30.6%
metadata-eval30.6%
mul-1-neg30.6%
distribute-rgt1-in30.6%
metadata-eval30.6%
*-commutative30.6%
Simplified30.6%
Taylor expanded in a around 0 31.7%
Final simplification56.4%
(FPCore (a k m)
:precision binary64
(if (<= m -3.3e+102)
(/ a (+ 1.0 (* k k)))
(if (<= m -3.8e+72)
(* k (+ (* a -10.0) (/ a k)))
(if (<= m 1.25) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -3.8e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 1.25) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.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 <= (-3.3d+102)) then
tmp = a / (1.0d0 + (k * k))
else if (m <= (-3.8d+72)) then
tmp = k * ((a * (-10.0d0)) + (a / k))
else if (m <= 1.25d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.3e+102) {
tmp = a / (1.0 + (k * k));
} else if (m <= -3.8e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 1.25) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.3e+102: tmp = a / (1.0 + (k * k)) elif m <= -3.8e+72: tmp = k * ((a * -10.0) + (a / k)) elif m <= 1.25: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.3e+102) tmp = Float64(a / Float64(1.0 + Float64(k * k))); elseif (m <= -3.8e+72) tmp = Float64(k * Float64(Float64(a * -10.0) + Float64(a / k))); elseif (m <= 1.25) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.3e+102) tmp = a / (1.0 + (k * k)); elseif (m <= -3.8e+72) tmp = k * ((a * -10.0) + (a / k)); elseif (m <= 1.25) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.3e+102], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -3.8e+72], N[(k * N[(N[(a * -10.0), $MachinePrecision] + N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.25], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.3 \cdot 10^{+102}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq -3.8 \cdot 10^{+72}:\\
\;\;\;\;k \cdot \left(a \cdot -10 + \frac{a}{k}\right)\\
\mathbf{elif}\;m \leq 1.25:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -3.29999999999999999e102Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.1%
Taylor expanded in k around 0 30.1%
if -3.29999999999999999e102 < m < -3.80000000000000006e72Initial 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 5.0%
Taylor expanded in k around 0 5.0%
Taylor expanded in k around inf 56.9%
if -3.80000000000000006e72 < m < 1.25Initial program 95.2%
associate-/l*95.1%
remove-double-neg95.1%
distribute-frac-neg295.1%
distribute-neg-frac295.1%
remove-double-neg95.1%
sqr-neg95.1%
associate-+l+95.1%
sqr-neg95.1%
distribute-rgt-out95.1%
Simplified95.1%
Taylor expanded in m around 0 86.8%
if 1.25 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 24.2%
Final simplification53.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (+ 1.0 (* k k)))))
(if (<= m -3.3e+102)
t_0
(if (<= m -8.2e+72)
(* k (+ (* a -10.0) (/ a k)))
(if (<= m 0.82) t_0 (* -10.0 (* a k)))))))
double code(double a, double k, double m) {
double t_0 = a / (1.0 + (k * k));
double tmp;
if (m <= -3.3e+102) {
tmp = t_0;
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 0.82) {
tmp = t_0;
} else {
tmp = -10.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) :: t_0
real(8) :: tmp
t_0 = a / (1.0d0 + (k * k))
if (m <= (-3.3d+102)) then
tmp = t_0
else if (m <= (-8.2d+72)) then
tmp = k * ((a * (-10.0d0)) + (a / k))
else if (m <= 0.82d0) then
tmp = t_0
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (1.0 + (k * k));
double tmp;
if (m <= -3.3e+102) {
tmp = t_0;
} else if (m <= -8.2e+72) {
tmp = k * ((a * -10.0) + (a / k));
} else if (m <= 0.82) {
tmp = t_0;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): t_0 = a / (1.0 + (k * k)) tmp = 0 if m <= -3.3e+102: tmp = t_0 elif m <= -8.2e+72: tmp = k * ((a * -10.0) + (a / k)) elif m <= 0.82: tmp = t_0 else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) t_0 = Float64(a / Float64(1.0 + Float64(k * k))) tmp = 0.0 if (m <= -3.3e+102) tmp = t_0; elseif (m <= -8.2e+72) tmp = Float64(k * Float64(Float64(a * -10.0) + Float64(a / k))); elseif (m <= 0.82) tmp = t_0; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (1.0 + (k * k)); tmp = 0.0; if (m <= -3.3e+102) tmp = t_0; elseif (m <= -8.2e+72) tmp = k * ((a * -10.0) + (a / k)); elseif (m <= 0.82) tmp = t_0; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -3.3e+102], t$95$0, If[LessEqual[m, -8.2e+72], N[(k * N[(N[(a * -10.0), $MachinePrecision] + N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.82], t$95$0, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{1 + k \cdot k}\\
\mathbf{if}\;m \leq -3.3 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -8.2 \cdot 10^{+72}:\\
\;\;\;\;k \cdot \left(a \cdot -10 + \frac{a}{k}\right)\\
\mathbf{elif}\;m \leq 0.82:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -3.29999999999999999e102 or -8.19999999999999926e72 < m < 0.819999999999999951Initial program 96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in m around 0 69.8%
Taylor expanded in k around 0 67.4%
if -3.29999999999999999e102 < m < -8.19999999999999926e72Initial 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 5.0%
Taylor expanded in k around 0 5.0%
Taylor expanded in k around inf 56.9%
if 0.819999999999999951 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 24.2%
Final simplification52.3%
(FPCore (a k m) :precision binary64 (if (<= m 0.85) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.85) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.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 <= 0.85d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.85) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.85: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.85) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.85) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.85], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.85:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 0.849999999999999978Initial program 96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in m around 0 66.3%
Taylor expanded in k around 0 64.0%
if 0.849999999999999978 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 24.2%
(FPCore (a k m) :precision binary64 (if (<= m 1.95) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.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.95d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
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 * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.94999999999999996Initial 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-out96.8%
Simplified96.8%
Taylor expanded in m around 0 66.3%
Taylor expanded in k around 0 47.8%
*-commutative47.8%
Simplified47.8%
if 1.94999999999999996 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 24.2%
(FPCore (a k m) :precision binary64 (if (<= m 0.08) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.08) {
tmp = a;
} else {
tmp = -10.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 <= 0.08d0) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.08) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.08: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.08) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.08) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.08], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.08:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 0.0800000000000000017Initial 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-out96.8%
Simplified96.8%
Taylor expanded in m around 0 66.3%
Taylor expanded in k around 0 33.5%
if 0.0800000000000000017 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 10.9%
Taylor expanded in k around inf 24.2%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 90.5%
associate-/l*90.4%
remove-double-neg90.4%
distribute-frac-neg290.4%
distribute-neg-frac290.4%
remove-double-neg90.4%
sqr-neg90.4%
associate-+l+90.4%
sqr-neg90.4%
distribute-rgt-out90.4%
Simplified90.4%
Taylor expanded in m around 0 44.8%
Taylor expanded in k around 0 23.5%
herbie shell --seed 2024085
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))