
(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 (* (pow k m) a)) (t_1 (/ 1.0 t_0))) (if (<= k 1e-254) t_0 (/ 1.0 (+ t_1 (* k (+ (* 10.0 t_1) (/ k t_0))))))))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-254) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (k ** m) * a
t_1 = 1.0d0 / t_0
if (k <= 1d-254) then
tmp = t_0
else
tmp = 1.0d0 / (t_1 + (k * ((10.0d0 * t_1) + (k / t_0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-254) {
tmp = t_0;
} else {
tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0))));
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a t_1 = 1.0 / t_0 tmp = 0 if k <= 1e-254: tmp = t_0 else: tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))) return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 1e-254) tmp = t_0; else tmp = Float64(1.0 / Float64(t_1 + Float64(k * Float64(Float64(10.0 * t_1) + Float64(k / t_0))))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 1e-254) tmp = t_0; else tmp = 1.0 / (t_1 + (k * ((10.0 * t_1) + (k / t_0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 1e-254], t$95$0, N[(1.0 / N[(t$95$1 + N[(k * N[(N[(10.0 * t$95$1), $MachinePrecision] + N[(k / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 10^{-254}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{t\_1 + k \cdot \left(10 \cdot t\_1 + \frac{k}{t\_0}\right)}\\
\end{array}
\end{array}
if k < 9.9999999999999991e-255Initial program 88.6%
associate-/l*88.6%
remove-double-neg88.6%
distribute-frac-neg288.6%
distribute-neg-frac288.6%
remove-double-neg88.6%
sqr-neg88.6%
associate-+l+88.6%
sqr-neg88.6%
distribute-rgt-out88.6%
Simplified88.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 9.9999999999999991e-255 < k Initial program 92.1%
associate-/l*92.1%
remove-double-neg92.1%
distribute-frac-neg292.1%
distribute-neg-frac292.1%
remove-double-neg92.1%
sqr-neg92.1%
associate-+l+92.1%
sqr-neg92.1%
distribute-rgt-out92.1%
Simplified92.1%
distribute-lft-in92.1%
associate-+l+92.1%
associate-*r/92.1%
clear-num92.1%
associate-+l+92.1%
distribute-lft-in92.1%
+-commutative92.1%
fma-define92.1%
+-commutative92.1%
*-commutative92.1%
Applied egg-rr92.1%
Taylor expanded in k around 0 99.9%
Final simplification99.9%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+177)
(* (/ (pow k m) (hypot 1.0 k)) (/ a (hypot 1.0 k)))
t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) {
tmp = (pow(k, m) / hypot(1.0, k)) * (a / hypot(1.0, k));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) {
tmp = (Math.pow(k, m) / Math.hypot(1.0, k)) * (a / Math.hypot(1.0, k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177: tmp = (math.pow(k, m) / math.hypot(1.0, k)) * (a / math.hypot(1.0, k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+177) tmp = Float64(Float64((k ^ m) / hypot(1.0, k)) * Float64(a / hypot(1.0, 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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) tmp = ((k ^ m) / hypot(1.0, k)) * (a / hypot(1.0, 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[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+177], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+177}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(1, k\right)} \cdot \frac{a}{\mathsf{hypot}\left(1, k\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2e177Initial program 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in k around 0 98.5%
*-commutative98.5%
add-sqr-sqrt98.5%
times-frac98.0%
hypot-1-def98.0%
hypot-1-def99.4%
Applied egg-rr99.4%
if 2e177 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 65.6%
associate-/l*65.6%
remove-double-neg65.6%
distribute-frac-neg265.6%
distribute-neg-frac265.6%
remove-double-neg65.6%
sqr-neg65.6%
associate-+l+65.6%
sqr-neg65.6%
distribute-rgt-out65.6%
Simplified65.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+177)
(* a (/ (pow k m) (+ 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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = (k ** m) * a
if ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 2d+177) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+177) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+177) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+177], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+177}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2e177Initial program 98.5%
associate-/l*98.5%
remove-double-neg98.5%
distribute-frac-neg298.5%
distribute-neg-frac298.5%
remove-double-neg98.5%
sqr-neg98.5%
associate-+l+98.5%
sqr-neg98.5%
distribute-rgt-out98.5%
Simplified98.5%
if 2e177 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 65.6%
associate-/l*65.6%
remove-double-neg65.6%
distribute-frac-neg265.6%
distribute-neg-frac265.6%
remove-double-neg65.6%
sqr-neg65.6%
associate-+l+65.6%
sqr-neg65.6%
distribute-rgt-out65.6%
Simplified65.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a))) (if (<= m 3.5) (/ t_0 (+ 1.0 (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double tmp;
if (m <= 3.5) {
tmp = t_0 / (1.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 <= 3.5d0) then
tmp = t_0 / (1.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 <= 3.5) {
tmp = t_0 / (1.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 <= 3.5: tmp = t_0 / (1.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 <= 3.5) tmp = Float64(t_0 / Float64(1.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 <= 3.5) tmp = t_0 / (1.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, 3.5], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq 3.5:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 3.5Initial program 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in k around 0 98.2%
if 3.5 < m Initial program 77.4%
associate-/l*77.4%
remove-double-neg77.4%
distribute-frac-neg277.4%
distribute-neg-frac277.4%
remove-double-neg77.4%
sqr-neg77.4%
associate-+l+77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
Simplified77.4%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.25) (not (<= m 0.0058))) (* (pow k m) a) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.25) || !(m <= 0.0058)) {
tmp = pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (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 <= (-1.25d0)) .or. (.not. (m <= 0.0058d0))) then
tmp = (k ** m) * a
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1.25) || !(m <= 0.0058)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1.25) or not (m <= 0.0058): tmp = math.pow(k, m) * a else: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1.25) || !(m <= 0.0058)) tmp = Float64((k ^ m) * a); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1.25) || ~((m <= 0.0058))) tmp = (k ^ m) * a; else tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1.25], N[Not[LessEqual[m, 0.0058]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.25 \lor \neg \left(m \leq 0.0058\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\end{array}
\end{array}
if m < -1.25 or 0.0058 < m Initial program 87.3%
associate-/l*87.3%
remove-double-neg87.3%
distribute-frac-neg287.3%
distribute-neg-frac287.3%
remove-double-neg87.3%
sqr-neg87.3%
associate-+l+87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
Simplified87.3%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -1.25 < m < 0.0058Initial 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%
distribute-lft-in96.8%
associate-+l+96.8%
associate-*r/96.8%
clear-num96.8%
associate-+l+96.8%
distribute-lft-in96.8%
+-commutative96.8%
fma-define96.8%
+-commutative96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in m around 0 95.6%
Taylor expanded in k around 0 98.5%
Final simplification99.5%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (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 <= 2.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (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 <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + 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 <= 2.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 98.2%
associate-/l*98.2%
remove-double-neg98.2%
distribute-frac-neg298.2%
distribute-neg-frac298.2%
remove-double-neg98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
Taylor expanded in m around 0 72.2%
if 2 < m Initial program 77.4%
associate-/l*77.4%
remove-double-neg77.4%
distribute-frac-neg277.4%
distribute-neg-frac277.4%
remove-double-neg77.4%
sqr-neg77.4%
associate-+l+77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
Simplified77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 29.7%
Final simplification56.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 100.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.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 <= 2.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 100.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 100.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 100.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 98.2%
associate-/l*98.2%
remove-double-neg98.2%
distribute-frac-neg298.2%
distribute-neg-frac298.2%
remove-double-neg98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
Taylor expanded in m around 0 72.2%
if 2 < m Initial program 77.4%
associate-/l*77.4%
remove-double-neg77.4%
distribute-frac-neg277.4%
distribute-neg-frac277.4%
remove-double-neg77.4%
sqr-neg77.4%
associate-+l+77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
Simplified77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 22.7%
Taylor expanded in a around 0 29.7%
Final simplification56.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.95) (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)) (+ a (* a (* k (- (* k 100.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.95d0) then
tmp = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a + (a * (k * ((k * 100.0d0) - 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a + (a * (k * ((k * 100.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95: tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a + (a * (k * ((k * 100.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95) tmp = Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); else tmp = a + (a * (k * ((k * 100.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95], N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95:\\
\;\;\;\;\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - 10\right)\right)\\
\end{array}
\end{array}
if m < 1.94999999999999996Initial program 98.2%
associate-/l*98.2%
remove-double-neg98.2%
distribute-frac-neg298.2%
distribute-neg-frac298.2%
remove-double-neg98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
distribute-lft-in98.2%
associate-+l+98.2%
associate-*r/98.2%
clear-num98.2%
associate-+l+98.2%
distribute-lft-in98.2%
+-commutative98.2%
fma-define98.2%
+-commutative98.2%
*-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in m around 0 72.6%
if 1.94999999999999996 < m Initial program 77.4%
associate-/l*77.4%
remove-double-neg77.4%
distribute-frac-neg277.4%
distribute-neg-frac277.4%
remove-double-neg77.4%
sqr-neg77.4%
associate-+l+77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
Simplified77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 22.7%
Taylor expanded in a around 0 29.7%
Final simplification57.0%
(FPCore (a k m) :precision binary64 (if (<= m -1.05e-18) (* 0.1 (/ a k)) (if (<= m 8.2e+17) a (* (* k a) -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 * (a / k);
} else if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.05d-18)) then
tmp = 0.1d0 * (a / k)
else if (m <= 8.2d+17) then
tmp = a
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 * (a / k);
} else if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.05e-18: tmp = 0.1 * (a / k) elif m <= 8.2e+17: tmp = a else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.05e-18) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 8.2e+17) tmp = a; else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.05e-18) tmp = 0.1 * (a / k); elseif (m <= 8.2e+17) tmp = a; else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.05e-18], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 8.2e+17], a, N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.05 \cdot 10^{-18}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 8.2 \cdot 10^{+17}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < -1.05e-18Initial program 98.8%
associate-/l*98.8%
remove-double-neg98.8%
distribute-frac-neg298.8%
distribute-neg-frac298.8%
remove-double-neg98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out98.8%
Simplified98.8%
Taylor expanded in m around 0 43.9%
Taylor expanded in k around 0 22.7%
*-commutative22.7%
Simplified22.7%
Taylor expanded in k around inf 25.0%
if -1.05e-18 < m < 8.2e17Initial program 94.7%
associate-/l*94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
distribute-neg-frac294.7%
remove-double-neg94.7%
sqr-neg94.7%
associate-+l+94.7%
sqr-neg94.7%
distribute-rgt-out94.7%
Simplified94.7%
Taylor expanded in k around 0 61.0%
*-commutative61.0%
Simplified61.0%
Taylor expanded in m around 0 53.6%
if 8.2e17 < m Initial program 79.1%
associate-/l*79.1%
remove-double-neg79.1%
distribute-frac-neg279.1%
distribute-neg-frac279.1%
remove-double-neg79.1%
sqr-neg79.1%
associate-+l+79.1%
sqr-neg79.1%
distribute-rgt-out79.1%
Simplified79.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 8.0%
*-commutative8.0%
Simplified8.0%
Taylor expanded in k around inf 22.0%
Final simplification34.4%
(FPCore (a k m) :precision binary64 (if (<= m -1.05e-18) (/ 0.1 (/ k a)) (if (<= m 8.2e+17) a (* (* k a) -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 / (k / a);
} else if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.05d-18)) then
tmp = 0.1d0 / (k / a)
else if (m <= 8.2d+17) then
tmp = a
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.05e-18) {
tmp = 0.1 / (k / a);
} else if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.05e-18: tmp = 0.1 / (k / a) elif m <= 8.2e+17: tmp = a else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.05e-18) tmp = Float64(0.1 / Float64(k / a)); elseif (m <= 8.2e+17) tmp = a; else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.05e-18) tmp = 0.1 / (k / a); elseif (m <= 8.2e+17) tmp = a; else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.05e-18], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 8.2e+17], a, N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.05 \cdot 10^{-18}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{elif}\;m \leq 8.2 \cdot 10^{+17}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < -1.05e-18Initial program 98.8%
associate-/l*98.8%
remove-double-neg98.8%
distribute-frac-neg298.8%
distribute-neg-frac298.8%
remove-double-neg98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out98.8%
Simplified98.8%
Taylor expanded in m around 0 43.9%
Taylor expanded in k around 0 22.7%
*-commutative22.7%
Simplified22.7%
Taylor expanded in k around inf 25.0%
clear-num26.2%
un-div-inv26.2%
Applied egg-rr26.2%
if -1.05e-18 < m < 8.2e17Initial program 94.7%
associate-/l*94.7%
remove-double-neg94.7%
distribute-frac-neg294.7%
distribute-neg-frac294.7%
remove-double-neg94.7%
sqr-neg94.7%
associate-+l+94.7%
sqr-neg94.7%
distribute-rgt-out94.7%
Simplified94.7%
Taylor expanded in k around 0 61.0%
*-commutative61.0%
Simplified61.0%
Taylor expanded in m around 0 53.6%
if 8.2e17 < m Initial program 79.1%
associate-/l*79.1%
remove-double-neg79.1%
distribute-frac-neg279.1%
distribute-neg-frac279.1%
remove-double-neg79.1%
sqr-neg79.1%
associate-+l+79.1%
sqr-neg79.1%
distribute-rgt-out79.1%
Simplified79.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 8.0%
*-commutative8.0%
Simplified8.0%
Taylor expanded in k around inf 22.0%
Final simplification34.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.2) (/ a (+ 1.0 (* k k))) (+ a (* k (* 100.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (100.0 * (k * a)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.2d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (100.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.2) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (100.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.2: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (100.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(100.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.2) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (100.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(100.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(100 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in m around 0 72.2%
Taylor expanded in k around 0 72.2%
if 2.2000000000000002 < m Initial program 77.4%
associate-/l*77.4%
remove-double-neg77.4%
distribute-frac-neg277.4%
distribute-neg-frac277.4%
remove-double-neg77.4%
sqr-neg77.4%
associate-+l+77.4%
sqr-neg77.4%
distribute-rgt-out77.4%
Simplified77.4%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 22.7%
Taylor expanded in k around inf 22.7%
Final simplification54.2%
(FPCore (a k m) :precision binary64 (if (<= m 25000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 100.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 25000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (100.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 <= 25000.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (100.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 25000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (100.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 25000.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (100.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 25000.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(100.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 25000.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (100.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 25000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(100.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 25000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(100 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 25000Initial program 98.2%
associate-/l*98.2%
remove-double-neg98.2%
distribute-frac-neg298.2%
distribute-neg-frac298.2%
remove-double-neg98.2%
sqr-neg98.2%
associate-+l+98.2%
sqr-neg98.2%
distribute-rgt-out98.2%
Simplified98.2%
Taylor expanded in m around 0 71.8%
if 25000 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around 0 22.9%
Taylor expanded in k around inf 22.9%
Final simplification54.2%
(FPCore (a k m) :precision binary64 (if (<= m 1.85e+15) (/ a (+ 1.0 (* k 10.0))) (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.85e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.85d+15) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.85e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.85e+15: tmp = a / (1.0 + (k * 10.0)) else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.85e+15) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.85e+15) tmp = a / (1.0 + (k * 10.0)); else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.85e+15], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.85 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 1.85e15Initial program 97.1%
associate-/l*97.1%
remove-double-neg97.1%
distribute-frac-neg297.1%
distribute-neg-frac297.1%
remove-double-neg97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 70.5%
Taylor expanded in k around 0 45.6%
*-commutative45.6%
Simplified45.6%
if 1.85e15 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.8%
*-commutative7.8%
Simplified7.8%
Taylor expanded in k around inf 21.3%
Final simplification37.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.8e+15) (/ a (+ 1.0 (* k k))) (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.8e+15) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * -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.8d+15) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.8e+15) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.8e+15: tmp = a / (1.0 + (k * k)) else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.8e+15) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.8e+15) tmp = a / (1.0 + (k * k)); else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.8e+15], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.8 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 2.8e15Initial program 97.1%
*-commutative97.1%
Simplified97.1%
Taylor expanded in m around 0 70.5%
Taylor expanded in k around 0 70.5%
if 2.8e15 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 7.8%
*-commutative7.8%
Simplified7.8%
Taylor expanded in k around inf 21.3%
Final simplification53.4%
(FPCore (a k m) :precision binary64 (if (<= m 8.2e+17) a (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -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 <= 8.2d+17) then
tmp = a
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 8.2e+17) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 8.2e+17: tmp = a else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 8.2e+17) tmp = a; else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 8.2e+17) tmp = a; else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 8.2e+17], a, N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.2 \cdot 10^{+17}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 8.2e17Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
Taylor expanded in k around 0 75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in m around 0 31.1%
if 8.2e17 < m Initial program 79.1%
associate-/l*79.1%
remove-double-neg79.1%
distribute-frac-neg279.1%
distribute-neg-frac279.1%
remove-double-neg79.1%
sqr-neg79.1%
associate-+l+79.1%
sqr-neg79.1%
distribute-rgt-out79.1%
Simplified79.1%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 8.0%
*-commutative8.0%
Simplified8.0%
Taylor expanded in k around inf 22.0%
Final simplification28.0%
(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.7%
associate-/l*90.7%
remove-double-neg90.7%
distribute-frac-neg290.7%
distribute-neg-frac290.7%
remove-double-neg90.7%
sqr-neg90.7%
associate-+l+90.7%
sqr-neg90.7%
distribute-rgt-out90.7%
Simplified90.7%
Taylor expanded in k around 0 84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in m around 0 21.9%
Final simplification21.9%
herbie shell --seed 2024095
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))