
(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
(let* ((t_0 (* a (pow k m))))
(if (<= m -5.6e-18)
t_0
(if (<= m 2e-113)
(/ 1.0 (+ (/ 1.0 a) (* (/ k a) (+ k 10.0))))
(if (<= m 3.9) (/ (pow k m) (/ (+ 1.0 (* k (+ k 10.0))) a)) t_0)))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -5.6e-18) {
tmp = t_0;
} else if (m <= 2e-113) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else if (m <= 3.9) {
tmp = pow(k, m) / ((1.0 + (k * (k + 10.0))) / a);
} 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 <= (-5.6d-18)) then
tmp = t_0
else if (m <= 2d-113) then
tmp = 1.0d0 / ((1.0d0 / a) + ((k / a) * (k + 10.0d0)))
else if (m <= 3.9d0) then
tmp = (k ** m) / ((1.0d0 + (k * (k + 10.0d0))) / a)
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 <= -5.6e-18) {
tmp = t_0;
} else if (m <= 2e-113) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else if (m <= 3.9) {
tmp = Math.pow(k, m) / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= -5.6e-18: tmp = t_0 elif m <= 2e-113: tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))) elif m <= 3.9: tmp = math.pow(k, m) / ((1.0 + (k * (k + 10.0))) / a) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -5.6e-18) tmp = t_0; elseif (m <= 2e-113) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(Float64(k / a) * Float64(k + 10.0)))); elseif (m <= 3.9) tmp = Float64((k ^ m) / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); 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 <= -5.6e-18) tmp = t_0; elseif (m <= 2e-113) tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))); elseif (m <= 3.9) tmp = (k ^ m) / ((1.0 + (k * (k + 10.0))) / a); 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, -5.6e-18], t$95$0, If[LessEqual[m, 2e-113], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.9], N[(N[Power[k, m], $MachinePrecision] / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -5.6 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 2 \cdot 10^{-113}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + \frac{k}{a} \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 3.9:\\
\;\;\;\;\frac{{k}^{m}}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -5.60000000000000025e-18 or 3.89999999999999991 < m Initial program 87.0%
associate-/l*87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in k around 0 100.0%
if -5.60000000000000025e-18 < m < 1.99999999999999996e-113Initial program 93.9%
*-commutative93.9%
associate-/l*93.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 k around 0 93.7%
Taylor expanded in m around 0 93.7%
+-commutative93.7%
associate-+l+93.7%
+-commutative93.7%
unpow293.7%
associate-*r/99.7%
distribute-rgt-out99.7%
Simplified99.7%
if 1.99999999999999996e-113 < m < 3.89999999999999991Initial program 99.9%
*-commutative99.9%
associate-/l*99.8%
sqr-neg99.8%
associate-+l+99.8%
+-commutative99.8%
sqr-neg99.8%
distribute-rgt-out99.8%
fma-def99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in a around 0 99.8%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 5e+231) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 5e+231) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 5d+231) then
tmp = t_1
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 t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 5e+231) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 5e+231: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 5e+231) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 5e+231) tmp = t_1; 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]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+231], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+231}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 5.00000000000000028e231Initial program 97.7%
if 5.00000000000000028e231 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 55.3%
associate-/l*55.3%
sqr-neg55.3%
associate-+l+55.3%
sqr-neg55.3%
distribute-rgt-out57.4%
Simplified57.4%
Taylor expanded in k around 0 100.0%
Final simplification98.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -5.6e-18)
t_0
(if (<= m 1.6e-111)
(/ 1.0 (+ (/ 1.0 a) (* (/ k a) (+ k 10.0))))
(if (<= m 3.9) (/ a (/ (+ 1.0 (* k (+ k 10.0))) (pow k m))) t_0)))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -5.6e-18) {
tmp = t_0;
} else if (m <= 1.6e-111) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else if (m <= 3.9) {
tmp = a / ((1.0 + (k * (k + 10.0))) / pow(k, m));
} 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 <= (-5.6d-18)) then
tmp = t_0
else if (m <= 1.6d-111) then
tmp = 1.0d0 / ((1.0d0 / a) + ((k / a) * (k + 10.0d0)))
else if (m <= 3.9d0) then
tmp = a / ((1.0d0 + (k * (k + 10.0d0))) / (k ** m))
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 <= -5.6e-18) {
tmp = t_0;
} else if (m <= 1.6e-111) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else if (m <= 3.9) {
tmp = a / ((1.0 + (k * (k + 10.0))) / Math.pow(k, m));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= -5.6e-18: tmp = t_0 elif m <= 1.6e-111: tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))) elif m <= 3.9: tmp = a / ((1.0 + (k * (k + 10.0))) / math.pow(k, m)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -5.6e-18) tmp = t_0; elseif (m <= 1.6e-111) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(Float64(k / a) * Float64(k + 10.0)))); elseif (m <= 3.9) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / (k ^ m))); 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 <= -5.6e-18) tmp = t_0; elseif (m <= 1.6e-111) tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))); elseif (m <= 3.9) tmp = a / ((1.0 + (k * (k + 10.0))) / (k ^ m)); 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, -5.6e-18], t$95$0, If[LessEqual[m, 1.6e-111], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.9], N[(a / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -5.6 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq 1.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + \frac{k}{a} \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 3.9:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot \left(k + 10\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -5.60000000000000025e-18 or 3.89999999999999991 < m Initial program 87.0%
associate-/l*87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in k around 0 100.0%
if -5.60000000000000025e-18 < m < 1.5999999999999999e-111Initial program 93.9%
*-commutative93.9%
associate-/l*93.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 k around 0 93.7%
Taylor expanded in m around 0 93.7%
+-commutative93.7%
associate-+l+93.7%
+-commutative93.7%
unpow293.7%
associate-*r/99.7%
distribute-rgt-out99.7%
Simplified99.7%
if 1.5999999999999999e-111 < m < 3.89999999999999991Initial program 99.9%
associate-/l*99.7%
sqr-neg99.7%
associate-+l+99.7%
sqr-neg99.7%
distribute-rgt-out99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.6e-18) (not (<= m 0.09))) (* a (pow k m)) (/ 1.0 (+ (/ 1.0 a) (* (/ k a) (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.6e-18) || !(m <= 0.09)) {
tmp = a * pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (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 <= (-5.6d-18)) .or. (.not. (m <= 0.09d0))) then
tmp = a * (k ** m)
else
tmp = 1.0d0 / ((1.0d0 / a) + ((k / a) * (k + 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -5.6e-18) || !(m <= 0.09)) {
tmp = a * Math.pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -5.6e-18) or not (m <= 0.09): tmp = a * math.pow(k, m) else: tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -5.6e-18) || !(m <= 0.09)) tmp = Float64(a * (k ^ m)); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(Float64(k / a) * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -5.6e-18) || ~((m <= 0.09))) tmp = a * (k ^ m); else tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -5.6e-18], N[Not[LessEqual[m, 0.09]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.6 \cdot 10^{-18} \lor \neg \left(m \leq 0.09\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + \frac{k}{a} \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.60000000000000025e-18 or 0.089999999999999997 < m Initial program 87.0%
associate-/l*87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in k around 0 100.0%
if -5.60000000000000025e-18 < m < 0.089999999999999997Initial program 95.0%
*-commutative95.0%
associate-/l*94.9%
sqr-neg94.9%
associate-+l+94.9%
+-commutative94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
fma-def94.9%
+-commutative94.9%
Simplified94.9%
Taylor expanded in k around 0 94.9%
Taylor expanded in m around 0 93.2%
+-commutative93.2%
associate-+l+93.2%
+-commutative93.2%
unpow293.2%
associate-*r/98.1%
distribute-rgt-out98.1%
Simplified98.1%
Final simplification99.3%
(FPCore (a k m)
:precision binary64
(if (<= m -0.84)
(/ (/ a k) k)
(if (<= m 0.058)
(/ 1.0 (+ (/ 1.0 a) (* (/ k a) (+ k 10.0))))
(/ (/ a (+ (- (/ 12.0 k) k) -5.0)) k))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.84) {
tmp = (a / k) / k;
} else if (m <= 0.058) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else {
tmp = (a / (((12.0 / k) - k) + -5.0)) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.84d0)) then
tmp = (a / k) / k
else if (m <= 0.058d0) then
tmp = 1.0d0 / ((1.0d0 / a) + ((k / a) * (k + 10.0d0)))
else
tmp = (a / (((12.0d0 / k) - k) + (-5.0d0))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.84) {
tmp = (a / k) / k;
} else if (m <= 0.058) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else {
tmp = (a / (((12.0 / k) - k) + -5.0)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.84: tmp = (a / k) / k elif m <= 0.058: tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))) else: tmp = (a / (((12.0 / k) - k) + -5.0)) / k return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.84) tmp = Float64(Float64(a / k) / k); elseif (m <= 0.058) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(Float64(k / a) * Float64(k + 10.0)))); else tmp = Float64(Float64(a / Float64(Float64(Float64(12.0 / k) - k) + -5.0)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.84) tmp = (a / k) / k; elseif (m <= 0.058) tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))); else tmp = (a / (((12.0 / k) - k) + -5.0)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.84], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 0.058], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(N[(12.0 / k), $MachinePrecision] - k), $MachinePrecision] + -5.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.84:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 0.058:\\
\;\;\;\;\frac{1}{\frac{1}{a} + \frac{k}{a} \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\left(\frac{12}{k} - k\right) + -5}}{k}\\
\end{array}
\end{array}
if m < -0.839999999999999969Initial program 98.8%
associate-/l*98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
*-un-lft-identity35.8%
add-sqr-sqrt35.8%
times-frac35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
Applied egg-rr35.8%
associate-*l/35.8%
*-lft-identity35.8%
+-commutative35.8%
+-commutative35.8%
Simplified35.8%
Taylor expanded in k around inf 41.1%
Taylor expanded in k around inf 45.0%
if -0.839999999999999969 < m < 0.0580000000000000029Initial program 95.0%
*-commutative95.0%
associate-/l*94.9%
sqr-neg94.9%
associate-+l+94.9%
+-commutative94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
fma-def94.9%
+-commutative94.9%
Simplified94.9%
Taylor expanded in k around 0 94.9%
Taylor expanded in m around 0 93.1%
+-commutative93.1%
associate-+l+93.1%
+-commutative93.1%
unpow293.1%
associate-*r/98.0%
distribute-rgt-out98.0%
Simplified98.0%
if 0.0580000000000000029 < m Initial program 74.4%
associate-/l*74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 4.3%
*-un-lft-identity4.3%
add-sqr-sqrt4.3%
times-frac4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
Applied egg-rr4.3%
associate-*l/4.3%
*-lft-identity4.3%
+-commutative4.3%
+-commutative4.3%
Simplified4.3%
Taylor expanded in k around inf 3.4%
Taylor expanded in k around -inf 15.9%
sub-neg15.9%
neg-mul-115.9%
+-commutative15.9%
unsub-neg15.9%
associate-*r/15.9%
metadata-eval15.9%
metadata-eval15.9%
Simplified15.9%
Final simplification55.8%
(FPCore (a k m)
:precision binary64
(if (<= m -0.95)
(/ (/ a k) k)
(if (<= m 0.052)
(/ 1.0 (+ (/ 1.0 a) (* (/ k a) (+ k 10.0))))
(/ (/ a (+ (+ k 5.0) (* 12.0 (/ -1.0 k)))) k))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.95) {
tmp = (a / k) / k;
} else if (m <= 0.052) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else {
tmp = (a / ((k + 5.0) + (12.0 * (-1.0 / k)))) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.95d0)) then
tmp = (a / k) / k
else if (m <= 0.052d0) then
tmp = 1.0d0 / ((1.0d0 / a) + ((k / a) * (k + 10.0d0)))
else
tmp = (a / ((k + 5.0d0) + (12.0d0 * ((-1.0d0) / k)))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.95) {
tmp = (a / k) / k;
} else if (m <= 0.052) {
tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0)));
} else {
tmp = (a / ((k + 5.0) + (12.0 * (-1.0 / k)))) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.95: tmp = (a / k) / k elif m <= 0.052: tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))) else: tmp = (a / ((k + 5.0) + (12.0 * (-1.0 / k)))) / k return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.95) tmp = Float64(Float64(a / k) / k); elseif (m <= 0.052) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(Float64(k / a) * Float64(k + 10.0)))); else tmp = Float64(Float64(a / Float64(Float64(k + 5.0) + Float64(12.0 * Float64(-1.0 / k)))) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.95) tmp = (a / k) / k; elseif (m <= 0.052) tmp = 1.0 / ((1.0 / a) + ((k / a) * (k + 10.0))); else tmp = (a / ((k + 5.0) + (12.0 * (-1.0 / k)))) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.95], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 0.052], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(k + 5.0), $MachinePrecision] + N[(12.0 * N[(-1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.95:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 0.052:\\
\;\;\;\;\frac{1}{\frac{1}{a} + \frac{k}{a} \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\left(k + 5\right) + 12 \cdot \frac{-1}{k}}}{k}\\
\end{array}
\end{array}
if m < -0.94999999999999996Initial program 98.8%
associate-/l*98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
*-un-lft-identity35.8%
add-sqr-sqrt35.8%
times-frac35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
Applied egg-rr35.8%
associate-*l/35.8%
*-lft-identity35.8%
+-commutative35.8%
+-commutative35.8%
Simplified35.8%
Taylor expanded in k around inf 41.1%
Taylor expanded in k around inf 45.0%
if -0.94999999999999996 < m < 0.0519999999999999976Initial program 95.0%
*-commutative95.0%
associate-/l*94.9%
sqr-neg94.9%
associate-+l+94.9%
+-commutative94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
fma-def94.9%
+-commutative94.9%
Simplified94.9%
Taylor expanded in k around 0 94.9%
Taylor expanded in m around 0 93.1%
+-commutative93.1%
associate-+l+93.1%
+-commutative93.1%
unpow293.1%
associate-*r/98.0%
distribute-rgt-out98.0%
Simplified98.0%
if 0.0519999999999999976 < m Initial program 74.4%
associate-/l*74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 4.3%
*-un-lft-identity4.3%
add-sqr-sqrt4.3%
times-frac4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
Applied egg-rr4.3%
associate-*l/4.3%
*-lft-identity4.3%
+-commutative4.3%
+-commutative4.3%
Simplified4.3%
Taylor expanded in k around inf 3.4%
Taylor expanded in k around inf 16.2%
Final simplification55.9%
(FPCore (a k m)
:precision binary64
(if (<= m -0.11)
(/ (/ a k) k)
(if (<= m 0.055)
(/ a (+ 1.0 (* k (+ k 10.0))))
(/ (/ a (+ (- (/ 12.0 k) k) -5.0)) k))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.11) {
tmp = (a / k) / k;
} else if (m <= 0.055) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = (a / (((12.0 / k) - k) + -5.0)) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.11d0)) then
tmp = (a / k) / k
else if (m <= 0.055d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (a / (((12.0d0 / k) - k) + (-5.0d0))) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.11) {
tmp = (a / k) / k;
} else if (m <= 0.055) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = (a / (((12.0 / k) - k) + -5.0)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.11: tmp = (a / k) / k elif m <= 0.055: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = (a / (((12.0 / k) - k) + -5.0)) / k return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.11) tmp = Float64(Float64(a / k) / k); elseif (m <= 0.055) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(Float64(a / Float64(Float64(Float64(12.0 / k) - k) + -5.0)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.11) tmp = (a / k) / k; elseif (m <= 0.055) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = (a / (((12.0 / k) - k) + -5.0)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.11], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 0.055], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(N[(N[(12.0 / k), $MachinePrecision] - k), $MachinePrecision] + -5.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.11:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 0.055:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{\left(\frac{12}{k} - k\right) + -5}}{k}\\
\end{array}
\end{array}
if m < -0.110000000000000001Initial program 98.8%
associate-/l*98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
*-un-lft-identity35.8%
add-sqr-sqrt35.8%
times-frac35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
Applied egg-rr35.8%
associate-*l/35.8%
*-lft-identity35.8%
+-commutative35.8%
+-commutative35.8%
Simplified35.8%
Taylor expanded in k around inf 41.1%
Taylor expanded in k around inf 45.0%
if -0.110000000000000001 < m < 0.0550000000000000003Initial program 95.0%
associate-/l*95.0%
sqr-neg95.0%
associate-+l+95.0%
sqr-neg95.0%
distribute-rgt-out95.0%
Simplified95.0%
Taylor expanded in m around 0 93.3%
if 0.0550000000000000003 < m Initial program 74.4%
associate-/l*74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 4.3%
*-un-lft-identity4.3%
add-sqr-sqrt4.3%
times-frac4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
+-commutative4.3%
fma-def4.3%
+-commutative4.3%
Applied egg-rr4.3%
associate-*l/4.3%
*-lft-identity4.3%
+-commutative4.3%
+-commutative4.3%
Simplified4.3%
Taylor expanded in k around inf 3.4%
Taylor expanded in k around -inf 15.9%
sub-neg15.9%
neg-mul-115.9%
+-commutative15.9%
unsub-neg15.9%
associate-*r/15.9%
metadata-eval15.9%
metadata-eval15.9%
Simplified15.9%
Final simplification54.1%
(FPCore (a k m) :precision binary64 (if (<= k 2e-309) (/ (/ a k) k) (if (<= k 1.0) (/ a (+ 1.0 (* k 10.0))) (/ 1.0 (* (/ k a) (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2e-309) {
tmp = (a / k) / k;
} else if (k <= 1.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / ((k / a) * (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) then
tmp = (a / k) / k
else if (k <= 1.0d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = 1.0d0 / ((k / a) * (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) {
tmp = (a / k) / k;
} else if (k <= 1.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = 1.0 / ((k / a) * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2e-309: tmp = (a / k) / k elif k <= 1.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = 1.0 / ((k / a) * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2e-309) tmp = Float64(Float64(a / k) / k); elseif (k <= 1.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(1.0 / Float64(Float64(k / a) * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2e-309) tmp = (a / k) / k; elseif (k <= 1.0) tmp = a / (1.0 + (k * 10.0)); else tmp = 1.0 / ((k / a) * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2e-309], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[k, 1.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2 \cdot 10^{-309}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;k \leq 1:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{k}{a} \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 1.9999999999999988e-309Initial program 91.3%
associate-/l*91.3%
sqr-neg91.3%
associate-+l+91.3%
sqr-neg91.3%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 23.1%
*-un-lft-identity23.1%
add-sqr-sqrt23.1%
times-frac23.1%
+-commutative23.1%
fma-def23.1%
+-commutative23.1%
+-commutative23.1%
fma-def23.1%
+-commutative23.1%
Applied egg-rr23.1%
associate-*l/23.1%
*-lft-identity23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 21.9%
Taylor expanded in k around inf 24.1%
if 1.9999999999999988e-309 < k < 1Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 56.5%
Taylor expanded in k around 0 55.6%
*-commutative55.6%
Simplified55.6%
if 1 < k Initial program 77.6%
*-commutative77.6%
associate-/l*75.4%
sqr-neg75.4%
associate-+l+75.4%
+-commutative75.4%
sqr-neg75.4%
distribute-rgt-out75.4%
fma-def75.4%
+-commutative75.4%
Simplified75.4%
Taylor expanded in k around 0 75.4%
Taylor expanded in m around 0 57.2%
+-commutative57.2%
associate-+l+57.1%
+-commutative57.1%
unpow257.1%
associate-*r/60.3%
distribute-rgt-out60.3%
Simplified60.3%
Taylor expanded in a around 0 57.2%
Taylor expanded in k around inf 56.3%
unpow256.3%
associate-*r/59.5%
distribute-rgt-out59.5%
Simplified59.5%
Final simplification48.4%
(FPCore (a k m) :precision binary64 (if (or (<= k -2e-310) (not (<= k 0.1))) (/ (/ a k) k) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2e-310) || !(k <= 0.1)) {
tmp = (a / k) / k;
} else {
tmp = a + (-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 ((k <= (-2d-310)) .or. (.not. (k <= 0.1d0))) then
tmp = (a / k) / k
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -2e-310) || !(k <= 0.1)) {
tmp = (a / k) / k;
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2e-310) or not (k <= 0.1): tmp = (a / k) / k else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2e-310) || !(k <= 0.1)) tmp = Float64(Float64(a / k) / k); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -2e-310) || ~((k <= 0.1))) tmp = (a / k) / k; else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2e-310], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-310} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if k < -1.999999999999994e-310 or 0.10000000000000001 < k Initial program 83.6%
associate-/l*83.6%
sqr-neg83.6%
associate-+l+83.6%
sqr-neg83.6%
distribute-rgt-out84.3%
Simplified84.3%
Taylor expanded in m around 0 41.9%
*-un-lft-identity41.9%
add-sqr-sqrt41.9%
times-frac41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
Applied egg-rr41.9%
associate-*l/41.9%
*-lft-identity41.9%
+-commutative41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in k around inf 40.4%
Taylor expanded in k around inf 42.9%
if -1.999999999999994e-310 < k < 0.10000000000000001Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 56.5%
Taylor expanded in k around 0 55.2%
Final simplification47.6%
(FPCore (a k m) :precision binary64 (if (or (<= k 3e-309) (not (<= k 10.2))) (/ (/ a k) k) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 3e-309) || !(k <= 10.2)) {
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 <= 3d-309) .or. (.not. (k <= 10.2d0))) 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 <= 3e-309) || !(k <= 10.2)) {
tmp = (a / k) / k;
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 3e-309) or not (k <= 10.2): tmp = (a / k) / k else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 3e-309) || !(k <= 10.2)) tmp = Float64(Float64(a / 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 <= 3e-309) || ~((k <= 10.2))) 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, 3e-309], N[Not[LessEqual[k, 10.2]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-309} \lor \neg \left(k \leq 10.2\right):\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < 3.000000000000001e-309 or 10.199999999999999 < k Initial program 83.6%
associate-/l*83.6%
sqr-neg83.6%
associate-+l+83.6%
sqr-neg83.6%
distribute-rgt-out84.3%
Simplified84.3%
Taylor expanded in m around 0 41.9%
*-un-lft-identity41.9%
add-sqr-sqrt41.9%
times-frac41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
Applied egg-rr41.9%
associate-*l/41.9%
*-lft-identity41.9%
+-commutative41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in k around inf 40.4%
Taylor expanded in k around inf 42.9%
if 3.000000000000001e-309 < k < 10.199999999999999Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 56.5%
Taylor expanded in k around 0 55.6%
*-commutative55.6%
Simplified55.6%
Final simplification47.8%
(FPCore (a k m) :precision binary64 (if (<= k -2e-310) (/ (/ a k) k) (if (<= k 5.2) (/ a (+ 1.0 (* k 10.0))) (/ (/ a (+ k 5.0)) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = (a / k) / k;
} else if (k <= 5.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / (k + 5.0)) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= (-2d-310)) then
tmp = (a / k) / k
else if (k <= 5.2d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / (k + 5.0d0)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = (a / k) / k;
} else if (k <= 5.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / (k + 5.0)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2e-310: tmp = (a / k) / k elif k <= 5.2: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / (k + 5.0)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2e-310) tmp = Float64(Float64(a / k) / k); elseif (k <= 5.2) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / Float64(k + 5.0)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2e-310) tmp = (a / k) / k; elseif (k <= 5.2) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / (k + 5.0)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2e-310], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[k, 5.2], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / N[(k + 5.0), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;k \leq 5.2:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k + 5}}{k}\\
\end{array}
\end{array}
if k < -1.999999999999994e-310Initial program 91.3%
associate-/l*91.3%
sqr-neg91.3%
associate-+l+91.3%
sqr-neg91.3%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 23.1%
*-un-lft-identity23.1%
add-sqr-sqrt23.1%
times-frac23.1%
+-commutative23.1%
fma-def23.1%
+-commutative23.1%
+-commutative23.1%
fma-def23.1%
+-commutative23.1%
Applied egg-rr23.1%
associate-*l/23.1%
*-lft-identity23.1%
+-commutative23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 21.9%
Taylor expanded in k around inf 24.1%
if -1.999999999999994e-310 < k < 5.20000000000000018Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 56.5%
Taylor expanded in k around 0 55.6%
*-commutative55.6%
Simplified55.6%
if 5.20000000000000018 < k Initial program 77.6%
associate-/l*77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 56.6%
*-un-lft-identity56.6%
add-sqr-sqrt56.6%
times-frac56.6%
+-commutative56.6%
fma-def56.6%
+-commutative56.6%
+-commutative56.6%
fma-def56.6%
+-commutative56.6%
Applied egg-rr56.6%
associate-*l/56.6%
*-lft-identity56.6%
+-commutative56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in k around inf 54.9%
Taylor expanded in k around inf 57.7%
+-commutative57.7%
Simplified57.7%
Final simplification47.8%
(FPCore (a k m) :precision binary64 (if (<= m -0.055) (/ (/ a k) k) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.055) {
tmp = (a / k) / k;
} 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.055d0)) then
tmp = (a / k) / k
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.055) {
tmp = (a / k) / k;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.055: tmp = (a / k) / k else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.055) tmp = Float64(Float64(a / k) / k); 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.055) tmp = (a / k) / k; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.055], N[(N[(a / k), $MachinePrecision] / k), $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.055:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.0550000000000000003Initial program 98.8%
associate-/l*98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
*-un-lft-identity35.8%
add-sqr-sqrt35.8%
times-frac35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
+-commutative35.8%
fma-def35.8%
+-commutative35.8%
Applied egg-rr35.8%
associate-*l/35.8%
*-lft-identity35.8%
+-commutative35.8%
+-commutative35.8%
Simplified35.8%
Taylor expanded in k around inf 41.1%
Taylor expanded in k around inf 45.0%
if -0.0550000000000000003 < m Initial program 85.7%
associate-/l*85.7%
sqr-neg85.7%
associate-+l+85.7%
sqr-neg85.7%
distribute-rgt-out85.7%
Simplified85.7%
Taylor expanded in m around 0 53.2%
Final simplification50.5%
(FPCore (a k m) :precision binary64 (if (or (<= k 3e-309) (not (<= k 1.0))) (/ (/ a k) k) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 3e-309) || !(k <= 1.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 <= 3d-309) .or. (.not. (k <= 1.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 <= 3e-309) || !(k <= 1.0)) {
tmp = (a / k) / k;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 3e-309) or not (k <= 1.0): tmp = (a / k) / k else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 3e-309) || !(k <= 1.0)) tmp = Float64(Float64(a / k) / k); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 3e-309) || ~((k <= 1.0))) tmp = (a / k) / k; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 3e-309], N[Not[LessEqual[k, 1.0]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3 \cdot 10^{-309} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 3.000000000000001e-309 or 1 < k Initial program 83.6%
associate-/l*83.6%
sqr-neg83.6%
associate-+l+83.6%
sqr-neg83.6%
distribute-rgt-out84.3%
Simplified84.3%
Taylor expanded in m around 0 41.9%
*-un-lft-identity41.9%
add-sqr-sqrt41.9%
times-frac41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
+-commutative41.9%
fma-def41.9%
+-commutative41.9%
Applied egg-rr41.9%
associate-*l/41.9%
*-lft-identity41.9%
+-commutative41.9%
+-commutative41.9%
Simplified41.9%
Taylor expanded in k around inf 40.4%
Taylor expanded in k around inf 42.9%
if 3.000000000000001e-309 < k < 1Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 56.5%
Taylor expanded in k around 0 54.2%
Final simplification47.2%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (* (/ a k) 0.1)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.1d0) then
tmp = a
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 96.4%
associate-/l*96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 42.8%
Taylor expanded in k around 0 33.3%
if 0.10000000000000001 < k Initial program 77.6%
associate-/l*77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 56.6%
Taylor expanded in k around 0 23.5%
*-commutative23.5%
Simplified23.5%
Taylor expanded in k around inf 23.5%
Final simplification30.0%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) a (/ a k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a;
} else {
tmp = 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 <= 1.0d0) then
tmp = a
else
tmp = a / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a;
} else {
tmp = a / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a else: tmp = a / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = a; else tmp = Float64(a / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a; else tmp = a / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], a, N[(a / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k}\\
\end{array}
\end{array}
if k < 1Initial program 96.4%
associate-/l*96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 42.8%
Taylor expanded in k around 0 33.3%
if 1 < k Initial program 77.6%
associate-/l*77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 56.6%
*-un-lft-identity56.6%
add-sqr-sqrt56.6%
times-frac56.6%
+-commutative56.6%
fma-def56.6%
+-commutative56.6%
+-commutative56.6%
fma-def56.6%
+-commutative56.6%
Applied egg-rr56.6%
associate-*l/56.6%
*-lft-identity56.6%
+-commutative56.6%
+-commutative56.6%
Simplified56.6%
Taylor expanded in k around inf 54.9%
Taylor expanded in k around 0 23.4%
Final simplification29.9%
(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.0%
associate-/l*89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out90.3%
Simplified90.3%
Taylor expanded in m around 0 47.5%
Taylor expanded in k around 0 23.4%
Final simplification23.4%
herbie shell --seed 2023334
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))