
(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 13 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 (/ 1.0 t_0))) (if (<= k 1e-152) 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 = a * pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-152) {
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 = a * (k ** m)
t_1 = 1.0d0 / t_0
if (k <= 1d-152) 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 = a * Math.pow(k, m);
double t_1 = 1.0 / t_0;
double tmp;
if (k <= 1e-152) {
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 = a * math.pow(k, m) t_1 = 1.0 / t_0 tmp = 0 if k <= 1e-152: 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(a * (k ^ m)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (k <= 1e-152) 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 = a * (k ^ m); t_1 = 1.0 / t_0; tmp = 0.0; if (k <= 1e-152) 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[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[k, 1e-152], 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 := a \cdot {k}^{m}\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;k \leq 10^{-152}:\\
\;\;\;\;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.00000000000000007e-152Initial program 92.0%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-neg-frac292.0%
remove-double-neg92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.0%
Simplified92.0%
Taylor expanded in k around 0 98.4%
if 1.00000000000000007e-152 < k Initial program 88.6%
associate-/l*88.6%
remove-double-neg88.6%
distribute-frac-neg288.6%
distribute-neg-frac288.6%
remove-double-neg88.6%
sqr-neg88.6%
associate-+l+88.6%
sqr-neg88.6%
distribute-rgt-out88.6%
Simplified88.6%
distribute-lft-in88.6%
associate-+l+88.6%
associate-*r/88.6%
clear-num88.0%
associate-+l+88.1%
distribute-lft-in88.1%
+-commutative88.1%
fma-define88.1%
+-commutative88.1%
*-commutative88.1%
Applied egg-rr88.1%
Taylor expanded in k around 0 99.3%
Final simplification98.9%
(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 90.3%
associate-/l*90.3%
remove-double-neg90.3%
distribute-frac-neg290.3%
distribute-neg-frac290.3%
remove-double-neg90.3%
sqr-neg90.3%
associate-+l+90.3%
sqr-neg90.3%
distribute-rgt-out90.3%
Simplified90.3%
Taylor expanded in k around inf 88.7%
add-sqr-sqrt68.3%
pow268.3%
associate-*r/68.3%
sqrt-div66.3%
hypot-1-def71.0%
Applied egg-rr71.0%
(FPCore (a k m) :precision binary64 (if (<= (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))) INFINITY) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (((a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= ((double) INFINITY)) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
public static double code(double a, double k, double m) {
double tmp;
if (((a * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= Double.POSITIVE_INFINITY) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if ((a * math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k))) <= math.inf: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= Inf) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 99.0) - 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (((a * (k ^ m)) / ((1.0 + (k * 10.0)) + (k * k))) <= Inf) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], 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[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k} \leq \infty:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\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))) < +inf.0Initial program 97.9%
associate-/l*97.9%
remove-double-neg97.9%
distribute-frac-neg297.9%
distribute-neg-frac297.9%
remove-double-neg97.9%
sqr-neg97.9%
associate-+l+97.9%
sqr-neg97.9%
distribute-rgt-out97.9%
Simplified97.9%
if +inf.0 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 0.0%
associate-/l*0.0%
remove-double-neg0.0%
distribute-frac-neg20.0%
distribute-neg-frac20.0%
remove-double-neg0.0%
sqr-neg0.0%
associate-+l+0.0%
sqr-neg0.0%
distribute-rgt-out0.0%
Simplified0.0%
Taylor expanded in m around 0 1.6%
Taylor expanded in k around 0 67.3%
Taylor expanded in a around 0 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.4e-9) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a * (pow(k, m) / (1.0 + (k * k)));
} 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.4d-9) then
tmp = a * ((k ** m) / (1.0d0 + (k * k)))
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.4e-9) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * k)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.4e-9: tmp = a * (math.pow(k, m) / (1.0 + (k * k))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.4e-9) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * k)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.4e-9) tmp = a * ((k ^ m) / (1.0 + (k * k))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.4e-9], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 1.39999999999999992e-9Initial 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+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in k around inf 95.2%
if 1.39999999999999992e-9 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in k around 0 98.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.0013) (* a (/ (pow k m) (+ 1.0 (* k 10.0)))) (if (<= m 9.2e-17) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.0013) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 9.2e-17) {
tmp = a / (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 <= (-0.0013d0)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 9.2d-17) then
tmp = a / (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 <= -0.0013) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 9.2e-17) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.0013: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 9.2e-17: tmp = a / (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 <= -0.0013) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 9.2e-17) tmp = Float64(a / 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 <= -0.0013) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 9.2e-17) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.0013], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9.2e-17], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0013:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 9.2 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -0.0012999999999999999Initial 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 98.9%
*-commutative98.9%
Simplified98.9%
if -0.0012999999999999999 < m < 9.20000000000000035e-17Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
if 9.20000000000000035e-17 < m Initial program 78.2%
associate-/l*78.2%
remove-double-neg78.2%
distribute-frac-neg278.2%
distribute-neg-frac278.2%
remove-double-neg78.2%
sqr-neg78.2%
associate-+l+78.2%
sqr-neg78.2%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in k around 0 97.9%
Final simplification97.3%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.0013) (not (<= m 9.2e-17))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.0013) || !(m <= 9.2e-17)) {
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 <= (-0.0013d0)) .or. (.not. (m <= 9.2d-17))) 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 <= -0.0013) || !(m <= 9.2e-17)) {
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 <= -0.0013) or not (m <= 9.2e-17): 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 <= -0.0013) || !(m <= 9.2e-17)) 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 <= -0.0013) || ~((m <= 9.2e-17))) 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, -0.0013], N[Not[LessEqual[m, 9.2e-17]], $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 -0.0013 \lor \neg \left(m \leq 9.2 \cdot 10^{-17}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.0012999999999999999 or 9.20000000000000035e-17 < m Initial program 88.7%
associate-/l*88.7%
remove-double-neg88.7%
distribute-frac-neg288.7%
distribute-neg-frac288.7%
remove-double-neg88.7%
sqr-neg88.7%
associate-+l+88.7%
sqr-neg88.7%
distribute-rgt-out88.7%
Simplified88.7%
Taylor expanded in k around 0 97.9%
if -0.0012999999999999999 < m < 9.20000000000000035e-17Initial program 94.4%
associate-/l*94.4%
remove-double-neg94.4%
distribute-frac-neg294.4%
distribute-neg-frac294.4%
remove-double-neg94.4%
sqr-neg94.4%
associate-+l+94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
Final simplification96.9%
(FPCore (a k m) :precision binary64 (if (<= m 1.4e-9) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* a (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (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 <= 1.4d-9) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (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 <= 1.4e-9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.4e-9: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.4e-9) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * 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 <= 1.4e-9) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.4e-9], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 1.39999999999999992e-9Initial 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+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 63.2%
if 1.39999999999999992e-9 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in m around 0 3.4%
Taylor expanded in k around 0 24.9%
Taylor expanded in a around 0 32.9%
Final simplification52.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.4e-9) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* a (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (a * (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 <= 1.4d-9) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (a * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (a * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.4e-9: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (a * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.4e-9) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(a * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.4e-9) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (a * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.4e-9], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(a * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(a \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.39999999999999992e-9Initial 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+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 63.2%
if 1.39999999999999992e-9 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in m around 0 3.4%
Taylor expanded in k around 0 24.9%
Taylor expanded in k around inf 26.0%
Taylor expanded in a around 0 26.0%
*-commutative26.0%
associate-*l*26.0%
Simplified26.0%
Final simplification49.6%
(FPCore (a k m) :precision binary64 (if (<= m 1.4e-9) (/ a (+ 1.0 (* k k))) (+ a (* k (* a (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (a * (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 <= 1.4d-9) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (a * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.4e-9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (a * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.4e-9: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (a * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.4e-9) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(a * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.4e-9) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (a * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.4e-9], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(a * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(a \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.39999999999999992e-9Initial 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+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in m around 0 63.2%
Taylor expanded in k around inf 62.0%
if 1.39999999999999992e-9 < m Initial program 78.7%
associate-/l*78.7%
remove-double-neg78.7%
distribute-frac-neg278.7%
distribute-neg-frac278.7%
remove-double-neg78.7%
sqr-neg78.7%
associate-+l+78.7%
sqr-neg78.7%
distribute-rgt-out78.7%
Simplified78.7%
Taylor expanded in m around 0 3.4%
Taylor expanded in k around 0 24.9%
Taylor expanded in k around inf 26.0%
Taylor expanded in a around 0 26.0%
*-commutative26.0%
associate-*l*26.0%
Simplified26.0%
(FPCore (a k m) :precision binary64 (if (<= m 2.45e+14) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.45e+14) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -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 (m <= 2.45d+14) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.45e+14) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.45e+14: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.45e+14) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.45e+14) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.45e+14], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.45 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 2.45e14Initial 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 62.1%
Taylor expanded in k around inf 60.9%
if 2.45e14 < m Initial program 80.0%
associate-/l*80.0%
remove-double-neg80.0%
distribute-frac-neg280.0%
distribute-neg-frac280.0%
remove-double-neg80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.2%
Taylor expanded in k around inf 19.7%
(FPCore (a k m) :precision binary64 (if (<= m 3.9e+14) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.9e+14) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -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 (m <= 3.9d+14) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.9e+14) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.9e+14: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.9e+14) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.9e+14) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.9e+14], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.9 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 3.9e14Initial 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 62.1%
Taylor expanded in k around 0 37.0%
*-commutative83.6%
Simplified37.0%
if 3.9e14 < m Initial program 80.0%
associate-/l*80.0%
remove-double-neg80.0%
distribute-frac-neg280.0%
distribute-neg-frac280.0%
remove-double-neg80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.2%
Taylor expanded in k around inf 19.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.85e+14) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.85e+14) {
tmp = a;
} else {
tmp = -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 (m <= 2.85d+14) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.85e+14) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.85e+14: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.85e+14) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.85e+14) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.85e+14], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.85 \cdot 10^{+14}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 2.85e14Initial 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 62.1%
Taylor expanded in k around 0 25.7%
if 2.85e14 < m Initial program 80.0%
associate-/l*80.0%
remove-double-neg80.0%
distribute-frac-neg280.0%
distribute-neg-frac280.0%
remove-double-neg80.0%
sqr-neg80.0%
associate-+l+80.0%
sqr-neg80.0%
distribute-rgt-out80.0%
Simplified80.0%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 9.2%
Taylor expanded in k around inf 19.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 90.3%
associate-/l*90.3%
remove-double-neg90.3%
distribute-frac-neg290.3%
distribute-neg-frac290.3%
remove-double-neg90.3%
sqr-neg90.3%
associate-+l+90.3%
sqr-neg90.3%
distribute-rgt-out90.3%
Simplified90.3%
Taylor expanded in m around 0 41.3%
Taylor expanded in k around 0 18.0%
herbie shell --seed 2024143
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))