
(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 (if (or (<= m -490.0) (not (<= m 2.3e-26))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -490.0) || !(m <= 2.3e-26)) {
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 <= (-490.0d0)) .or. (.not. (m <= 2.3d-26))) 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 <= -490.0) || !(m <= 2.3e-26)) {
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 <= -490.0) or not (m <= 2.3e-26): 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 <= -490.0) || !(m <= 2.3e-26)) 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 <= -490.0) || ~((m <= 2.3e-26))) 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, -490.0], N[Not[LessEqual[m, 2.3e-26]], $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 -490 \lor \neg \left(m \leq 2.3 \cdot 10^{-26}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -490 or 2.30000000000000009e-26 < m Initial program 91.6%
associate-/l*91.6%
remove-double-neg91.6%
distribute-frac-neg291.6%
distribute-neg-frac291.6%
remove-double-neg91.6%
sqr-neg91.6%
associate-+l+91.6%
sqr-neg91.6%
distribute-rgt-out91.6%
Simplified91.6%
Taylor expanded in k around 0 100.0%
if -490 < m < 2.30000000000000009e-26Initial program 93.8%
associate-/l*93.7%
remove-double-neg93.7%
distribute-frac-neg293.7%
distribute-neg-frac293.7%
remove-double-neg93.7%
sqr-neg93.7%
associate-+l+93.7%
sqr-neg93.7%
distribute-rgt-out93.7%
Simplified93.7%
Taylor expanded in m around 0 93.8%
Final simplification98.1%
(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 (+ 1.0 (* 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 * (1.0 + (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 * (1.0 + (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 * (1.0 + (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(1.0 + 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 * (1.0 + (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[(1.0 + 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 \cdot \left(1 + 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.0%
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 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 2.3e-26) (* 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.3e-26) {
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.3d-26) 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.3e-26) {
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.3e-26: 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.3e-26) 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.3e-26) 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.3e-26], 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.3 \cdot 10^{-26}:\\
\;\;\;\;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.30000000000000009e-26Initial 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%
if 2.30000000000000009e-26 < m Initial program 85.1%
associate-/l*85.1%
remove-double-neg85.1%
distribute-frac-neg285.1%
distribute-neg-frac285.1%
remove-double-neg85.1%
sqr-neg85.1%
associate-+l+85.1%
sqr-neg85.1%
distribute-rgt-out85.1%
Simplified85.1%
Taylor expanded in k around 0 100.0%
Final simplification98.1%
(FPCore (a k m) :precision binary64 (if (<= m 4.3e-50) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (- (* k 99.0) 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.3e-50) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (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 <= 4.3d-50) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (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 <= 4.3e-50) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 4.3e-50: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 4.3e-50) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + 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 <= 4.3e-50) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 4.3e-50], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.3 \cdot 10^{-50}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\end{array}
\end{array}
if m < 4.29999999999999997e-50Initial program 96.8%
associate-/l*96.8%
remove-double-neg96.8%
distribute-frac-neg296.8%
distribute-neg-frac296.8%
remove-double-neg96.8%
sqr-neg96.8%
associate-+l+96.8%
sqr-neg96.8%
distribute-rgt-out96.8%
Simplified96.8%
Taylor expanded in m around 0 63.1%
if 4.29999999999999997e-50 < m Initial program 85.7%
associate-/l*85.7%
remove-double-neg85.7%
distribute-frac-neg285.7%
distribute-neg-frac285.7%
remove-double-neg85.7%
sqr-neg85.7%
associate-+l+85.7%
sqr-neg85.7%
distribute-rgt-out85.7%
Simplified85.7%
Taylor expanded in m around 0 8.8%
Taylor expanded in k around 0 27.0%
Final simplification48.3%
(FPCore (a k m) :precision binary64 (if (<= m -1.35e-65) (* 0.1 (/ a k)) (if (<= m 1.9e+62) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.35e-65) {
tmp = 0.1 * (a / k);
} else if (m <= 1.9e+62) {
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 <= (-1.35d-65)) then
tmp = 0.1d0 * (a / k)
else if (m <= 1.9d+62) 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 <= -1.35e-65) {
tmp = 0.1 * (a / k);
} else if (m <= 1.9e+62) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.35e-65: tmp = 0.1 * (a / k) elif m <= 1.9e+62: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.35e-65) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 1.9e+62) 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 <= -1.35e-65) tmp = 0.1 * (a / k); elseif (m <= 1.9e+62) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.35e-65], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9e+62], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.35 \cdot 10^{-65}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 1.9 \cdot 10^{+62}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.3499999999999999e-65Initial program 98.9%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in m around 0 38.9%
Taylor expanded in k around inf 38.9%
associate-*r/38.9%
metadata-eval38.9%
Simplified38.9%
Taylor expanded in k around 0 18.2%
Taylor expanded in k around inf 19.1%
if -1.3499999999999999e-65 < m < 1.89999999999999992e62Initial program 93.2%
associate-/l*93.1%
remove-double-neg93.1%
distribute-frac-neg293.1%
distribute-neg-frac293.1%
remove-double-neg93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 79.9%
Taylor expanded in k around 0 46.5%
if 1.89999999999999992e62 < m Initial program 84.7%
associate-/l*84.7%
remove-double-neg84.7%
distribute-frac-neg284.7%
distribute-neg-frac284.7%
remove-double-neg84.7%
sqr-neg84.7%
associate-+l+84.7%
sqr-neg84.7%
distribute-rgt-out84.7%
Simplified84.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 10.1%
*-commutative10.1%
Simplified10.1%
Taylor expanded in k around inf 23.5%
(FPCore (a k m) :precision binary64 (if (<= m 0.78) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.78) {
tmp = a / (1.0 + (k * (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 <= 0.78d0) then
tmp = a / (1.0d0 + (k * (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 <= 0.78) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.78: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.78) tmp = Float64(a / Float64(1.0 + Float64(k * 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 <= 0.78) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.78], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.78:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 0.78000000000000003Initial program 97.0%
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 64.2%
if 0.78000000000000003 < m Initial program 84.7%
associate-/l*84.7%
remove-double-neg84.7%
distribute-frac-neg284.7%
distribute-neg-frac284.7%
remove-double-neg84.7%
sqr-neg84.7%
associate-+l+84.7%
sqr-neg84.7%
distribute-rgt-out84.7%
Simplified84.7%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.1%
*-commutative9.1%
Simplified9.1%
Taylor expanded in k around inf 20.8%
Final simplification47.6%
(FPCore (a k m) :precision binary64 (if (<= m 1.8) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.8) {
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 <= 1.8d0) 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 <= 1.8) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.8: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.8) 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 <= 1.8) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.8], 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 1.8:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.80000000000000004Initial program 97.0%
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 64.2%
Taylor expanded in k around inf 63.5%
if 1.80000000000000004 < m Initial program 84.7%
associate-/l*84.7%
remove-double-neg84.7%
distribute-frac-neg284.7%
distribute-neg-frac284.7%
remove-double-neg84.7%
sqr-neg84.7%
associate-+l+84.7%
sqr-neg84.7%
distribute-rgt-out84.7%
Simplified84.7%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.1%
*-commutative9.1%
Simplified9.1%
Taylor expanded in k around inf 20.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.15) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.15) {
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 <= 1.15d0) 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 <= 1.15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.15: 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 <= 1.15) 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 <= 1.15) 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, 1.15], 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 1.15:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.1499999999999999Initial program 97.0%
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 64.2%
Taylor expanded in k around 0 38.9%
*-commutative38.9%
Simplified38.9%
if 1.1499999999999999 < m Initial program 84.7%
associate-/l*84.7%
remove-double-neg84.7%
distribute-frac-neg284.7%
distribute-neg-frac284.7%
remove-double-neg84.7%
sqr-neg84.7%
associate-+l+84.7%
sqr-neg84.7%
distribute-rgt-out84.7%
Simplified84.7%
Taylor expanded in m around 0 3.1%
Taylor expanded in k around 0 9.1%
*-commutative9.1%
Simplified9.1%
Taylor expanded in k around inf 20.8%
(FPCore (a k m) :precision binary64 (if (<= m 1.9e+62) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.9e+62) {
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 <= 1.9d+62) 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 <= 1.9e+62) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.9e+62: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.9e+62) 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 <= 1.9e+62) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.9e+62], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.9 \cdot 10^{+62}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.89999999999999992e62Initial program 96.0%
associate-/l*96.0%
remove-double-neg96.0%
distribute-frac-neg296.0%
distribute-neg-frac296.0%
remove-double-neg96.0%
sqr-neg96.0%
associate-+l+96.0%
sqr-neg96.0%
distribute-rgt-out96.0%
Simplified96.0%
Taylor expanded in m around 0 59.5%
Taylor expanded in k around 0 25.8%
if 1.89999999999999992e62 < m Initial program 84.7%
associate-/l*84.7%
remove-double-neg84.7%
distribute-frac-neg284.7%
distribute-neg-frac284.7%
remove-double-neg84.7%
sqr-neg84.7%
associate-+l+84.7%
sqr-neg84.7%
distribute-rgt-out84.7%
Simplified84.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 10.1%
*-commutative10.1%
Simplified10.1%
Taylor expanded in k around inf 23.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 92.3%
associate-/l*92.3%
remove-double-neg92.3%
distribute-frac-neg292.3%
distribute-neg-frac292.3%
remove-double-neg92.3%
sqr-neg92.3%
associate-+l+92.3%
sqr-neg92.3%
distribute-rgt-out92.3%
Simplified92.3%
Taylor expanded in m around 0 40.8%
Taylor expanded in k around 0 18.5%
herbie shell --seed 2024141
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))