
(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 (let* ((t_0 (* a (pow k m))) (t_1 (/ 1.0 t_0))) (if (<= k 1.5e-22) 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 <= 1.5e-22) {
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 <= 1.5d-22) 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 <= 1.5e-22) {
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 <= 1.5e-22: 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 <= 1.5e-22) 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 <= 1.5e-22) 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, 1.5e-22], 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 1.5 \cdot 10^{-22}:\\
\;\;\;\;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.5e-22Initial program 93.5%
associate-/l*93.5%
remove-double-neg93.5%
distribute-frac-neg293.5%
distribute-neg-frac293.5%
remove-double-neg93.5%
sqr-neg93.5%
associate-+l+93.5%
sqr-neg93.5%
distribute-rgt-out93.5%
Simplified93.5%
Taylor expanded in k around 0 100.0%
if 1.5e-22 < k Initial program 83.9%
associate-/l*83.9%
remove-double-neg83.9%
distribute-frac-neg283.9%
distribute-neg-frac283.9%
remove-double-neg83.9%
sqr-neg83.9%
associate-+l+83.9%
sqr-neg83.9%
distribute-rgt-out83.9%
Simplified83.9%
distribute-lft-in83.9%
associate-+l+83.9%
associate-*r/83.9%
clear-num83.9%
associate-+l+83.9%
distribute-lft-in83.9%
+-commutative83.9%
fma-define83.9%
+-commutative83.9%
*-commutative83.9%
Applied egg-rr83.9%
Taylor expanded in k around 0 99.8%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (let* ((t_0 (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_0 INFINITY) t_0 (+ a (* a (* k (- (* k 99.0) 10.0)))))))
double code(double a, double k, double m) {
double t_0 = (a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
public static double code(double a, double k, double m) {
double t_0 = (a * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = a + (a * (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): t_0 = (a * math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = a + (a * (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) t_0 = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_0 <= Inf) tmp = t_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) t_0 = (a * (k ^ m)) / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = a + (a * (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(a + N[(a * N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\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 98.8%
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 91.5%
Taylor expanded in a around 0 100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.8e-19) (* 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 <= 2.8e-19) {
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 <= 2.8d-19) 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 <= 2.8e-19) {
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 <= 2.8e-19: 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 <= 2.8e-19) 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 <= 2.8e-19) 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, 2.8e-19], 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.8 \cdot 10^{-19}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.80000000000000003e-19Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
if 2.80000000000000003e-19 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in k around 0 100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= m 2.8e-19) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.8e-19) {
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 <= 2.8d-19) 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 <= 2.8e-19) {
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 <= 2.8e-19: 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 <= 2.8e-19) 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 <= 2.8e-19) 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, 2.8e-19], 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 2.8 \cdot 10^{-19}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.80000000000000003e-19Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in k around inf 97.5%
if 2.80000000000000003e-19 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in k around 0 100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -1e-6) (not (<= m 2.8e-19))) (* a (pow k m)) (/ 1.0 (+ (/ 1.0 a) (* k (+ (* 10.0 (/ 1.0 a)) (/ k a)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1e-6) || !(m <= 2.8e-19)) {
tmp = a * pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (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 <= (-1d-6)) .or. (.not. (m <= 2.8d-19))) then
tmp = a * (k ** m)
else
tmp = 1.0d0 / ((1.0d0 / a) + (k * ((10.0d0 * (1.0d0 / a)) + (k / a))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -1e-6) || !(m <= 2.8e-19)) {
tmp = a * Math.pow(k, m);
} else {
tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -1e-6) or not (m <= 2.8e-19): tmp = a * math.pow(k, m) else: tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -1e-6) || !(m <= 2.8e-19)) tmp = Float64(a * (k ^ m)); else tmp = Float64(1.0 / Float64(Float64(1.0 / a) + Float64(k * Float64(Float64(10.0 * Float64(1.0 / a)) + Float64(k / a))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -1e-6) || ~((m <= 2.8e-19))) tmp = a * (k ^ m); else tmp = 1.0 / ((1.0 / a) + (k * ((10.0 * (1.0 / a)) + (k / a)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -1e-6], N[Not[LessEqual[m, 2.8e-19]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(1.0 / a), $MachinePrecision] + N[(k * N[(N[(10.0 * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1 \cdot 10^{-6} \lor \neg \left(m \leq 2.8 \cdot 10^{-19}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1}{a} + k \cdot \left(10 \cdot \frac{1}{a} + \frac{k}{a}\right)}\\
\end{array}
\end{array}
if m < -9.99999999999999955e-7 or 2.80000000000000003e-19 < m Initial program 87.1%
associate-/l*87.1%
remove-double-neg87.1%
distribute-frac-neg287.1%
distribute-neg-frac287.1%
remove-double-neg87.1%
sqr-neg87.1%
associate-+l+87.1%
sqr-neg87.1%
distribute-rgt-out87.1%
Simplified87.1%
Taylor expanded in k around 0 100.0%
if -9.99999999999999955e-7 < m < 2.80000000000000003e-19Initial program 96.7%
associate-/l*96.7%
remove-double-neg96.7%
distribute-frac-neg296.7%
distribute-neg-frac296.7%
remove-double-neg96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
distribute-lft-in96.7%
associate-+l+96.7%
associate-*r/96.7%
clear-num96.5%
associate-+l+96.5%
distribute-lft-in96.5%
+-commutative96.5%
fma-define96.5%
+-commutative96.5%
*-commutative96.5%
Applied egg-rr96.5%
Taylor expanded in k around 0 99.6%
Taylor expanded in m around 0 99.2%
Final simplification99.7%
(FPCore (a k m) :precision binary64 (if (<= m 2.8e-19) (/ 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 <= 2.8e-19) {
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 <= 2.8d-19) 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 <= 2.8e-19) {
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 <= 2.8e-19: 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 <= 2.8e-19) 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 <= 2.8e-19) 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, 2.8e-19], 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 2.8 \cdot 10^{-19}:\\
\;\;\;\;\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 < 2.80000000000000003e-19Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 67.0%
if 2.80000000000000003e-19 < m Initial program 74.4%
associate-/l*74.4%
remove-double-neg74.4%
distribute-frac-neg274.4%
distribute-neg-frac274.4%
remove-double-neg74.4%
sqr-neg74.4%
associate-+l+74.4%
sqr-neg74.4%
distribute-rgt-out74.4%
Simplified74.4%
Taylor expanded in m around 0 4.4%
Taylor expanded in k around 0 32.2%
Taylor expanded in a around 0 34.3%
Final simplification56.1%
(FPCore (a k m) :precision binary64 (if (<= m 1.02) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.02) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.02d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.02) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.02: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.02) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.02) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.02], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.02:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.02Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 67.2%
if 1.02 < m Initial program 74.1%
associate-/l*74.1%
remove-double-neg74.1%
distribute-frac-neg274.1%
distribute-neg-frac274.1%
remove-double-neg74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 12.3%
Taylor expanded in k around inf 25.6%
Final simplification53.4%
(FPCore (a k m) :precision binary64 (if (<= m 0.85) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.85) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.85d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.85) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.85: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.85) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.85) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.85], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.85:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 0.849999999999999978Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around inf 66.4%
if 0.849999999999999978 < m Initial program 74.1%
associate-/l*74.1%
remove-double-neg74.1%
distribute-frac-neg274.1%
distribute-neg-frac274.1%
remove-double-neg74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 12.3%
Taylor expanded in k around inf 25.6%
Final simplification52.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.02) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.02) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.02d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.02) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.02: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.02) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.02) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.02], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.02:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.02Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around 0 43.1%
*-commutative43.1%
Simplified43.1%
if 1.02 < m Initial program 74.1%
associate-/l*74.1%
remove-double-neg74.1%
distribute-frac-neg274.1%
distribute-neg-frac274.1%
remove-double-neg74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 12.3%
Taylor expanded in k around inf 25.6%
Final simplification37.3%
(FPCore (a k m) :precision binary64 (if (<= m 0.34) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.34) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 0.34d0) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 0.34) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.34: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.34) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.34) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.34], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.34:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 0.340000000000000024Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 67.2%
Taylor expanded in k around 0 33.0%
if 0.340000000000000024 < m Initial program 74.1%
associate-/l*74.1%
remove-double-neg74.1%
distribute-frac-neg274.1%
distribute-neg-frac274.1%
remove-double-neg74.1%
sqr-neg74.1%
associate-+l+74.1%
sqr-neg74.1%
distribute-rgt-out74.1%
Simplified74.1%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 12.3%
Taylor expanded in k around inf 25.6%
Final simplification30.6%
(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 46.0%
Taylor expanded in k around 0 23.4%
herbie shell --seed 2024160
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))