
(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 12 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 2e-48) 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 <= 2e-48) {
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 <= 2d-48) 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 <= 2e-48) {
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 <= 2e-48: 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 <= 2e-48) 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 <= 2e-48) 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, 2e-48], 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 2 \cdot 10^{-48}:\\
\;\;\;\;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 < 1.9999999999999999e-48Initial program 94.2%
associate-/l*94.2%
remove-double-neg94.2%
distribute-frac-neg294.2%
distribute-neg-frac294.2%
remove-double-neg94.2%
sqr-neg94.2%
associate-+l+94.2%
sqr-neg94.2%
distribute-rgt-out94.2%
Simplified94.2%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 1.9999999999999999e-48 < k Initial program 82.7%
associate-/l*82.7%
remove-double-neg82.7%
distribute-frac-neg282.7%
distribute-neg-frac282.7%
remove-double-neg82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
distribute-lft-in82.7%
associate-+l+82.7%
associate-*r/82.7%
clear-num82.5%
associate-+l+82.5%
distribute-lft-in82.5%
+-commutative82.5%
fma-define82.5%
+-commutative82.5%
*-commutative82.5%
Applied egg-rr82.5%
Taylor expanded in k around 0 99.0%
Final simplification99.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (pow k m) a)))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 1e+246)
(* 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 / ((k * k) + (1.0 + (k * 10.0)))) <= 1e+246) {
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 / ((k * k) + (1.0d0 + (k * 10.0d0)))) <= 1d+246) 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 / ((k * k) + (1.0 + (k * 10.0)))) <= 1e+246) {
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 / ((k * k) + (1.0 + (k * 10.0)))) <= 1e+246: 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(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 1e+246) 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 / ((k * k) + (1.0 + (k * 10.0)))) <= 1e+246) 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[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+246], 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}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 10^{+246}:\\
\;\;\;\;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))) < 1.00000000000000007e246Initial program 96.9%
associate-/l*96.9%
remove-double-neg96.9%
distribute-frac-neg296.9%
distribute-neg-frac296.9%
remove-double-neg96.9%
sqr-neg96.9%
associate-+l+96.9%
sqr-neg96.9%
distribute-rgt-out96.9%
Simplified96.9%
if 1.00000000000000007e246 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 64.3%
associate-/l*64.3%
remove-double-neg64.3%
distribute-frac-neg264.3%
distribute-neg-frac264.3%
remove-double-neg64.3%
sqr-neg64.3%
associate-+l+64.3%
sqr-neg64.3%
distribute-rgt-out64.3%
Simplified64.3%
Taylor expanded in k around 0 98.2%
*-commutative98.2%
Simplified98.2%
Final simplification97.2%
(FPCore (a k m)
:precision binary64
(if (<= m -2.2e-8)
(* a (/ (pow k m) (+ 1.0 (* k 10.0))))
(if (<= m 0.0045)
(/ 1.0 (+ (/ 1.0 a) (* k (/ (+ k 10.0) a))))
(* (pow k m) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.2e-8) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.0045) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} else {
tmp = pow(k, m) * 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.2d-8)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 0.0045d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((k + 10.0d0) / a)))
else
tmp = (k ** m) * a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -2.2e-8) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 0.0045) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} else {
tmp = Math.pow(k, m) * a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.2e-8: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 0.0045: tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))) else: tmp = math.pow(k, m) * a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.2e-8) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 0.0045) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(k + 10.0) / a)))); else tmp = Float64((k ^ m) * a); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -2.2e-8) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 0.0045) tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))); else tmp = (k ^ m) * a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.2e-8], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.0045], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.2 \cdot 10^{-8}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 0.0045:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k + 10}{a}}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot a\\
\end{array}
\end{array}
if m < -2.1999999999999998e-8Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative27.0%
Simplified100.0%
if -2.1999999999999998e-8 < m < 0.00449999999999999966Initial program 92.4%
associate-/l*92.4%
remove-double-neg92.4%
distribute-frac-neg292.4%
distribute-neg-frac292.4%
remove-double-neg92.4%
sqr-neg92.4%
associate-+l+92.4%
sqr-neg92.4%
distribute-rgt-out92.4%
Simplified92.4%
distribute-lft-in92.4%
associate-+l+92.4%
associate-*r/92.4%
clear-num92.0%
associate-+l+92.0%
distribute-lft-in92.0%
+-commutative92.0%
fma-define92.0%
+-commutative92.0%
*-commutative92.0%
Applied egg-rr92.0%
Taylor expanded in k around 0 98.6%
inv-pow98.6%
add-sqr-sqrt53.5%
unpow-prod-down53.4%
Applied egg-rr53.4%
pow-sqr53.5%
fma-undefine53.5%
distribute-rgt-in53.5%
associate-*l/53.5%
associate-*r/53.5%
associate-/r*53.5%
*-commutative53.5%
distribute-rgt-out53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in m around 0 89.4%
associate-/l*96.1%
+-commutative96.1%
Simplified96.1%
if 0.00449999999999999966 < m Initial program 77.5%
associate-/l*77.5%
remove-double-neg77.5%
distribute-frac-neg277.5%
distribute-neg-frac277.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.00033) (not (<= m 0.0038))) (* (pow k m) a) (/ 1.0 (+ (/ 1.0 a) (* k (/ (+ k 10.0) a))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00033) || !(m <= 0.0038)) {
tmp = pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / 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.00033d0)) .or. (.not. (m <= 0.0038d0))) then
tmp = (k ** m) * a
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((k + 10.0d0) / a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00033) || !(m <= 0.0038)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.00033) or not (m <= 0.0038): tmp = math.pow(k, m) * a else: tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.00033) || !(m <= 0.0038)) tmp = Float64((k ^ m) * a); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(k + 10.0) / a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -0.00033) || ~((m <= 0.0038))) tmp = (k ^ m) * a; else tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.00033], N[Not[LessEqual[m, 0.0038]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00033 \lor \neg \left(m \leq 0.0038\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k + 10}{a}}\\
\end{array}
\end{array}
if m < -3.3e-4 or 0.00379999999999999999 < m Initial program 88.4%
associate-/l*88.4%
remove-double-neg88.4%
distribute-frac-neg288.4%
distribute-neg-frac288.4%
remove-double-neg88.4%
sqr-neg88.4%
associate-+l+88.4%
sqr-neg88.4%
distribute-rgt-out88.4%
Simplified88.4%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if -3.3e-4 < m < 0.00379999999999999999Initial program 92.4%
associate-/l*92.4%
remove-double-neg92.4%
distribute-frac-neg292.4%
distribute-neg-frac292.4%
remove-double-neg92.4%
sqr-neg92.4%
associate-+l+92.4%
sqr-neg92.4%
distribute-rgt-out92.4%
Simplified92.4%
distribute-lft-in92.4%
associate-+l+92.4%
associate-*r/92.4%
clear-num92.0%
associate-+l+92.0%
distribute-lft-in92.0%
+-commutative92.0%
fma-define92.0%
+-commutative92.0%
*-commutative92.0%
Applied egg-rr92.0%
Taylor expanded in k around 0 98.6%
inv-pow98.6%
add-sqr-sqrt53.5%
unpow-prod-down53.4%
Applied egg-rr53.4%
pow-sqr53.5%
fma-undefine53.5%
distribute-rgt-in53.5%
associate-*l/53.5%
associate-*r/53.5%
associate-/r*53.5%
*-commutative53.5%
distribute-rgt-out53.5%
metadata-eval53.5%
Simplified53.5%
Taylor expanded in m around 0 89.4%
associate-/l*96.1%
+-commutative96.1%
Simplified96.1%
Final simplification98.3%
(FPCore (a k m) :precision binary64 (if (<= m 2.4) (/ 1.0 (+ (/ 1.0 a) (* k (/ (+ k 10.0) a)))) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.4) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} 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.4d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((k + 10.0d0) / a)))
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.4) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.4: tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.4) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(k + 10.0) / a)))); 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.4) tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.4], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(k + 10.0), $MachinePrecision] / a), $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.4:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k + 10}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 96.2%
associate-/l*96.2%
remove-double-neg96.2%
distribute-frac-neg296.2%
distribute-neg-frac296.2%
remove-double-neg96.2%
sqr-neg96.2%
associate-+l+96.2%
sqr-neg96.2%
distribute-rgt-out96.2%
Simplified96.2%
distribute-lft-in96.2%
associate-+l+96.2%
associate-*r/96.2%
clear-num96.0%
associate-+l+96.0%
distribute-lft-in96.0%
+-commutative96.0%
fma-define96.0%
+-commutative96.0%
*-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in k around 0 80.2%
inv-pow80.2%
add-sqr-sqrt45.7%
unpow-prod-down45.7%
Applied egg-rr45.7%
pow-sqr45.7%
fma-undefine45.7%
distribute-rgt-in45.7%
associate-*l/45.7%
associate-*r/45.7%
associate-/r*45.7%
*-commutative45.7%
distribute-rgt-out55.9%
metadata-eval55.9%
Simplified55.9%
Taylor expanded in m around 0 68.9%
associate-/l*70.0%
+-commutative70.0%
Simplified70.0%
if 2.39999999999999991 < m Initial program 77.5%
associate-/l*77.5%
remove-double-neg77.5%
distribute-frac-neg277.5%
distribute-neg-frac277.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.0%
Final simplification56.8%
(FPCore (a k m) :precision binary64 (if (<= m 2.1) (/ 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.1) {
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.1d0) 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.1) {
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.1: 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.1) 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.1) 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.1], 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.1:\\
\;\;\;\;\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 < 2.10000000000000009Initial program 96.2%
associate-/l*96.2%
remove-double-neg96.2%
distribute-frac-neg296.2%
distribute-neg-frac296.2%
remove-double-neg96.2%
sqr-neg96.2%
associate-+l+96.2%
sqr-neg96.2%
distribute-rgt-out96.2%
Simplified96.2%
Taylor expanded in m around 0 69.0%
if 2.10000000000000009 < m Initial program 77.5%
associate-/l*77.5%
remove-double-neg77.5%
distribute-frac-neg277.5%
distribute-neg-frac277.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.0%
Final simplification56.1%
(FPCore (a k m) :precision binary64 (if (<= m 7e+16) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7e+16) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 7d+16) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7e+16) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7e+16: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7e+16) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7e+16) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7e+16], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7 \cdot 10^{+16}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 7e16Initial program 96.3%
associate-/l*96.3%
remove-double-neg96.3%
distribute-frac-neg296.3%
distribute-neg-frac296.3%
remove-double-neg96.3%
sqr-neg96.3%
associate-+l+96.3%
sqr-neg96.3%
distribute-rgt-out96.3%
Simplified96.3%
Taylor expanded in m around 0 68.2%
Taylor expanded in k around 0 41.2%
*-commutative41.2%
Simplified41.2%
if 7e16 < m Initial program 77.0%
associate-/l*77.0%
remove-double-neg77.0%
distribute-frac-neg277.0%
distribute-neg-frac277.0%
remove-double-neg77.0%
sqr-neg77.0%
associate-+l+77.0%
sqr-neg77.0%
distribute-rgt-out77.0%
Simplified77.0%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.6%
Taylor expanded in k around inf 32.6%
*-commutative32.6%
Simplified32.6%
Final simplification38.3%
(FPCore (a k m) :precision binary64 (if (<= m 2.4) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.4) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.4d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.4) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.4: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.4) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.4) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.4], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.4:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2.39999999999999991Initial program 96.2%
associate-/l*96.2%
remove-double-neg96.2%
distribute-frac-neg296.2%
distribute-neg-frac296.2%
remove-double-neg96.2%
sqr-neg96.2%
associate-+l+96.2%
sqr-neg96.2%
distribute-rgt-out96.2%
Simplified96.2%
Taylor expanded in m around 0 69.0%
if 2.39999999999999991 < m Initial program 77.5%
associate-/l*77.5%
remove-double-neg77.5%
distribute-frac-neg277.5%
distribute-neg-frac277.5%
remove-double-neg77.5%
sqr-neg77.5%
associate-+l+77.5%
sqr-neg77.5%
distribute-rgt-out77.5%
Simplified77.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 32.0%
Taylor expanded in k around inf 32.0%
*-commutative32.0%
Simplified32.0%
Final simplification56.1%
(FPCore (a k m) :precision binary64 (if (<= m 5.6e+36) (/ a (+ 1.0 (* k 10.0))) (* a (* k -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.6e+36) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = 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+36) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = 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+36) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (k * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.6e+36: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (k * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.6e+36) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a * Float64(k * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.6e+36) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (k * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.6e+36], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(k * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.6 \cdot 10^{+36}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot -10\right)\\
\end{array}
\end{array}
if m < 5.6000000000000001e36Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in m around 0 66.7%
Taylor expanded in k around 0 40.3%
*-commutative40.3%
Simplified40.3%
if 5.6000000000000001e36 < m Initial program 77.1%
associate-/l*77.1%
remove-double-neg77.1%
distribute-frac-neg277.1%
distribute-neg-frac277.1%
remove-double-neg77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.0%
*-commutative10.0%
Simplified10.0%
Taylor expanded in k around inf 21.6%
*-commutative21.6%
associate-*r*21.6%
Simplified21.6%
Final simplification34.2%
(FPCore (a k m) :precision binary64 (if (<= m 5.6e+36) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.6e+36) {
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 <= 5.6d+36) 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 <= 5.6e+36) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.6e+36: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.6e+36) 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 <= 5.6e+36) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.6e+36], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.6 \cdot 10^{+36}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 5.6000000000000001e36Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in k around 0 74.1%
*-commutative74.1%
Simplified74.1%
Taylor expanded in m around 0 24.7%
if 5.6000000000000001e36 < m Initial program 77.1%
associate-/l*77.1%
remove-double-neg77.1%
distribute-frac-neg277.1%
distribute-neg-frac277.1%
remove-double-neg77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.0%
*-commutative10.0%
Simplified10.0%
Taylor expanded in k around inf 21.6%
Final simplification23.7%
(FPCore (a k m) :precision binary64 (if (<= m 5.6e+36) a (* a (* k -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.6e+36) {
tmp = a;
} else {
tmp = 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+36) then
tmp = a
else
tmp = 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+36) {
tmp = a;
} else {
tmp = a * (k * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.6e+36: tmp = a else: tmp = a * (k * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.6e+36) tmp = a; else tmp = Float64(a * Float64(k * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.6e+36) tmp = a; else tmp = a * (k * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.6e+36], a, N[(a * N[(k * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.6 \cdot 10^{+36}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot -10\right)\\
\end{array}
\end{array}
if m < 5.6000000000000001e36Initial program 95.8%
associate-/l*95.8%
remove-double-neg95.8%
distribute-frac-neg295.8%
distribute-neg-frac295.8%
remove-double-neg95.8%
sqr-neg95.8%
associate-+l+95.8%
sqr-neg95.8%
distribute-rgt-out95.8%
Simplified95.8%
Taylor expanded in k around 0 74.1%
*-commutative74.1%
Simplified74.1%
Taylor expanded in m around 0 24.7%
if 5.6000000000000001e36 < m Initial program 77.1%
associate-/l*77.1%
remove-double-neg77.1%
distribute-frac-neg277.1%
distribute-neg-frac277.1%
remove-double-neg77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 10.0%
*-commutative10.0%
Simplified10.0%
Taylor expanded in k around inf 21.6%
*-commutative21.6%
associate-*r*21.6%
Simplified21.6%
Final simplification23.7%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 89.7%
associate-/l*89.7%
remove-double-neg89.7%
distribute-frac-neg289.7%
distribute-neg-frac289.7%
remove-double-neg89.7%
sqr-neg89.7%
associate-+l+89.7%
sqr-neg89.7%
distribute-rgt-out89.7%
Simplified89.7%
Taylor expanded in k around 0 82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 17.9%
Final simplification17.9%
herbie shell --seed 2024131
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))