
(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 2e-24) 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 <= 2e-24) {
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 <= 2d-24) 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 <= 2e-24) {
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 <= 2e-24: 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 <= 2e-24) 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 <= 2e-24) 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, 2e-24], 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 2 \cdot 10^{-24}:\\
\;\;\;\;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.99999999999999985e-24Initial program 93.9%
associate-/l*93.9%
remove-double-neg93.9%
distribute-frac-neg293.9%
distribute-neg-frac293.9%
remove-double-neg93.9%
sqr-neg93.9%
associate-+l+93.9%
sqr-neg93.9%
distribute-rgt-out93.9%
Simplified93.9%
Taylor expanded in k around 0 100.0%
if 1.99999999999999985e-24 < k 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%
distribute-lft-in87.1%
associate-+l+87.1%
associate-*r/87.1%
clear-num87.1%
associate-+l+87.1%
distribute-lft-in87.1%
+-commutative87.1%
fma-define87.1%
+-commutative87.1%
*-commutative87.1%
Applied egg-rr87.1%
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.4%
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 89.6%
Taylor expanded in a around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.22e-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 <= 1.22e-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 <= 1.22d-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 <= 1.22e-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 <= 1.22e-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 <= 1.22e-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 <= 1.22e-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, 1.22e-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 1.22 \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 < 1.2200000000000001e-19Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
if 1.2200000000000001e-19 < m Initial program 78.8%
associate-/l*78.8%
remove-double-neg78.8%
distribute-frac-neg278.8%
distribute-neg-frac278.8%
remove-double-neg78.8%
sqr-neg78.8%
associate-+l+78.8%
sqr-neg78.8%
distribute-rgt-out78.8%
Simplified78.8%
Taylor expanded in k around 0 100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (or (<= m -8.4e-14) (not (<= m 1.22e-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 <= -8.4e-14) || !(m <= 1.22e-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 <= (-8.4d-14)) .or. (.not. (m <= 1.22d-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 <= -8.4e-14) || !(m <= 1.22e-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 <= -8.4e-14) or not (m <= 1.22e-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 <= -8.4e-14) || !(m <= 1.22e-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 <= -8.4e-14) || ~((m <= 1.22e-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, -8.4e-14], N[Not[LessEqual[m, 1.22e-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 -8.4 \cdot 10^{-14} \lor \neg \left(m \leq 1.22 \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 < -8.3999999999999995e-14 or 1.2200000000000001e-19 < m Initial program 89.2%
associate-/l*89.2%
remove-double-neg89.2%
distribute-frac-neg289.2%
distribute-neg-frac289.2%
remove-double-neg89.2%
sqr-neg89.2%
associate-+l+89.2%
sqr-neg89.2%
distribute-rgt-out89.2%
Simplified89.2%
Taylor expanded in k around 0 100.0%
if -8.3999999999999995e-14 < m < 1.2200000000000001e-19Initial program 95.7%
associate-/l*95.6%
remove-double-neg95.6%
distribute-frac-neg295.6%
distribute-neg-frac295.6%
remove-double-neg95.6%
sqr-neg95.6%
associate-+l+95.6%
sqr-neg95.6%
distribute-rgt-out95.6%
Simplified95.6%
distribute-lft-in95.6%
associate-+l+95.6%
associate-*r/95.7%
clear-num95.5%
associate-+l+95.5%
distribute-lft-in95.5%
+-commutative95.5%
fma-define95.5%
+-commutative95.5%
*-commutative95.5%
Applied egg-rr95.5%
Taylor expanded in k around 0 99.7%
Taylor expanded in m around 0 99.7%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (if (<= m 1.22e-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 <= 1.22e-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 <= 1.22d-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 <= 1.22e-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 <= 1.22e-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 <= 1.22e-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 <= 1.22e-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, 1.22e-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 1.22 \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 < 1.2200000000000001e-19Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
Taylor expanded in m around 0 68.2%
if 1.2200000000000001e-19 < m Initial program 78.8%
associate-/l*78.8%
remove-double-neg78.8%
distribute-frac-neg278.8%
distribute-neg-frac278.8%
remove-double-neg78.8%
sqr-neg78.8%
associate-+l+78.8%
sqr-neg78.8%
distribute-rgt-out78.8%
Simplified78.8%
Taylor expanded in m around 0 6.9%
Taylor expanded in k around 0 30.7%
Taylor expanded in a around 0 32.9%
Final simplification56.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.22e-19) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 99.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.22e-19) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.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.22d-19) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (99.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.22e-19) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.22e-19: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (99.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.22e-19) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.22e-19) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (99.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.22e-19], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.22 \cdot 10^{-19}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 1.2200000000000001e-19Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
Taylor expanded in m around 0 68.2%
if 1.2200000000000001e-19 < m Initial program 78.8%
associate-/l*78.8%
remove-double-neg78.8%
distribute-frac-neg278.8%
distribute-neg-frac278.8%
remove-double-neg78.8%
sqr-neg78.8%
associate-+l+78.8%
sqr-neg78.8%
distribute-rgt-out78.8%
Simplified78.8%
Taylor expanded in m around 0 6.9%
Taylor expanded in k around 0 30.7%
Taylor expanded in a around 0 30.7%
Taylor expanded in k around inf 30.7%
Final simplification55.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.22e-19) (/ a (+ 1.0 (* k k))) (+ a (* k (* 99.0 (* k a))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.22e-19) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (99.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.22d-19) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (99.0d0 * (k * a)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.22e-19) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (99.0 * (k * a)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.22e-19: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (99.0 * (k * a))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.22e-19) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(k * a)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.22e-19) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (99.0 * (k * a))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.22e-19], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.22 \cdot 10^{-19}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(k \cdot a\right)\right)\\
\end{array}
\end{array}
if m < 1.2200000000000001e-19Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
Taylor expanded in m around 0 68.2%
Taylor expanded in k around inf 67.3%
if 1.2200000000000001e-19 < m Initial program 78.8%
associate-/l*78.8%
remove-double-neg78.8%
distribute-frac-neg278.8%
distribute-neg-frac278.8%
remove-double-neg78.8%
sqr-neg78.8%
associate-+l+78.8%
sqr-neg78.8%
distribute-rgt-out78.8%
Simplified78.8%
Taylor expanded in m around 0 6.9%
Taylor expanded in k around 0 30.7%
Taylor expanded in a around 0 30.7%
Taylor expanded in k around inf 30.7%
Final simplification55.2%
(FPCore (a k m) :precision binary64 (if (<= m 7500000.0) (/ a (+ 1.0 (* k k))) (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 7500000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * -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 <= 7500000.0d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7500000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7500000.0: tmp = a / (1.0 + (k * k)) else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7500000.0) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7500000.0) tmp = a / (1.0 + (k * k)); else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7500000.0], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7500000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 7.5e6Initial program 97.3%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around inf 66.7%
if 7.5e6 < 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 m around 0 2.9%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 16.3%
Final simplification51.3%
(FPCore (a k m) :precision binary64 (if (<= m 6800000.0) (/ a (+ 1.0 (* k 10.0))) (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 6800000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * -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 <= 6800000.0d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 6800000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 6800000.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 6800000.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 6800000.0) tmp = a / (1.0 + (k * 10.0)); else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 6800000.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6800000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 6.8e6Initial program 97.3%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around 0 43.8%
*-commutative43.8%
Simplified43.8%
if 6.8e6 < 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 m around 0 2.9%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 16.3%
Final simplification35.4%
(FPCore (a k m) :precision binary64 (if (<= m 2100000000000.0) a (* (* k a) -10.0)))
double code(double a, double k, double m) {
double tmp;
if (m <= 2100000000000.0) {
tmp = a;
} else {
tmp = (k * a) * -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 <= 2100000000000.0d0) then
tmp = a
else
tmp = (k * a) * (-10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2100000000000.0) {
tmp = a;
} else {
tmp = (k * a) * -10.0;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2100000000000.0: tmp = a else: tmp = (k * a) * -10.0 return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2100000000000.0) tmp = a; else tmp = Float64(Float64(k * a) * -10.0); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2100000000000.0) tmp = a; else tmp = (k * a) * -10.0; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2100000000000.0], a, N[(N[(k * a), $MachinePrecision] * -10.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2100000000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(k \cdot a\right) \cdot -10\\
\end{array}
\end{array}
if m < 2.1e12Initial program 97.3%
associate-/l*97.2%
remove-double-neg97.2%
distribute-frac-neg297.2%
distribute-neg-frac297.2%
remove-double-neg97.2%
sqr-neg97.2%
associate-+l+97.2%
sqr-neg97.2%
distribute-rgt-out97.2%
Simplified97.2%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around 0 28.2%
if 2.1e12 < 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 m around 0 2.9%
Taylor expanded in k around 0 7.9%
Taylor expanded in k around inf 16.3%
Final simplification24.5%
(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 91.5%
associate-/l*91.4%
remove-double-neg91.4%
distribute-frac-neg291.4%
distribute-neg-frac291.4%
remove-double-neg91.4%
sqr-neg91.4%
associate-+l+91.4%
sqr-neg91.4%
distribute-rgt-out91.4%
Simplified91.4%
Taylor expanded in m around 0 47.8%
Taylor expanded in k around 0 20.7%
herbie shell --seed 2024146
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))