
(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 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 4e+96)
(* (/ (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 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+96) {
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 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+96) {
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 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+96: 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(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 4e+96) 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 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+96) 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[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+96], 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 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 4 \cdot 10^{+96}:\\
\;\;\;\;\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 1 (*.f64 10 k)) (*.f64 k k))) < 4.0000000000000002e96Initial program 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in k around 0 97.2%
*-commutative97.2%
add-sqr-sqrt97.2%
times-frac97.2%
hypot-1-def97.2%
hypot-1-def99.4%
Applied egg-rr99.4%
if 4.0000000000000002e96 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 56.3%
associate-*l/47.9%
sqr-neg47.9%
associate-+l+47.9%
sqr-neg47.9%
distribute-rgt-out47.9%
Simplified47.9%
Taylor expanded in k around 0 99.6%
Final simplification99.5%
(FPCore (a k m) :precision binary64 (pow (/ 1.0 (/ (hypot 1.0 k) (sqrt (* a (pow k m))))) 2.0))
double code(double a, double k, double m) {
return pow((1.0 / (hypot(1.0, k) / sqrt((a * pow(k, m))))), 2.0);
}
public static double code(double a, double k, double m) {
return Math.pow((1.0 / (Math.hypot(1.0, k) / Math.sqrt((a * Math.pow(k, m))))), 2.0);
}
def code(a, k, m): return math.pow((1.0 / (math.hypot(1.0, k) / math.sqrt((a * math.pow(k, m))))), 2.0)
function code(a, k, m) return Float64(1.0 / Float64(hypot(1.0, k) / sqrt(Float64(a * (k ^ m))))) ^ 2.0 end
function tmp = code(a, k, m) tmp = (1.0 / (hypot(1.0, k) / sqrt((a * (k ^ m))))) ^ 2.0; end
code[a_, k_, m_] := N[Power[N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision] / N[Sqrt[N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{1}{\frac{\mathsf{hypot}\left(1, k\right)}{\sqrt{a \cdot {k}^{m}}}}\right)}^{2}
\end{array}
Initial program 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in k around 0 89.4%
add-sqr-sqrt58.3%
add-sqr-sqrt58.3%
times-frac58.4%
hypot-1-def58.4%
hypot-1-def65.7%
Applied egg-rr65.7%
unpow265.7%
Simplified65.7%
clear-num65.7%
inv-pow65.7%
Applied egg-rr65.7%
unpow-165.7%
Simplified65.7%
Final simplification65.7%
(FPCore (a k m) :precision binary64 (pow (/ (sqrt (* a (pow k m))) (hypot 1.0 k)) 2.0))
double code(double a, double k, double m) {
return pow((sqrt((a * pow(k, m))) / hypot(1.0, k)), 2.0);
}
public static double code(double a, double k, double m) {
return Math.pow((Math.sqrt((a * Math.pow(k, m))) / Math.hypot(1.0, k)), 2.0);
}
def code(a, k, m): return math.pow((math.sqrt((a * math.pow(k, m))) / math.hypot(1.0, k)), 2.0)
function code(a, k, m) return Float64(sqrt(Float64(a * (k ^ m))) / hypot(1.0, k)) ^ 2.0 end
function tmp = code(a, k, m) tmp = (sqrt((a * (k ^ m))) / hypot(1.0, k)) ^ 2.0; end
code[a_, k_, m_] := N[Power[N[(N[Sqrt[N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}
\end{array}
Initial program 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in k around 0 89.4%
add-sqr-sqrt58.3%
add-sqr-sqrt58.3%
times-frac58.4%
hypot-1-def58.4%
hypot-1-def65.7%
Applied egg-rr65.7%
unpow265.7%
Simplified65.7%
Final simplification65.7%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 5e+300)
(* (pow k m) (/ a (+ 1.0 (* k (+ k 10.0)))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+300) {
tmp = pow(k, m) * (a / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 5d+300) then
tmp = (k ** m) * (a / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+300) {
tmp = Math.pow(k, m) * (a / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+300: tmp = math.pow(k, m) * (a / (1.0 + (k * (k + 10.0)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 5e+300) tmp = Float64((k ^ m) * Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+300) tmp = (k ^ m) * (a / (1.0 + (k * (k + 10.0)))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+300], N[(N[Power[k, m], $MachinePrecision] * N[(a / 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 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+300}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{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 1 (*.f64 10 k)) (*.f64 k k))) < 5.00000000000000026e300Initial program 97.7%
associate-*l/96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
if 5.00000000000000026e300 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 50.0%
associate-*l/40.5%
sqr-neg40.5%
associate-+l+40.5%
sqr-neg40.5%
distribute-rgt-out40.5%
Simplified40.5%
Taylor expanded in k around 0 100.0%
Final simplification97.3%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 2.2) (/ t_0 (+ 1.0 (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 2.2) {
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 = a * (k ** m)
if (m <= 2.2d0) 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 = a * Math.pow(k, m);
double tmp;
if (m <= 2.2) {
tmp = t_0 / (1.0 + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 2.2: tmp = t_0 / (1.0 + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 2.2) 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 = a * (k ^ m); tmp = 0.0; if (m <= 2.2) 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[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, 2.2], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 2.2:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.2000000000000002Initial program 97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in k around 0 96.6%
if 2.2000000000000002 < m Initial program 73.1%
associate-*l/65.4%
sqr-neg65.4%
associate-+l+65.4%
sqr-neg65.4%
distribute-rgt-out65.4%
Simplified65.4%
Taylor expanded in k around 0 100.0%
Final simplification97.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.7) (not (<= m 0.042))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.7) || !(m <= 0.042)) {
tmp = a * pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-3.7d0)) .or. (.not. (m <= 0.042d0))) then
tmp = a * (k ** m)
else
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -3.7) || !(m <= 0.042)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -3.7) or not (m <= 0.042): tmp = a * math.pow(k, m) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -3.7) || !(m <= 0.042)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -3.7) || ~((m <= 0.042))) tmp = a * (k ^ m); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -3.7], N[Not[LessEqual[m, 0.042]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.7 \lor \neg \left(m \leq 0.042\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.7000000000000002 or 0.0420000000000000026 < m Initial program 87.3%
associate-*l/83.6%
sqr-neg83.6%
associate-+l+83.6%
sqr-neg83.6%
distribute-rgt-out83.6%
Simplified83.6%
Taylor expanded in k around 0 100.0%
if -3.7000000000000002 < m < 0.0420000000000000026Initial program 94.7%
associate-*l/94.7%
sqr-neg94.7%
associate-+l+94.7%
sqr-neg94.7%
distribute-rgt-out94.7%
Simplified94.7%
Taylor expanded in m around 0 94.0%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= m -3.7) (/ 0.1 (/ k a)) (if (<= m 5e+50) (/ a (+ 1.0 (* k 10.0))) (+ a (* -10.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.7) {
tmp = 0.1 / (k / a);
} else if (m <= 5e+50) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-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 <= (-3.7d0)) then
tmp = 0.1d0 / (k / a)
else if (m <= 5d+50) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.7) {
tmp = 0.1 / (k / a);
} else if (m <= 5e+50) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.7: tmp = 0.1 / (k / a) elif m <= 5e+50: tmp = a / (1.0 + (k * 10.0)) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.7) tmp = Float64(0.1 / Float64(k / a)); elseif (m <= 5e+50) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.7) tmp = 0.1 / (k / a); elseif (m <= 5e+50) tmp = a / (1.0 + (k * 10.0)); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.7], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5e+50], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.7:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{elif}\;m \leq 5 \cdot 10^{+50}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -3.7000000000000002Initial program 100.0%
associate-*l/100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 38.1%
Taylor expanded in k around 0 18.1%
*-commutative18.1%
Simplified18.1%
Taylor expanded in k around inf 27.6%
clear-num27.9%
un-div-inv27.9%
Applied egg-rr27.9%
if -3.7000000000000002 < m < 5e50Initial program 92.5%
associate-*l/90.5%
sqr-neg90.5%
associate-+l+90.5%
sqr-neg90.5%
distribute-rgt-out90.5%
Simplified90.5%
Taylor expanded in m around 0 82.7%
Taylor expanded in k around 0 57.5%
*-commutative57.5%
Simplified57.5%
if 5e50 < m Initial program 72.3%
associate-*l/66.2%
sqr-neg66.2%
associate-+l+66.2%
sqr-neg66.2%
distribute-rgt-out66.2%
Simplified66.2%
Taylor expanded in k around 0 73.8%
Taylor expanded in m around 0 12.4%
Final simplification36.0%
(FPCore (a k m) :precision binary64 (if (<= m 1.05e+53) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.05e+53) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-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 <= 1.05d+53) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + ((-10.0d0) * (k * a))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.05e+53) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (k * a));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.05e+53: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (-10.0 * (k * a)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.05e+53) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(-10.0 * Float64(k * a))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.05e+53) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (-10.0 * (k * a)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.05e+53], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.05 \cdot 10^{+53}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.0500000000000001e53Initial program 95.9%
associate-*l/94.9%
sqr-neg94.9%
associate-+l+94.9%
sqr-neg94.9%
distribute-rgt-out94.9%
Simplified94.9%
Taylor expanded in m around 0 62.3%
if 1.0500000000000001e53 < m Initial program 72.3%
associate-*l/66.2%
sqr-neg66.2%
associate-+l+66.2%
sqr-neg66.2%
distribute-rgt-out66.2%
Simplified66.2%
Taylor expanded in k around 0 73.8%
Taylor expanded in m around 0 12.4%
Final simplification49.7%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (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 (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 92.9%
associate-*l/91.0%
sqr-neg91.0%
associate-+l+91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
Simplified91.0%
Taylor expanded in k around 0 95.8%
Taylor expanded in m around 0 31.9%
if 0.0749999999999999972 < k Initial program 85.2%
associate-*l/82.2%
sqr-neg82.2%
associate-+l+82.2%
sqr-neg82.2%
distribute-rgt-out82.2%
Simplified82.2%
Taylor expanded in m around 0 63.5%
Taylor expanded in k around 0 30.8%
*-commutative30.8%
Simplified30.8%
Taylor expanded in k around inf 29.9%
clear-num30.2%
un-div-inv30.2%
Applied egg-rr30.2%
Final simplification31.3%
(FPCore (a k m) :precision binary64 (if (<= k 35000000.0) a (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 35000000.0) {
tmp = a;
} else {
tmp = 0.1 * (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 <= 35000000.0d0) then
tmp = a
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 35000000.0) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 35000000.0: tmp = a else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 35000000.0) tmp = a; else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 35000000.0) tmp = a; else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 35000000.0], a, N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 35000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 3.5e7Initial program 93.1%
associate-*l/91.2%
sqr-neg91.2%
associate-+l+91.2%
sqr-neg91.2%
distribute-rgt-out91.2%
Simplified91.2%
Taylor expanded in m around 0 36.3%
Taylor expanded in k around 0 27.5%
if 3.5e7 < k Initial program 84.7%
associate-*l/81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 65.4%
Taylor expanded in k around 0 31.7%
*-commutative31.7%
Simplified31.7%
Taylor expanded in k around inf 30.7%
Final simplification28.7%
(FPCore (a k m) :precision binary64 (if (<= k 35000000.0) a (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 35000000.0) {
tmp = a;
} else {
tmp = 0.1 / (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 (k <= 35000000.0d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 35000000.0) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 35000000.0: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 35000000.0) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 35000000.0) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 35000000.0], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 35000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 3.5e7Initial program 93.1%
associate-*l/91.2%
sqr-neg91.2%
associate-+l+91.2%
sqr-neg91.2%
distribute-rgt-out91.2%
Simplified91.2%
Taylor expanded in m around 0 36.3%
Taylor expanded in k around 0 27.5%
if 3.5e7 < k Initial program 84.7%
associate-*l/81.6%
sqr-neg81.6%
associate-+l+81.6%
sqr-neg81.6%
distribute-rgt-out81.6%
Simplified81.6%
Taylor expanded in m around 0 65.4%
Taylor expanded in k around 0 31.7%
*-commutative31.7%
Simplified31.7%
Taylor expanded in k around inf 30.7%
clear-num31.0%
un-div-inv31.0%
Applied egg-rr31.0%
Final simplification28.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 89.9%
associate-*l/87.6%
sqr-neg87.6%
associate-+l+87.6%
sqr-neg87.6%
distribute-rgt-out87.6%
Simplified87.6%
Taylor expanded in m around 0 47.3%
Taylor expanded in k around 0 18.6%
Final simplification18.6%
herbie shell --seed 2024027
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))