
(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 0.00078) (* (pow k m) a) (/ (/ (* a (/ (pow k m) k)) (sqrt k)) (sqrt k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = pow(k, m) * a;
} else {
tmp = ((a * (pow(k, m) / k)) / sqrt(k)) / sqrt(k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00078d0) then
tmp = (k ** m) * a
else
tmp = ((a * ((k ** m) / k)) / sqrt(k)) / sqrt(k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = Math.pow(k, m) * a;
} else {
tmp = ((a * (Math.pow(k, m) / k)) / Math.sqrt(k)) / Math.sqrt(k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00078: tmp = math.pow(k, m) * a else: tmp = ((a * (math.pow(k, m) / k)) / math.sqrt(k)) / math.sqrt(k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00078) tmp = Float64((k ^ m) * a); else tmp = Float64(Float64(Float64(a * Float64((k ^ m) / k)) / sqrt(k)) / sqrt(k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00078) tmp = (k ^ m) * a; else tmp = ((a * ((k ^ m) / k)) / sqrt(k)) / sqrt(k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00078], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[(N[(a * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision] / N[Sqrt[k], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00078:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a \cdot \frac{{k}^{m}}{k}}{\sqrt{k}}}{\sqrt{k}}\\
\end{array}
\end{array}
if k < 7.79999999999999986e-4Initial program 95.3%
associate-*r/95.3%
*-commutative95.3%
sqr-neg95.3%
associate-+l+95.3%
+-commutative95.3%
sqr-neg95.3%
distribute-rgt-out95.3%
fma-def95.3%
+-commutative95.3%
Simplified95.3%
Taylor expanded in k around 0 98.8%
if 7.79999999999999986e-4 < k Initial program 87.3%
associate-*r/87.3%
*-commutative87.3%
sqr-neg87.3%
associate-+l+87.3%
+-commutative87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
fma-def87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in k around inf 87.0%
*-commutative87.0%
unpow287.0%
times-frac92.6%
associate-*r*92.6%
*-commutative92.6%
exp-to-pow92.6%
mul-1-neg92.6%
Simplified92.6%
associate-*r/99.5%
add-sqr-sqrt99.5%
associate-/r*99.5%
Applied egg-rr99.5%
Final simplification99.0%
(FPCore (a k m) :precision binary64 (if (<= m 9e-32) (* a (/ (pow k m) (fma k (+ k 10.0) 1.0))) (* (pow k m) a)))
double code(double a, double k, double m) {
double tmp;
if (m <= 9e-32) {
tmp = a * (pow(k, m) / fma(k, (k + 10.0), 1.0));
} else {
tmp = pow(k, m) * a;
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 9e-32) tmp = Float64(a * Float64((k ^ m) / fma(k, Float64(k + 10.0), 1.0))); else tmp = Float64((k ^ m) * a); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 9e-32], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 9 \cdot 10^{-32}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < 9.00000000000000009e-32Initial program 97.1%
associate-*r/97.1%
*-commutative97.1%
sqr-neg97.1%
associate-+l+97.1%
+-commutative97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
fma-def97.1%
+-commutative97.1%
Simplified97.1%
if 9.00000000000000009e-32 < m Initial program 83.3%
associate-*r/83.3%
*-commutative83.3%
sqr-neg83.3%
associate-+l+83.3%
+-commutative83.3%
sqr-neg83.3%
distribute-rgt-out83.3%
fma-def83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in k around 0 100.0%
Final simplification98.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= m 9e-32) (/ t_0 (+ 1.0 (+ (* k 10.0) (* k k)))) t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= 9e-32) {
tmp = t_0 / (1.0 + ((k * 10.0) + (k * k)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = (k ** m) * a
if (m <= 9d-32) then
tmp = t_0 / (1.0d0 + ((k * 10.0d0) + (k * k)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if (m <= 9e-32) {
tmp = t_0 / (1.0 + ((k * 10.0) + (k * k)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if m <= 9e-32: tmp = t_0 / (1.0 + ((k * 10.0) + (k * k))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= 9e-32) tmp = Float64(t_0 / Float64(1.0 + Float64(Float64(k * 10.0) + Float64(k * k)))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if (m <= 9e-32) tmp = t_0 / (1.0 + ((k * 10.0) + (k * k))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, 9e-32], N[(t$95$0 / N[(1.0 + N[(N[(k * 10.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq 9 \cdot 10^{-32}:\\
\;\;\;\;\frac{t_0}{1 + \left(k \cdot 10 + k \cdot k\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < 9.00000000000000009e-32Initial program 97.1%
sqr-neg97.1%
associate-+l+97.1%
*-commutative97.1%
sqr-neg97.1%
Simplified97.1%
if 9.00000000000000009e-32 < m Initial program 83.3%
associate-*r/83.3%
*-commutative83.3%
sqr-neg83.3%
associate-+l+83.3%
+-commutative83.3%
sqr-neg83.3%
distribute-rgt-out83.3%
fma-def83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in k around 0 100.0%
Final simplification98.0%
(FPCore (a k m) :precision binary64 (if (<= k 0.00078) (* (pow k m) a) (* (/ (pow (/ 1.0 k) (- m)) k) (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = pow(k, m) * a;
} else {
tmp = (pow((1.0 / k), -m) / k) * (a / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00078d0) then
tmp = (k ** m) * a
else
tmp = (((1.0d0 / k) ** -m) / k) * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = Math.pow(k, m) * a;
} else {
tmp = (Math.pow((1.0 / k), -m) / k) * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00078: tmp = math.pow(k, m) * a else: tmp = (math.pow((1.0 / k), -m) / k) * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00078) tmp = Float64((k ^ m) * a); else tmp = Float64(Float64((Float64(1.0 / k) ^ Float64(-m)) / k) * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00078) tmp = (k ^ m) * a; else tmp = (((1.0 / k) ^ -m) / k) * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00078], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Power[N[(1.0 / k), $MachinePrecision], (-m)], $MachinePrecision] / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00078:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\frac{1}{k}\right)}^{\left(-m\right)}}{k} \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 7.79999999999999986e-4Initial program 95.3%
associate-*r/95.3%
*-commutative95.3%
sqr-neg95.3%
associate-+l+95.3%
+-commutative95.3%
sqr-neg95.3%
distribute-rgt-out95.3%
fma-def95.3%
+-commutative95.3%
Simplified95.3%
Taylor expanded in k around 0 98.8%
if 7.79999999999999986e-4 < k Initial program 87.3%
associate-*r/87.3%
*-commutative87.3%
sqr-neg87.3%
associate-+l+87.3%
+-commutative87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
fma-def87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in k around inf 87.0%
*-commutative87.0%
unpow287.0%
times-frac92.6%
associate-*r*92.6%
*-commutative92.6%
exp-to-pow92.6%
mul-1-neg92.6%
Simplified92.6%
Final simplification96.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= m -0.00065)
(/ t_0 (+ 1.0 (* k 10.0)))
(if (<= m 9e-32) (/ a (+ 1.0 (* k (+ k 10.0)))) t_0))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= -0.00065) {
tmp = t_0 / (1.0 + (k * 10.0));
} else if (m <= 9e-32) {
tmp = a / (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 = (k ** m) * a
if (m <= (-0.00065d0)) then
tmp = t_0 / (1.0d0 + (k * 10.0d0))
else if (m <= 9d-32) then
tmp = a / (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 = Math.pow(k, m) * a;
double tmp;
if (m <= -0.00065) {
tmp = t_0 / (1.0 + (k * 10.0));
} else if (m <= 9e-32) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if m <= -0.00065: tmp = t_0 / (1.0 + (k * 10.0)) elif m <= 9e-32: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -0.00065) tmp = Float64(t_0 / Float64(1.0 + Float64(k * 10.0))); elseif (m <= 9e-32) tmp = Float64(a / 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 = (k ^ m) * a; tmp = 0.0; if (m <= -0.00065) tmp = t_0 / (1.0 + (k * 10.0)); elseif (m <= 9e-32) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -0.00065], N[(t$95$0 / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9e-32], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -0.00065:\\
\;\;\;\;\frac{t_0}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 9 \cdot 10^{-32}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -6.4999999999999997e-4Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
*-commutative100.0%
sqr-neg100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -6.4999999999999997e-4 < m < 9.00000000000000009e-32Initial program 93.7%
associate-*r/93.7%
*-commutative93.7%
sqr-neg93.7%
associate-+l+93.7%
+-commutative93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
fma-def93.7%
+-commutative93.7%
Simplified93.7%
Taylor expanded in m around 0 93.7%
if 9.00000000000000009e-32 < m Initial program 83.3%
associate-*r/83.3%
*-commutative83.3%
sqr-neg83.3%
associate-+l+83.3%
+-commutative83.3%
sqr-neg83.3%
distribute-rgt-out83.3%
fma-def83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in k around 0 100.0%
Final simplification98.0%
(FPCore (a k m) :precision binary64 (if (<= k 0.00078) (* (pow k m) a) (/ (pow k m) (/ k (/ a k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = pow(k, m) * a;
} else {
tmp = pow(k, m) / (k / (a / k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.00078d0) then
tmp = (k ** m) * a
else
tmp = (k ** m) / (k / (a / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.00078) {
tmp = Math.pow(k, m) * a;
} else {
tmp = Math.pow(k, m) / (k / (a / k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.00078: tmp = math.pow(k, m) * a else: tmp = math.pow(k, m) / (k / (a / k)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.00078) tmp = Float64((k ^ m) * a); else tmp = Float64((k ^ m) / Float64(k / Float64(a / k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.00078) tmp = (k ^ m) * a; else tmp = (k ^ m) / (k / (a / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.00078], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] / N[(k / N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.00078:\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{\frac{k}{\frac{a}{k}}}\\
\end{array}
\end{array}
if k < 7.79999999999999986e-4Initial program 95.3%
associate-*r/95.3%
*-commutative95.3%
sqr-neg95.3%
associate-+l+95.3%
+-commutative95.3%
sqr-neg95.3%
distribute-rgt-out95.3%
fma-def95.3%
+-commutative95.3%
Simplified95.3%
Taylor expanded in k around 0 98.8%
if 7.79999999999999986e-4 < k Initial program 87.3%
associate-*r/87.3%
*-commutative87.3%
sqr-neg87.3%
associate-+l+87.3%
+-commutative87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
fma-def87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in k around inf 87.0%
*-commutative87.0%
unpow287.0%
times-frac92.6%
associate-*r*92.6%
*-commutative92.6%
exp-to-pow92.6%
mul-1-neg92.6%
Simplified92.6%
associate-*l/92.7%
associate-/l*91.1%
inv-pow91.1%
pow-pow91.1%
add-sqr-sqrt59.7%
sqrt-unprod76.5%
sqr-neg76.5%
sqrt-unprod16.8%
add-sqr-sqrt46.0%
neg-mul-146.0%
add-sqr-sqrt29.2%
sqrt-unprod60.5%
sqr-neg60.5%
sqrt-unprod31.4%
add-sqr-sqrt91.1%
Applied egg-rr91.1%
Final simplification96.2%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.00058) (not (<= m 9e-32))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00058) || !(m <= 9e-32)) {
tmp = pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-0.00058d0)) .or. (.not. (m <= 9d-32))) then
tmp = (k ** m) * a
else
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00058) || !(m <= 9e-32)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.00058) or not (m <= 9e-32): tmp = math.pow(k, m) * a else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.00058) || !(m <= 9e-32)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -0.00058) || ~((m <= 9e-32))) tmp = (k ^ m) * a; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.00058], N[Not[LessEqual[m, 9e-32]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00058 \lor \neg \left(m \leq 9 \cdot 10^{-32}\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.8e-4 or 9.00000000000000009e-32 < m Initial program 92.0%
associate-*r/92.0%
*-commutative92.0%
sqr-neg92.0%
associate-+l+92.0%
+-commutative92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
fma-def92.0%
+-commutative92.0%
Simplified92.0%
Taylor expanded in k around 0 99.4%
if -5.8e-4 < m < 9.00000000000000009e-32Initial program 93.7%
associate-*r/93.7%
*-commutative93.7%
sqr-neg93.7%
associate-+l+93.7%
+-commutative93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
fma-def93.7%
+-commutative93.7%
Simplified93.7%
Taylor expanded in m around 0 93.7%
Final simplification97.6%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (+ 1.0 (* k 10.0)))))
(if (<= m -0.00018)
(/ a (* k k))
(if (<= m 2.1e-170)
t_0
(if (<= m 2.4e-49)
(* (/ 1.0 k) (/ a k))
(if (<= m 7200000.0) t_0 (* -10.0 (* k a))))))))
double code(double a, double k, double m) {
double t_0 = a / (1.0 + (k * 10.0));
double tmp;
if (m <= -0.00018) {
tmp = a / (k * k);
} else if (m <= 2.1e-170) {
tmp = t_0;
} else if (m <= 2.4e-49) {
tmp = (1.0 / k) * (a / k);
} else if (m <= 7200000.0) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = a / (1.0d0 + (k * 10.0d0))
if (m <= (-0.00018d0)) then
tmp = a / (k * k)
else if (m <= 2.1d-170) then
tmp = t_0
else if (m <= 2.4d-49) then
tmp = (1.0d0 / k) * (a / k)
else if (m <= 7200000.0d0) then
tmp = t_0
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (1.0 + (k * 10.0));
double tmp;
if (m <= -0.00018) {
tmp = a / (k * k);
} else if (m <= 2.1e-170) {
tmp = t_0;
} else if (m <= 2.4e-49) {
tmp = (1.0 / k) * (a / k);
} else if (m <= 7200000.0) {
tmp = t_0;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): t_0 = a / (1.0 + (k * 10.0)) tmp = 0 if m <= -0.00018: tmp = a / (k * k) elif m <= 2.1e-170: tmp = t_0 elif m <= 2.4e-49: tmp = (1.0 / k) * (a / k) elif m <= 7200000.0: tmp = t_0 else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) t_0 = Float64(a / Float64(1.0 + Float64(k * 10.0))) tmp = 0.0 if (m <= -0.00018) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.1e-170) tmp = t_0; elseif (m <= 2.4e-49) tmp = Float64(Float64(1.0 / k) * Float64(a / k)); elseif (m <= 7200000.0) tmp = t_0; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (1.0 + (k * 10.0)); tmp = 0.0; if (m <= -0.00018) tmp = a / (k * k); elseif (m <= 2.1e-170) tmp = t_0; elseif (m <= 2.4e-49) tmp = (1.0 / k) * (a / k); elseif (m <= 7200000.0) tmp = t_0; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.00018], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.1e-170], t$95$0, If[LessEqual[m, 2.4e-49], N[(N[(1.0 / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 7200000.0], t$95$0, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{1 + k \cdot 10}\\
\mathbf{if}\;m \leq -0.00018:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.1 \cdot 10^{-170}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 2.4 \cdot 10^{-49}:\\
\;\;\;\;\frac{1}{k} \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 7200000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -1.80000000000000011e-4Initial program 99.0%
associate-*r/99.0%
*-commutative99.0%
sqr-neg99.0%
associate-+l+99.0%
+-commutative99.0%
sqr-neg99.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 39.8%
Taylor expanded in k around inf 67.4%
unpow267.4%
Simplified67.4%
if -1.80000000000000011e-4 < m < 2.1000000000000001e-170 or 2.39999999999999992e-49 < m < 7.2e6Initial program 93.1%
associate-*r/93.1%
*-commutative93.1%
sqr-neg93.1%
associate-+l+93.1%
+-commutative93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
fma-def93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in m around 0 90.3%
Taylor expanded in k around 0 70.7%
*-commutative70.7%
Simplified70.7%
if 2.1000000000000001e-170 < m < 2.39999999999999992e-49Initial program 97.5%
associate-*r/97.6%
*-commutative97.6%
sqr-neg97.6%
associate-+l+97.6%
+-commutative97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
fma-def97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in k around inf 74.5%
*-commutative74.5%
unpow274.5%
times-frac76.8%
associate-*r*76.8%
*-commutative76.8%
exp-to-pow76.8%
mul-1-neg76.8%
Simplified76.8%
Taylor expanded in m around 0 76.8%
if 7.2e6 < m Initial program 83.5%
associate-*r/83.5%
*-commutative83.5%
sqr-neg83.5%
associate-+l+83.5%
+-commutative83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
fma-def83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.0%
Taylor expanded in k around inf 18.5%
Final simplification53.7%
(FPCore (a k m) :precision binary64 (if (<= m -0.061) (/ a (* k k)) (if (<= m 7000000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.061) {
tmp = a / (k * k);
} else if (m <= 7000000.0) {
tmp = a / (1.0 + (k * (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 <= (-0.061d0)) then
tmp = a / (k * k)
else if (m <= 7000000.0d0) then
tmp = a / (1.0d0 + (k * (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 <= -0.061) {
tmp = a / (k * k);
} else if (m <= 7000000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.061: tmp = a / (k * k) elif m <= 7000000.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.061) tmp = Float64(a / Float64(k * k)); elseif (m <= 7000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * 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 <= -0.061) tmp = a / (k * k); elseif (m <= 7000000.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.061], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 7000000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.061:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 7000000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -0.060999999999999999Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 39.8%
Taylor expanded in k around inf 68.4%
unpow268.4%
Simplified68.4%
if -0.060999999999999999 < m < 7e6Initial program 93.0%
associate-*r/93.0%
*-commutative93.0%
sqr-neg93.0%
associate-+l+93.0%
+-commutative93.0%
sqr-neg93.0%
distribute-rgt-out93.0%
fma-def93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in m around 0 89.8%
if 7e6 < m Initial program 83.5%
associate-*r/83.5%
*-commutative83.5%
sqr-neg83.5%
associate-+l+83.5%
+-commutative83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
fma-def83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.0%
Taylor expanded in k around inf 18.5%
Final simplification60.2%
(FPCore (a k m) :precision binary64 (if (<= m -2.7e-87) (/ a (* k k)) (if (<= m 2e-171) a (if (<= m 9e-32) (/ (/ a k) k) (* -10.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.7e-87) {
tmp = a / (k * k);
} else if (m <= 2e-171) {
tmp = a;
} else if (m <= 9e-32) {
tmp = (a / 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 <= (-2.7d-87)) then
tmp = a / (k * k)
else if (m <= 2d-171) then
tmp = a
else if (m <= 9d-32) then
tmp = (a / 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 <= -2.7e-87) {
tmp = a / (k * k);
} else if (m <= 2e-171) {
tmp = a;
} else if (m <= 9e-32) {
tmp = (a / k) / k;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.7e-87: tmp = a / (k * k) elif m <= 2e-171: tmp = a elif m <= 9e-32: tmp = (a / k) / k else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.7e-87) tmp = Float64(a / Float64(k * k)); elseif (m <= 2e-171) tmp = a; elseif (m <= 9e-32) tmp = Float64(Float64(a / 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 <= -2.7e-87) tmp = a / (k * k); elseif (m <= 2e-171) tmp = a; elseif (m <= 9e-32) tmp = (a / k) / k; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.7e-87], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2e-171], a, If[LessEqual[m, 9e-32], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.7 \cdot 10^{-87}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2 \cdot 10^{-171}:\\
\;\;\;\;a\\
\mathbf{elif}\;m \leq 9 \cdot 10^{-32}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -2.69999999999999984e-87Initial program 98.2%
associate-*r/98.3%
*-commutative98.3%
sqr-neg98.3%
associate-+l+98.3%
+-commutative98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
fma-def98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in m around 0 47.2%
Taylor expanded in k around inf 66.6%
unpow266.6%
Simplified66.6%
if -2.69999999999999984e-87 < m < 2e-171Initial program 94.0%
associate-*r/93.9%
*-commutative93.9%
sqr-neg93.9%
associate-+l+93.9%
+-commutative93.9%
sqr-neg93.9%
distribute-rgt-out93.9%
fma-def93.9%
+-commutative93.9%
Simplified93.9%
Taylor expanded in m around 0 94.0%
Taylor expanded in k around 0 64.4%
if 2e-171 < m < 9.00000000000000009e-32Initial program 97.8%
associate-*r/97.9%
*-commutative97.9%
sqr-neg97.9%
associate-+l+98.0%
+-commutative98.0%
sqr-neg98.0%
distribute-rgt-out98.0%
fma-def98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in k around inf 68.4%
*-commutative68.4%
unpow268.4%
times-frac70.3%
associate-*r*70.3%
*-commutative70.3%
exp-to-pow70.3%
mul-1-neg70.3%
Simplified70.3%
associate-*l/70.3%
associate-/l*68.2%
inv-pow68.2%
pow-pow68.2%
add-sqr-sqrt0.0%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod68.2%
add-sqr-sqrt68.2%
neg-mul-168.2%
add-sqr-sqrt0.0%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod68.2%
add-sqr-sqrt68.2%
Applied egg-rr68.2%
Taylor expanded in m around 0 68.4%
unpow268.4%
associate-/r*70.3%
Simplified70.3%
if 9.00000000000000009e-32 < m Initial program 83.3%
associate-*r/83.3%
*-commutative83.3%
sqr-neg83.3%
associate-+l+83.3%
+-commutative83.3%
sqr-neg83.3%
distribute-rgt-out83.3%
fma-def83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in m around 0 5.2%
Taylor expanded in k around 0 10.8%
Taylor expanded in k around inf 17.6%
Final simplification50.4%
(FPCore (a k m) :precision binary64 (if (or (<= k 2e-309) (not (<= k 0.1))) (/ a (* k k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 2e-309) || !(k <= 0.1)) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 2d-309) .or. (.not. (k <= 0.1d0))) then
tmp = a / (k * k)
else
tmp = a * (1.0d0 + (k * (-10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 2e-309) || !(k <= 0.1)) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 2e-309) or not (k <= 0.1): tmp = a / (k * k) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 2e-309) || !(k <= 0.1)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 2e-309) || ~((k <= 0.1))) tmp = a / (k * k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 2e-309], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-309} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < 1.9999999999999988e-309 or 0.10000000000000001 < k Initial program 88.1%
associate-*r/88.1%
*-commutative88.1%
sqr-neg88.1%
associate-+l+88.1%
+-commutative88.1%
sqr-neg88.1%
distribute-rgt-out88.1%
fma-def88.1%
+-commutative88.1%
Simplified88.1%
Taylor expanded in m around 0 45.4%
Taylor expanded in k around inf 51.7%
unpow251.7%
Simplified51.7%
if 1.9999999999999988e-309 < k < 0.10000000000000001Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 44.9%
Taylor expanded in k around 0 44.4%
Final simplification48.9%
(FPCore (a k m) :precision binary64 (if (<= m -92000000.0) (/ a (* k k)) (if (<= m 7000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -92000000.0) {
tmp = a / (k * k);
} else if (m <= 7000000.0) {
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 <= (-92000000.0d0)) then
tmp = a / (k * k)
else if (m <= 7000000.0d0) 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 <= -92000000.0) {
tmp = a / (k * k);
} else if (m <= 7000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -92000000.0: tmp = a / (k * k) elif m <= 7000000.0: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -92000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 7000000.0) 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 <= -92000000.0) tmp = a / (k * k); elseif (m <= 7000000.0) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -92000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 7000000.0], 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 -92000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 7000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -9.2e7Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.2%
Taylor expanded in k around inf 69.2%
unpow269.2%
Simplified69.2%
if -9.2e7 < m < 7e6Initial program 93.0%
associate-*r/93.1%
*-commutative93.1%
sqr-neg93.1%
associate-+l+93.1%
+-commutative93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
fma-def93.1%
+-commutative93.1%
Simplified93.1%
Taylor expanded in m around 0 88.8%
Taylor expanded in k around inf 87.2%
unpow287.2%
Simplified87.2%
if 7e6 < m Initial program 83.5%
associate-*r/83.5%
*-commutative83.5%
sqr-neg83.5%
associate-+l+83.5%
+-commutative83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
fma-def83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.0%
Taylor expanded in k around inf 18.5%
Final simplification59.6%
(FPCore (a k m) :precision binary64 (if (or (<= k 3.4e-305) (not (<= k 120000000.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 3.4e-305) || !(k <= 120000000.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 3.4d-305) .or. (.not. (k <= 120000000.0d0))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 3.4e-305) || !(k <= 120000000.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 3.4e-305) or not (k <= 120000000.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 3.4e-305) || !(k <= 120000000.0)) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 3.4e-305) || ~((k <= 120000000.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 3.4e-305], N[Not[LessEqual[k, 120000000.0]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.4 \cdot 10^{-305} \lor \neg \left(k \leq 120000000\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 3.4000000000000001e-305 or 1.2e8 < k Initial program 87.9%
associate-*r/87.9%
*-commutative87.9%
sqr-neg87.9%
associate-+l+87.9%
+-commutative87.9%
sqr-neg87.9%
distribute-rgt-out87.9%
fma-def87.9%
+-commutative87.9%
Simplified87.9%
Taylor expanded in m around 0 46.2%
Taylor expanded in k around inf 52.6%
unpow252.6%
Simplified52.6%
if 3.4000000000000001e-305 < k < 1.2e8Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 43.6%
Taylor expanded in k around 0 42.6%
Final simplification48.7%
(FPCore (a k m) :precision binary64 (if (<= m -2.05e-22) (* (/ a k) 0.1) (if (<= m 7000000.0) a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.05e-22) {
tmp = (a / k) * 0.1;
} else if (m <= 7000000.0) {
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 <= (-2.05d-22)) then
tmp = (a / k) * 0.1d0
else if (m <= 7000000.0d0) 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 <= -2.05e-22) {
tmp = (a / k) * 0.1;
} else if (m <= 7000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.05e-22: tmp = (a / k) * 0.1 elif m <= 7000000.0: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.05e-22) tmp = Float64(Float64(a / k) * 0.1); elseif (m <= 7000000.0) 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 <= -2.05e-22) tmp = (a / k) * 0.1; elseif (m <= 7000000.0) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.05e-22], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[m, 7000000.0], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.05 \cdot 10^{-22}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;m \leq 7000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -2.05e-22Initial program 99.0%
associate-*r/99.0%
*-commutative99.0%
sqr-neg99.0%
associate-+l+99.0%
+-commutative99.0%
sqr-neg99.0%
distribute-rgt-out99.0%
fma-def99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in m around 0 41.1%
Taylor expanded in k around 0 19.0%
*-commutative19.0%
Simplified19.0%
Taylor expanded in k around inf 22.5%
if -2.05e-22 < m < 7e6Initial program 93.7%
associate-*r/93.7%
*-commutative93.7%
sqr-neg93.7%
associate-+l+93.7%
+-commutative93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
fma-def93.7%
+-commutative93.7%
Simplified93.7%
Taylor expanded in m around 0 91.3%
Taylor expanded in k around 0 51.5%
if 7e6 < m Initial program 83.5%
associate-*r/83.5%
*-commutative83.5%
sqr-neg83.5%
associate-+l+83.5%
+-commutative83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
fma-def83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.0%
Taylor expanded in k around inf 18.5%
Final simplification30.4%
(FPCore (a k m) :precision binary64 (if (<= m 7000000.0) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7000000.0) {
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 <= 7000000.0d0) 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 <= 7000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7000000.0: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7000000.0) 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 <= 7000000.0) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7000000.0], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 7e6Initial program 96.6%
associate-*r/96.6%
*-commutative96.6%
sqr-neg96.6%
associate-+l+96.6%
+-commutative96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
fma-def96.6%
+-commutative96.6%
Simplified96.6%
Taylor expanded in m around 0 64.1%
Taylor expanded in k around 0 25.7%
if 7e6 < m Initial program 83.5%
associate-*r/83.5%
*-commutative83.5%
sqr-neg83.5%
associate-+l+83.5%
+-commutative83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
fma-def83.5%
+-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.0%
Taylor expanded in k around inf 18.5%
Final simplification23.5%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 92.6%
associate-*r/92.6%
*-commutative92.6%
sqr-neg92.6%
associate-+l+92.6%
+-commutative92.6%
sqr-neg92.6%
distribute-rgt-out92.6%
fma-def92.6%
+-commutative92.6%
Simplified92.6%
Taylor expanded in m around 0 45.2%
Taylor expanded in k around 0 18.9%
Final simplification18.9%
herbie shell --seed 2023285
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))