
(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)) (+ (+ 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 99.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 85.7%
cancel-sign-sub-inv85.7%
mul-1-neg85.7%
distribute-rgt-neg-in85.7%
distribute-rgt1-in85.7%
distribute-lft-neg-in85.7%
metadata-eval85.7%
metadata-eval85.7%
metadata-eval85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in a around 0 100.0%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (if (<= m 7.5e-17) (* 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 <= 7.5e-17) {
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 <= 7.5d-17) 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 <= 7.5e-17) {
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 <= 7.5e-17: 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 <= 7.5e-17) 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 <= 7.5e-17) 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, 7.5e-17], 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 7.5 \cdot 10^{-17}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
if 7.49999999999999984e-17 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in k around 0 100.0%
Final simplification99.9%
(FPCore (a k m) :precision binary64 (if (<= m 7.5e-17) (* a (/ (pow k m) (+ 1.0 (* k k)))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.5e-17) {
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 <= 7.5d-17) 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 <= 7.5e-17) {
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 <= 7.5e-17: 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 <= 7.5e-17) 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 <= 7.5e-17) 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, 7.5e-17], 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 7.5 \cdot 10^{-17}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in k around inf 98.6%
if 7.49999999999999984e-17 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in k around 0 100.0%
(FPCore (a k m) :precision binary64 (if (or (<= m -22000000000.0) (not (<= m 7.5e-17))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -22000000000.0) || !(m <= 7.5e-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 <= (-22000000000.0d0)) .or. (.not. (m <= 7.5d-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 <= -22000000000.0) || !(m <= 7.5e-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 <= -22000000000.0) or not (m <= 7.5e-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 <= -22000000000.0) || !(m <= 7.5e-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 <= -22000000000.0) || ~((m <= 7.5e-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, -22000000000.0], N[Not[LessEqual[m, 7.5e-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 -22000000000 \lor \neg \left(m \leq 7.5 \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 < -2.2e10 or 7.49999999999999984e-17 < m Initial program 88.1%
associate-/l*88.1%
remove-double-neg88.1%
distribute-frac-neg288.1%
distribute-neg-frac288.1%
remove-double-neg88.1%
sqr-neg88.1%
associate-+l+88.1%
sqr-neg88.1%
distribute-rgt-out88.1%
Simplified88.1%
Taylor expanded in k around 0 100.0%
if -2.2e10 < m < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.8%
remove-double-neg99.8%
distribute-frac-neg299.8%
distribute-neg-frac299.8%
remove-double-neg99.8%
sqr-neg99.8%
associate-+l+99.8%
sqr-neg99.8%
distribute-rgt-out99.8%
Simplified99.8%
Taylor expanded in m around 0 99.5%
Final simplification99.8%
(FPCore (a k m) :precision binary64 (if (<= m 7.5e-17) (/ 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 <= 7.5e-17) {
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 <= 7.5d-17) 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 <= 7.5e-17) {
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 <= 7.5e-17: 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 <= 7.5e-17) 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 <= 7.5e-17) 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, 7.5e-17], 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 7.5 \cdot 10^{-17}:\\
\;\;\;\;\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 < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 67.8%
if 7.49999999999999984e-17 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 4.7%
Taylor expanded in k around 0 27.6%
cancel-sign-sub-inv27.6%
mul-1-neg27.6%
distribute-rgt-neg-in27.6%
distribute-rgt1-in27.6%
distribute-lft-neg-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in a around 0 30.9%
Final simplification55.1%
(FPCore (a k m) :precision binary64 (if (<= m 7.5e-17) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.5e-17) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.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 <= 7.5d-17) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.5e-17) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.5e-17: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.5e-17) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.5e-17) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.5e-17], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 67.8%
if 7.49999999999999984e-17 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 4.7%
Taylor expanded in k around 0 27.6%
cancel-sign-sub-inv27.6%
mul-1-neg27.6%
distribute-rgt-neg-in27.6%
distribute-rgt1-in27.6%
distribute-lft-neg-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in k around inf 26.6%
Taylor expanded in k around inf 27.6%
Final simplification53.9%
(FPCore (a k m) :precision binary64 (if (<= m 7.5e-17) (/ a (+ 1.0 (* k k))) (+ a (* k (* 99.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.5e-17) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (99.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 <= 7.5d-17) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (99.0d0 * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.5e-17) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (99.0 * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.5e-17: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (99.0 * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.5e-17) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(99.0 * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.5e-17) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (99.0 * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.5e-17], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(99.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.5 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(99 \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < 7.49999999999999984e-17Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 67.8%
Taylor expanded in k around inf 66.4%
if 7.49999999999999984e-17 < m Initial program 77.2%
associate-/l*77.2%
remove-double-neg77.2%
distribute-frac-neg277.2%
distribute-neg-frac277.2%
remove-double-neg77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in m around 0 4.7%
Taylor expanded in k around 0 27.6%
cancel-sign-sub-inv27.6%
mul-1-neg27.6%
distribute-rgt-neg-in27.6%
distribute-rgt1-in27.6%
distribute-lft-neg-in27.6%
metadata-eval27.6%
metadata-eval27.6%
metadata-eval27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in k around inf 26.6%
Taylor expanded in k around inf 27.6%
(FPCore (a k m) :precision binary64 (if (<= m 175000000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 175000000000.0) {
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 <= 175000000000.0d0) 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 <= 175000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 175000000000.0: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 175000000000.0) 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 <= 175000000000.0) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 175000000000.0], 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 175000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.75e11Initial program 99.3%
associate-/l*99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
distribute-neg-frac299.3%
remove-double-neg99.3%
sqr-neg99.3%
associate-+l+99.3%
sqr-neg99.3%
distribute-rgt-out99.3%
Simplified99.3%
Taylor expanded in m around 0 66.8%
Taylor expanded in k around inf 65.5%
if 1.75e11 < m Initial program 77.1%
associate-/l*77.1%
remove-double-neg77.1%
distribute-frac-neg277.1%
distribute-neg-frac277.1%
remove-double-neg77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 11.0%
Taylor expanded in k around inf 20.5%
*-commutative20.5%
Simplified20.5%
Final simplification50.9%
(FPCore (a k m) :precision binary64 (if (<= m 170000000000.0) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 170000000000.0) {
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 <= 170000000000.0d0) 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 <= 170000000000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 170000000000.0: 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 <= 170000000000.0) 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 <= 170000000000.0) 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, 170000000000.0], 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 170000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.7e11Initial program 99.3%
associate-/l*99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
distribute-neg-frac299.3%
remove-double-neg99.3%
sqr-neg99.3%
associate-+l+99.3%
sqr-neg99.3%
distribute-rgt-out99.3%
Simplified99.3%
Taylor expanded in m around 0 66.8%
Taylor expanded in k around 0 47.1%
*-commutative47.1%
Simplified47.1%
if 1.7e11 < m Initial program 77.1%
associate-/l*77.1%
remove-double-neg77.1%
distribute-frac-neg277.1%
distribute-neg-frac277.1%
remove-double-neg77.1%
sqr-neg77.1%
associate-+l+77.1%
sqr-neg77.1%
distribute-rgt-out77.1%
Simplified77.1%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 11.0%
Taylor expanded in k around inf 20.5%
*-commutative20.5%
Simplified20.5%
Final simplification38.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.1e+43) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+43) {
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.1d+43) 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.1e+43) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.1e+43: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.1e+43) 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.1e+43) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.1e+43], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{+43}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.1e43Initial program 98.8%
associate-/l*98.8%
remove-double-neg98.8%
distribute-frac-neg298.8%
distribute-neg-frac298.8%
remove-double-neg98.8%
sqr-neg98.8%
associate-+l+98.8%
sqr-neg98.8%
distribute-rgt-out98.8%
Simplified98.8%
Taylor expanded in m around 0 65.0%
Taylor expanded in k around 0 29.8%
if 1.1e43 < m Initial program 76.9%
associate-/l*76.9%
remove-double-neg76.9%
distribute-frac-neg276.9%
distribute-neg-frac276.9%
remove-double-neg76.9%
sqr-neg76.9%
associate-+l+76.9%
sqr-neg76.9%
distribute-rgt-out76.9%
Simplified76.9%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 11.6%
Taylor expanded in k around inf 21.7%
*-commutative21.7%
Simplified21.7%
Final simplification27.3%
(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.1%
associate-/l*92.1%
remove-double-neg92.1%
distribute-frac-neg292.1%
distribute-neg-frac292.1%
remove-double-neg92.1%
sqr-neg92.1%
associate-+l+92.1%
sqr-neg92.1%
distribute-rgt-out92.1%
Simplified92.1%
Taylor expanded in m around 0 46.1%
Taylor expanded in k around 0 21.9%
herbie shell --seed 2024139
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))