
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m)
:precision binary64
(if (<= m -1.7e-8)
(* a (/ (pow k m) (+ 1.0 (* k 10.0))))
(if (<= m 2.1e-6)
(/ 1.0 (+ (/ 1.0 a) (* k (/ (+ k 10.0) a))))
(* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-8) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 2.1e-6) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.7d-8)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 2.1d-6) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((k + 10.0d0) / a)))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e-8) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 2.1e-6) {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.7e-8: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 2.1e-6: tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.7e-8) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 2.1e-6) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(k + 10.0) / a)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.7e-8) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 2.1e-6) tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.7e-8], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.1e-6], 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[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{-8}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 2.1 \cdot 10^{-6}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k + 10}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.7e-8Initial 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 k around 0 98.8%
*-commutative98.8%
Simplified98.8%
if -1.7e-8 < m < 2.0999999999999998e-6Initial program 78.1%
associate-/l*78.1%
remove-double-neg78.1%
distribute-frac-neg278.1%
distribute-neg-frac278.1%
remove-double-neg78.1%
sqr-neg78.1%
associate-+l+78.1%
sqr-neg78.1%
distribute-rgt-out78.1%
Simplified78.1%
distribute-lft-in78.1%
associate-+l+78.1%
associate-*r/78.1%
clear-num78.1%
associate-+l+78.1%
distribute-lft-in78.1%
+-commutative78.1%
fma-define78.1%
+-commutative78.1%
*-commutative78.1%
Applied egg-rr78.1%
Taylor expanded in k around 0 82.5%
inv-pow82.5%
add-sqr-sqrt44.8%
unpow-prod-down44.8%
Applied egg-rr44.8%
pow-sqr44.9%
Simplified44.9%
Taylor expanded in m around 0 95.3%
associate-/l*99.7%
+-commutative99.7%
Simplified99.7%
if 2.0999999999999998e-6 < m Initial program 78.6%
associate-/l*78.6%
remove-double-neg78.6%
distribute-frac-neg278.6%
distribute-neg-frac278.6%
remove-double-neg78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in k around 0 98.6%
*-commutative98.6%
Simplified98.6%
Final simplification99.1%
(FPCore (a k m) :precision binary64 (if (or (<= m -9.8e-5) (not (<= m 1.15))) (* a (pow k m)) (/ 1.0 (+ (/ 1.0 a) (* k (/ (+ k 10.0) a))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -9.8e-5) || !(m <= 1.15)) {
tmp = a * pow(k, m);
} 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 <= (-9.8d-5)) .or. (.not. (m <= 1.15d0))) then
tmp = a * (k ** m)
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 <= -9.8e-5) || !(m <= 1.15)) {
tmp = a * Math.pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -9.8e-5) or not (m <= 1.15): tmp = a * math.pow(k, m) else: tmp = 1.0 / ((1.0 / a) + (k * ((k + 10.0) / a))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -9.8e-5) || !(m <= 1.15)) tmp = Float64(a * (k ^ m)); 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 <= -9.8e-5) || ~((m <= 1.15))) tmp = a * (k ^ m); 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, -9.8e-5], N[Not[LessEqual[m, 1.15]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $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 -9.8 \cdot 10^{-5} \lor \neg \left(m \leq 1.15\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k + 10}{a}}\\
\end{array}
\end{array}
if m < -9.8e-5 or 1.1499999999999999 < m Initial program 89.3%
associate-/l*89.3%
remove-double-neg89.3%
distribute-frac-neg289.3%
distribute-neg-frac289.3%
remove-double-neg89.3%
sqr-neg89.3%
associate-+l+89.3%
sqr-neg89.3%
distribute-rgt-out89.3%
Simplified89.3%
Taylor expanded in k around 0 98.7%
*-commutative98.7%
Simplified98.7%
if -9.8e-5 < m < 1.1499999999999999Initial program 78.5%
associate-/l*78.5%
remove-double-neg78.5%
distribute-frac-neg278.5%
distribute-neg-frac278.5%
remove-double-neg78.5%
sqr-neg78.5%
associate-+l+78.5%
sqr-neg78.5%
distribute-rgt-out78.5%
Simplified78.5%
distribute-lft-in78.5%
associate-+l+78.5%
associate-*r/78.5%
clear-num78.5%
associate-+l+78.5%
distribute-lft-in78.5%
+-commutative78.5%
fma-define78.5%
+-commutative78.5%
*-commutative78.5%
Applied egg-rr78.5%
Taylor expanded in k around 0 82.8%
inv-pow82.8%
add-sqr-sqrt44.0%
unpow-prod-down43.9%
Applied egg-rr43.9%
pow-sqr44.0%
Simplified44.0%
Taylor expanded in m around 0 94.8%
associate-/l*99.2%
+-commutative99.2%
Simplified99.2%
Final simplification98.9%
(FPCore (a k m)
:precision binary64
(if (<= m -26.0)
(/ a (* k (+ k 10.0)))
(if (<= m 1.85)
(/ 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 <= -26.0) {
tmp = a / (k * (k + 10.0));
} else if (m <= 1.85) {
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 <= (-26.0d0)) then
tmp = a / (k * (k + 10.0d0))
else if (m <= 1.85d0) 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 <= -26.0) {
tmp = a / (k * (k + 10.0));
} else if (m <= 1.85) {
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 <= -26.0: tmp = a / (k * (k + 10.0)) elif m <= 1.85: 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 <= -26.0) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (m <= 1.85) 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 <= -26.0) tmp = a / (k * (k + 10.0)); elseif (m <= 1.85) 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, -26.0], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.85], 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 -26:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 1.85:\\
\;\;\;\;\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 < -26Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 43.7%
Taylor expanded in k around inf 43.7%
Taylor expanded in k around inf 54.1%
Taylor expanded in a around 0 54.1%
+-commutative54.1%
unpow254.1%
distribute-rgt-in54.1%
Simplified54.1%
if -26 < m < 1.8500000000000001Initial program 78.9%
associate-/l*78.9%
remove-double-neg78.9%
distribute-frac-neg278.9%
distribute-neg-frac278.9%
remove-double-neg78.9%
sqr-neg78.9%
associate-+l+78.9%
sqr-neg78.9%
distribute-rgt-out78.9%
Simplified78.9%
distribute-lft-in78.9%
associate-+l+78.9%
associate-*r/78.9%
clear-num78.9%
associate-+l+78.9%
distribute-lft-in78.9%
+-commutative78.9%
fma-define78.9%
+-commutative78.9%
*-commutative78.9%
Applied egg-rr78.9%
Taylor expanded in k around 0 83.1%
inv-pow83.1%
add-sqr-sqrt43.1%
unpow-prod-down43.1%
Applied egg-rr43.1%
pow-sqr43.2%
Simplified43.2%
Taylor expanded in m around 0 93.2%
associate-/l*97.5%
+-commutative97.5%
Simplified97.5%
if 1.8500000000000001 < m Initial program 78.6%
associate-/l*78.6%
remove-double-neg78.6%
distribute-frac-neg278.6%
distribute-neg-frac278.6%
remove-double-neg78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 33.1%
Final simplification66.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -2.45e+76)
(/ a t_0)
(if (<= m 2.7)
(/ a (+ 1.0 t_0))
(* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -2.45e+76) {
tmp = a / t_0;
} else if (m <= 2.7) {
tmp = a / (1.0 + t_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) :: t_0
real(8) :: tmp
t_0 = k * (k + 10.0d0)
if (m <= (-2.45d+76)) then
tmp = a / t_0
else if (m <= 2.7d0) then
tmp = a / (1.0d0 + t_0)
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 t_0 = k * (k + 10.0);
double tmp;
if (m <= -2.45e+76) {
tmp = a / t_0;
} else if (m <= 2.7) {
tmp = a / (1.0 + t_0);
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -2.45e+76: tmp = a / t_0 elif m <= 2.7: tmp = a / (1.0 + t_0) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -2.45e+76) tmp = Float64(a / t_0); elseif (m <= 2.7) tmp = Float64(a / Float64(1.0 + t_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) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -2.45e+76) tmp = a / t_0; elseif (m <= 2.7) tmp = a / (1.0 + t_0); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -2.45e+76], N[(a / t$95$0), $MachinePrecision], If[LessEqual[m, 2.7], N[(a / N[(1.0 + t$95$0), $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}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -2.45 \cdot 10^{+76}:\\
\;\;\;\;\frac{a}{t\_0}\\
\mathbf{elif}\;m \leq 2.7:\\
\;\;\;\;\frac{a}{1 + t\_0}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < -2.45000000000000013e76Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 43.2%
Taylor expanded in k around inf 43.2%
Taylor expanded in k around inf 57.7%
Taylor expanded in a around 0 57.7%
+-commutative57.7%
unpow257.7%
distribute-rgt-in57.7%
Simplified57.7%
if -2.45000000000000013e76 < m < 2.7000000000000002Initial program 81.6%
associate-/l*81.6%
remove-double-neg81.6%
distribute-frac-neg281.6%
distribute-neg-frac281.6%
remove-double-neg81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 85.4%
if 2.7000000000000002 < m Initial program 78.6%
associate-/l*78.6%
remove-double-neg78.6%
distribute-frac-neg278.6%
distribute-neg-frac278.6%
remove-double-neg78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 33.1%
Final simplification65.0%
(FPCore (a k m)
:precision binary64
(if (<= m -26.0)
(/ a (* k (+ k 10.0)))
(if (<= m 2.0)
(/ 1.0 (+ (/ 1.0 a) (* k (/ k a))))
(* a (+ 1.0 (* k (- (* k 99.0) 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -26.0) {
tmp = a / (k * (k + 10.0));
} else if (m <= 2.0) {
tmp = 1.0 / ((1.0 / a) + (k * (k / 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 <= (-26.0d0)) then
tmp = a / (k * (k + 10.0d0))
else if (m <= 2.0d0) then
tmp = 1.0d0 / ((1.0d0 / a) + (k * (k / 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 <= -26.0) {
tmp = a / (k * (k + 10.0));
} else if (m <= 2.0) {
tmp = 1.0 / ((1.0 / a) + (k * (k / a)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -26.0: tmp = a / (k * (k + 10.0)) elif m <= 2.0: tmp = 1.0 / ((1.0 / a) + (k * (k / a))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -26.0) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (m <= 2.0) tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(k / 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 <= -26.0) tmp = a / (k * (k + 10.0)); elseif (m <= 2.0) tmp = 1.0 / ((1.0 / a) + (k * (k / a))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -26.0], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.0], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(k / 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 -26:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < -26Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 43.7%
Taylor expanded in k around inf 43.7%
Taylor expanded in k around inf 54.1%
Taylor expanded in a around 0 54.1%
+-commutative54.1%
unpow254.1%
distribute-rgt-in54.1%
Simplified54.1%
if -26 < m < 2Initial program 78.9%
associate-/l*78.9%
remove-double-neg78.9%
distribute-frac-neg278.9%
distribute-neg-frac278.9%
remove-double-neg78.9%
sqr-neg78.9%
associate-+l+78.9%
sqr-neg78.9%
distribute-rgt-out78.9%
Simplified78.9%
distribute-lft-in78.9%
associate-+l+78.9%
associate-*r/78.9%
clear-num78.9%
associate-+l+78.9%
distribute-lft-in78.9%
+-commutative78.9%
fma-define78.9%
+-commutative78.9%
*-commutative78.9%
Applied egg-rr78.9%
Taylor expanded in k around 0 83.1%
Taylor expanded in m around 0 97.5%
Taylor expanded in k around inf 95.4%
if 2 < m Initial program 78.6%
associate-/l*78.6%
remove-double-neg78.6%
distribute-frac-neg278.6%
distribute-neg-frac278.6%
remove-double-neg78.6%
sqr-neg78.6%
associate-+l+78.6%
sqr-neg78.6%
distribute-rgt-out78.6%
Simplified78.6%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 33.1%
Final simplification65.8%
(FPCore (a k m) :precision binary64 (if (<= k -2.1e+131) (/ a (* k (+ k 10.0))) (if (<= k 0.075) (+ a (* -10.0 (* a k))) (/ 1.0 (* k (/ (+ k 10.0) a))))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2.1e+131) {
tmp = a / (k * (k + 10.0));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 1.0 / (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 (k <= (-2.1d+131)) then
tmp = a / (k * (k + 10.0d0))
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = 1.0d0 / (k * ((k + 10.0d0) / a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2.1e+131) {
tmp = a / (k * (k + 10.0));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 1.0 / (k * ((k + 10.0) / a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2.1e+131: tmp = a / (k * (k + 10.0)) elif k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = 1.0 / (k * ((k + 10.0) / a)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2.1e+131) tmp = Float64(a / Float64(k * Float64(k + 10.0))); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(1.0 / Float64(k * Float64(Float64(k + 10.0) / a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2.1e+131) tmp = a / (k * (k + 10.0)); elseif (k <= 0.075) tmp = a + (-10.0 * (a * k)); else tmp = 1.0 / (k * ((k + 10.0) / a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2.1e+131], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(k * N[(N[(k + 10.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.1 \cdot 10^{+131}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{k \cdot \frac{k + 10}{a}}\\
\end{array}
\end{array}
if k < -2.09999999999999985e131Initial program 39.5%
*-commutative39.5%
Simplified39.5%
Taylor expanded in m around 0 84.6%
Taylor expanded in k around inf 84.6%
Taylor expanded in k around inf 84.6%
Taylor expanded in a around 0 84.6%
+-commutative84.6%
unpow284.6%
distribute-rgt-in84.6%
Simplified84.6%
if -2.09999999999999985e131 < k < 0.0749999999999999972Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
distribute-frac-neg299.2%
distribute-neg-frac299.2%
remove-double-neg99.2%
sqr-neg99.2%
associate-+l+99.2%
sqr-neg99.2%
distribute-rgt-out99.2%
Simplified99.2%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 39.2%
if 0.0749999999999999972 < k Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in m around 0 61.5%
Taylor expanded in k around inf 61.5%
Taylor expanded in k around inf 60.7%
clear-num60.8%
inv-pow60.8%
distribute-rgt-out60.8%
+-commutative60.8%
*-rgt-identity60.8%
Applied egg-rr60.8%
unpow-160.8%
associate-/l*62.8%
Simplified62.8%
Final simplification54.1%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.7e+131) (not (<= k 0.075))) (* 0.1 (/ a k)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.7e+131) || !(k <= 0.075)) {
tmp = 0.1 * (a / 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 <= (-1.7d+131)) .or. (.not. (k <= 0.075d0))) then
tmp = 0.1d0 * (a / 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 <= -1.7e+131) || !(k <= 0.075)) {
tmp = 0.1 * (a / k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.7e+131) or not (k <= 0.075): tmp = 0.1 * (a / k) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.7e+131) || !(k <= 0.075)) tmp = Float64(0.1 * Float64(a / 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 <= -1.7e+131) || ~((k <= 0.075))) tmp = 0.1 * (a / k); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.7e+131], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.7 \cdot 10^{+131} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if k < -1.69999999999999993e131 or 0.0749999999999999972 < k Initial program 70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in m around 0 68.5%
Taylor expanded in k around inf 68.4%
Taylor expanded in k around inf 67.9%
Taylor expanded in k around 0 36.3%
if -1.69999999999999993e131 < k < 0.0749999999999999972Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
distribute-frac-neg299.2%
distribute-neg-frac299.2%
remove-double-neg99.2%
sqr-neg99.2%
associate-+l+99.2%
sqr-neg99.2%
distribute-rgt-out99.2%
Simplified99.2%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 39.2%
Final simplification37.8%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.66e+131) (not (<= k 0.075))) (/ a (* k (+ k 10.0))) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.66e+131) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} 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 <= (-1.66d+131)) .or. (.not. (k <= 0.075d0))) then
tmp = a / (k * (k + 10.0d0))
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 <= -1.66e+131) || !(k <= 0.075)) {
tmp = a / (k * (k + 10.0));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.66e+131) or not (k <= 0.075): tmp = a / (k * (k + 10.0)) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.66e+131) || !(k <= 0.075)) tmp = Float64(a / Float64(k * Float64(k + 10.0))); 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 <= -1.66e+131) || ~((k <= 0.075))) tmp = a / (k * (k + 10.0)); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.66e+131], N[Not[LessEqual[k, 0.075]], $MachinePrecision]], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.66 \cdot 10^{+131} \lor \neg \left(k \leq 0.075\right):\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if k < -1.65999999999999992e131 or 0.0749999999999999972 < k Initial program 70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in m around 0 68.5%
Taylor expanded in k around inf 68.4%
Taylor expanded in k around inf 67.9%
Taylor expanded in a around 0 67.9%
+-commutative67.9%
unpow267.9%
distribute-rgt-in67.9%
Simplified67.9%
if -1.65999999999999992e131 < k < 0.0749999999999999972Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
distribute-frac-neg299.2%
distribute-neg-frac299.2%
remove-double-neg99.2%
sqr-neg99.2%
associate-+l+99.2%
sqr-neg99.2%
distribute-rgt-out99.2%
Simplified99.2%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 39.2%
Final simplification53.3%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.66e+131) (not (<= k 0.1))) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.66e+131) || !(k <= 0.1)) {
tmp = 0.1 * (a / 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 <= (-1.66d+131)) .or. (.not. (k <= 0.1d0))) then
tmp = 0.1d0 * (a / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -1.66e+131) || !(k <= 0.1)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.66e+131) or not (k <= 0.1): tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -1.66e+131) || !(k <= 0.1)) tmp = Float64(0.1 * Float64(a / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -1.66e+131) || ~((k <= 0.1))) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.66e+131], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.66 \cdot 10^{+131} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -1.65999999999999992e131 or 0.10000000000000001 < k Initial program 70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in m around 0 68.5%
Taylor expanded in k around inf 68.4%
Taylor expanded in k around inf 67.9%
Taylor expanded in k around 0 36.3%
if -1.65999999999999992e131 < k < 0.10000000000000001Initial program 99.2%
associate-/l*99.2%
remove-double-neg99.2%
distribute-frac-neg299.2%
distribute-neg-frac299.2%
remove-double-neg99.2%
sqr-neg99.2%
associate-+l+99.2%
sqr-neg99.2%
distribute-rgt-out99.2%
Simplified99.2%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 37.4%
Final simplification36.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* k (+ k 10.0)))) (if (<= m -1.6e+77) (/ a t_0) (/ a (+ 1.0 t_0)))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -1.6e+77) {
tmp = a / t_0;
} else {
tmp = a / (1.0 + 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 * (k + 10.0d0)
if (m <= (-1.6d+77)) then
tmp = a / t_0
else
tmp = a / (1.0d0 + t_0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -1.6e+77) {
tmp = a / t_0;
} else {
tmp = a / (1.0 + t_0);
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -1.6e+77: tmp = a / t_0 else: tmp = a / (1.0 + t_0) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -1.6e+77) tmp = Float64(a / t_0); else tmp = Float64(a / Float64(1.0 + t_0)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -1.6e+77) tmp = a / t_0; else tmp = a / (1.0 + t_0); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -1.6e+77], N[(a / t$95$0), $MachinePrecision], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -1.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{a}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + t\_0}\\
\end{array}
\end{array}
if m < -1.6000000000000001e77Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 43.2%
Taylor expanded in k around inf 43.2%
Taylor expanded in k around inf 57.7%
Taylor expanded in a around 0 57.7%
+-commutative57.7%
unpow257.7%
distribute-rgt-in57.7%
Simplified57.7%
if -1.6000000000000001e77 < m Initial program 80.5%
associate-/l*80.5%
remove-double-neg80.5%
distribute-frac-neg280.5%
distribute-neg-frac280.5%
remove-double-neg80.5%
sqr-neg80.5%
associate-+l+80.5%
sqr-neg80.5%
distribute-rgt-out80.5%
Simplified80.5%
Taylor expanded in m around 0 56.5%
Final simplification56.8%
(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 84.9%
associate-/l*84.9%
remove-double-neg84.9%
distribute-frac-neg284.9%
distribute-neg-frac284.9%
remove-double-neg84.9%
sqr-neg84.9%
associate-+l+84.9%
sqr-neg84.9%
distribute-rgt-out84.9%
Simplified84.9%
Taylor expanded in m around 0 53.6%
Taylor expanded in k around 0 21.3%
Final simplification21.3%
herbie shell --seed 2024059
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))