
(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 10 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))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+180) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+180) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+180) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+180) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+180: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+180) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+180) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+180], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t\_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 2e180Initial program 97.3%
if 2e180 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 53.5%
associate-/l*53.5%
remove-double-neg53.5%
distribute-frac-neg253.5%
distribute-neg-frac253.5%
remove-double-neg53.5%
sqr-neg53.5%
associate-+l+53.5%
sqr-neg53.5%
distribute-rgt-out53.5%
Simplified53.5%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (<= m 2e-28) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2e-28) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} 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 <= 2d-28) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
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 <= 2e-28) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2e-28: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2e-28) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2e-28) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2e-28], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2 \cdot 10^{-28}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 1.99999999999999994e-28Initial program 96.6%
associate-/l*96.6%
remove-double-neg96.6%
distribute-frac-neg296.6%
distribute-neg-frac296.6%
remove-double-neg96.6%
sqr-neg96.6%
associate-+l+96.6%
sqr-neg96.6%
distribute-rgt-out96.6%
Simplified96.6%
if 1.99999999999999994e-28 < m Initial program 76.2%
associate-/l*76.2%
remove-double-neg76.2%
distribute-frac-neg276.2%
distribute-neg-frac276.2%
remove-double-neg76.2%
sqr-neg76.2%
associate-+l+76.2%
sqr-neg76.2%
distribute-rgt-out76.2%
Simplified76.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.1e+18) (not (<= m 2e-28))) (* a (pow k m)) (/ a (+ (+ 1.0 (* k 10.0)) (* k k)))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.1e+18) || !(m <= 2e-28)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((1.0 + (k * 10.0)) + (k * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((m <= (-2.1d+18)) .or. (.not. (m <= 2d-28))) then
tmp = a * (k ** m)
else
tmp = a / ((1.0d0 + (k * 10.0d0)) + (k * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -2.1e+18) || !(m <= 2e-28)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((1.0 + (k * 10.0)) + (k * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -2.1e+18) or not (m <= 2e-28): tmp = a * math.pow(k, m) else: tmp = a / ((1.0 + (k * 10.0)) + (k * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -2.1e+18) || !(m <= 2e-28)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -2.1e+18) || ~((m <= 2e-28))) tmp = a * (k ^ m); else tmp = a / ((1.0 + (k * 10.0)) + (k * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -2.1e+18], N[Not[LessEqual[m, 2e-28]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.1 \cdot 10^{+18} \lor \neg \left(m \leq 2 \cdot 10^{-28}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\end{array}
\end{array}
if m < -2.1e18 or 1.99999999999999994e-28 < m Initial program 87.9%
associate-/l*87.9%
remove-double-neg87.9%
distribute-frac-neg287.9%
distribute-neg-frac287.9%
remove-double-neg87.9%
sqr-neg87.9%
associate-+l+87.9%
sqr-neg87.9%
distribute-rgt-out87.9%
Simplified87.9%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -2.1e18 < m < 1.99999999999999994e-28Initial program 93.6%
Taylor expanded in m around 0 92.9%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -6e+34) (not (<= k 0.064))) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -6e+34) || !(k <= 0.064)) {
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 <= (-6d+34)) .or. (.not. (k <= 0.064d0))) 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 <= -6e+34) || !(k <= 0.064)) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -6e+34) or not (k <= 0.064): tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -6e+34) || !(k <= 0.064)) 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 <= -6e+34) || ~((k <= 0.064))) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -6e+34], N[Not[LessEqual[k, 0.064]], $MachinePrecision]], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -6 \cdot 10^{+34} \lor \neg \left(k \leq 0.064\right):\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -6.00000000000000037e34 or 0.064000000000000001 < k Initial program 80.1%
associate-/l*80.1%
remove-double-neg80.1%
distribute-frac-neg280.1%
distribute-neg-frac280.1%
remove-double-neg80.1%
sqr-neg80.1%
associate-+l+80.1%
sqr-neg80.1%
distribute-rgt-out80.1%
Simplified80.1%
Taylor expanded in m around 0 59.1%
Taylor expanded in k around 0 24.9%
*-commutative24.9%
Simplified24.9%
Taylor expanded in k around inf 24.9%
if -6.00000000000000037e34 < k < 0.064000000000000001Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
distribute-rgt-in99.9%
associate-+l+99.9%
associate-*r/99.9%
clear-num99.9%
associate-/r*99.1%
associate-+l+99.1%
distribute-rgt-in99.1%
+-commutative99.1%
fma-define99.1%
+-commutative99.1%
Applied egg-rr99.1%
associate-/r/99.1%
associate-*l/99.1%
*-lft-identity99.1%
Simplified99.1%
Taylor expanded in k around 0 98.5%
Taylor expanded in m around 0 33.9%
Final simplification29.4%
(FPCore (a k m) :precision binary64 (if (<= k 0.072) (+ a (* -10.0 (* a k))) (* 0.1 (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.072) {
tmp = a + (-10.0 * (a * k));
} 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 <= 0.072d0) then
tmp = a + ((-10.0d0) * (a * k))
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 <= 0.072) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.072: tmp = a + (-10.0 * (a * k)) else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.072) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.072) tmp = a + (-10.0 * (a * k)); else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.072], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.072:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.0719999999999999946Initial 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%
Taylor expanded in m around 0 39.9%
Taylor expanded in k around 0 29.2%
if 0.0719999999999999946 < k 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 60.8%
Taylor expanded in k around 0 27.1%
*-commutative27.1%
Simplified27.1%
Taylor expanded in k around inf 27.1%
Final simplification28.4%
(FPCore (a k m) :precision binary64 (if (<= m -1.7e+21) (* 0.1 (/ a k)) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e+21) {
tmp = 0.1 * (a / k);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-1.7d+21)) then
tmp = 0.1d0 * (a / k)
else
tmp = a / (1.0d0 + (k * 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.7e+21) {
tmp = 0.1 * (a / k);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.7e+21: tmp = 0.1 * (a / k) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.7e+21) tmp = Float64(0.1 * Float64(a / k)); else tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.7e+21) tmp = 0.1 * (a / k); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.7e+21], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.7 \cdot 10^{+21}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -1.7e21Initial 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 m around 0 40.9%
Taylor expanded in k around 0 16.3%
*-commutative16.3%
Simplified16.3%
Taylor expanded in k around inf 22.9%
if -1.7e21 < m Initial program 85.4%
associate-/l*85.4%
remove-double-neg85.4%
distribute-frac-neg285.4%
distribute-neg-frac285.4%
remove-double-neg85.4%
sqr-neg85.4%
associate-+l+85.4%
sqr-neg85.4%
distribute-rgt-out85.4%
Simplified85.4%
Taylor expanded in m around 0 50.3%
Taylor expanded in k around 0 35.7%
*-commutative35.7%
Simplified35.7%
Final simplification31.8%
(FPCore (a k m) :precision binary64 (/ 1.0 (/ (+ 1.0 (* k (+ k 10.0))) a)))
double code(double a, double k, double m) {
return 1.0 / ((1.0 + (k * (k + 10.0))) / a);
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = 1.0d0 / ((1.0d0 + (k * (k + 10.0d0))) / a)
end function
public static double code(double a, double k, double m) {
return 1.0 / ((1.0 + (k * (k + 10.0))) / a);
}
def code(a, k, m): return 1.0 / ((1.0 + (k * (k + 10.0))) / a)
function code(a, k, m) return Float64(1.0 / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)) end
function tmp = code(a, k, m) tmp = 1.0 / ((1.0 + (k * (k + 10.0))) / a); end
code[a_, k_, m_] := N[(1.0 / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1 + k \cdot \left(k + 10\right)}{a}}
\end{array}
Initial program 89.9%
associate-/l*89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-neg-frac289.9%
remove-double-neg89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out89.9%
Simplified89.9%
distribute-rgt-in89.9%
associate-+l+89.9%
associate-*r/89.9%
clear-num89.8%
associate-/r*88.6%
associate-+l+88.6%
distribute-rgt-in88.6%
+-commutative88.6%
fma-define88.6%
+-commutative88.6%
Applied egg-rr88.6%
associate-/l/89.8%
Simplified89.8%
Taylor expanded in m around 0 47.6%
Final simplification47.6%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k (+ k 10.0)))))
double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a / (1.0d0 + (k * (k + 10.0d0)))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * (k + 10.0)));
}
def code(a, k, m): return a / (1.0 + (k * (k + 10.0)))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * (k + 10.0))); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot \left(k + 10\right)}
\end{array}
Initial program 89.9%
associate-/l*89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-neg-frac289.9%
remove-double-neg89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out89.9%
Simplified89.9%
Taylor expanded in m around 0 47.4%
Final simplification47.4%
(FPCore (a k m) :precision binary64 (/ a (+ 1.0 (* k k))))
double code(double a, double k, double m) {
return a / (1.0 + (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 / (1.0d0 + (k * k))
end function
public static double code(double a, double k, double m) {
return a / (1.0 + (k * k));
}
def code(a, k, m): return a / (1.0 + (k * k))
function code(a, k, m) return Float64(a / Float64(1.0 + Float64(k * k))) end
function tmp = code(a, k, m) tmp = a / (1.0 + (k * k)); end
code[a_, k_, m_] := N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{1 + k \cdot k}
\end{array}
Initial program 89.9%
Taylor expanded in m around 0 47.4%
Taylor expanded in k around 0 45.8%
Final simplification45.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*89.9%
remove-double-neg89.9%
distribute-frac-neg289.9%
distribute-neg-frac289.9%
remove-double-neg89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out89.9%
Simplified89.9%
distribute-rgt-in89.9%
associate-+l+89.9%
associate-*r/89.9%
clear-num89.8%
associate-/r*88.6%
associate-+l+88.6%
distribute-rgt-in88.6%
+-commutative88.6%
fma-define88.6%
+-commutative88.6%
Applied egg-rr88.6%
associate-/r/88.6%
associate-*l/88.6%
*-lft-identity88.6%
Simplified88.6%
Taylor expanded in k around 0 81.7%
Taylor expanded in m around 0 19.2%
Final simplification19.2%
herbie shell --seed 2024040
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))