
(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 12 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 (<= m 5.4e-36) (* 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 <= 5.4e-36) {
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 <= 5.4d-36) 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 <= 5.4e-36) {
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 <= 5.4e-36: 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 <= 5.4e-36) tmp = Float64(a * Float64(Float64(-(k ^ m)) / Float64(-1.0 - Float64(k * Float64(k + 10.0))))); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.4e-36) 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, 5.4e-36], 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 5.4 \cdot 10^{-36}:\\
\;\;\;\;a \cdot \frac{-{k}^{m}}{-1 - k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 5.40000000000000015e-36Initial program 97.5%
sqr-neg97.5%
associate-+l+97.5%
sqr-neg97.5%
distribute-rgt-out97.5%
Simplified97.5%
frac-2neg97.5%
div-inv97.5%
distribute-rgt-neg-in97.5%
+-commutative97.5%
fma-def97.5%
+-commutative97.5%
Applied egg-rr97.5%
associate-*l*97.5%
associate-*r/97.5%
*-rgt-identity97.5%
fma-udef97.5%
+-commutative97.5%
distribute-neg-in97.5%
metadata-eval97.5%
sub-neg97.5%
Simplified97.5%
if 5.40000000000000015e-36 < m Initial program 80.6%
sqr-neg80.6%
associate-+l+80.6%
sqr-neg80.6%
distribute-rgt-out80.6%
Simplified80.6%
frac-2neg80.6%
div-inv80.6%
distribute-rgt-neg-in80.6%
+-commutative80.6%
fma-def80.6%
+-commutative80.6%
Applied egg-rr80.6%
associate-*r/80.6%
*-rgt-identity80.6%
distribute-rgt-neg-out80.6%
distribute-neg-frac80.6%
associate-/l*80.7%
distribute-neg-frac80.7%
fma-udef80.7%
+-commutative80.7%
distribute-neg-in80.7%
metadata-eval80.7%
sub-neg80.7%
Simplified80.7%
Taylor expanded in k around 0 100.0%
frac-2neg100.0%
div-inv100.0%
remove-double-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
pow-flip100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (a k m) :precision binary64 (if (<= m 5.4e-36) (/ (* a (pow k m)) (+ (* k (+ k 10.0)) 1.0)) (/ a (pow k (- m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.4e-36) {
tmp = (a * pow(k, m)) / ((k * (k + 10.0)) + 1.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 <= 5.4d-36) then
tmp = (a * (k ** m)) / ((k * (k + 10.0d0)) + 1.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 <= 5.4e-36) {
tmp = (a * Math.pow(k, m)) / ((k * (k + 10.0)) + 1.0);
} else {
tmp = a / Math.pow(k, -m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.4e-36: tmp = (a * math.pow(k, m)) / ((k * (k + 10.0)) + 1.0) else: tmp = a / math.pow(k, -m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.4e-36) tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 5.4e-36) tmp = (a * (k ^ m)) / ((k * (k + 10.0)) + 1.0); else tmp = a / (k ^ -m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.4e-36], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.4 \cdot 10^{-36}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < 5.40000000000000015e-36Initial program 97.5%
sqr-neg97.5%
associate-+l+97.5%
sqr-neg97.5%
distribute-rgt-out97.5%
Simplified97.5%
if 5.40000000000000015e-36 < m Initial program 80.6%
sqr-neg80.6%
associate-+l+80.6%
sqr-neg80.6%
distribute-rgt-out80.6%
Simplified80.6%
frac-2neg80.6%
div-inv80.6%
distribute-rgt-neg-in80.6%
+-commutative80.6%
fma-def80.6%
+-commutative80.6%
Applied egg-rr80.6%
associate-*r/80.6%
*-rgt-identity80.6%
distribute-rgt-neg-out80.6%
distribute-neg-frac80.6%
associate-/l*80.7%
distribute-neg-frac80.7%
fma-udef80.7%
+-commutative80.7%
distribute-neg-in80.7%
metadata-eval80.7%
sub-neg80.7%
Simplified80.7%
Taylor expanded in k around 0 100.0%
frac-2neg100.0%
div-inv100.0%
remove-double-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
pow-flip100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Final simplification98.3%
(FPCore (a k m)
:precision binary64
(if (<= m -1.45e-5)
(* a (pow k m))
(if (<= m 5.4e-36)
(* a (/ 1.0 (+ (* k (+ k 10.0)) 1.0)))
(/ a (pow k (- m))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-5) {
tmp = a * pow(k, m);
} else if (m <= 5.4e-36) {
tmp = a * (1.0 / ((k * (k + 10.0)) + 1.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.45d-5)) then
tmp = a * (k ** m)
else if (m <= 5.4d-36) then
tmp = a * (1.0d0 / ((k * (k + 10.0d0)) + 1.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.45e-5) {
tmp = a * Math.pow(k, m);
} else if (m <= 5.4e-36) {
tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0));
} else {
tmp = a / Math.pow(k, -m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.45e-5: tmp = a * math.pow(k, m) elif m <= 5.4e-36: tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0)) else: tmp = a / math.pow(k, -m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.45e-5) tmp = Float64(a * (k ^ m)); elseif (m <= 5.4e-36) tmp = Float64(a * Float64(1.0 / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); else tmp = Float64(a / (k ^ Float64(-m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.45e-5) tmp = a * (k ^ m); elseif (m <= 5.4e-36) tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0)); else tmp = a / (k ^ -m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.45e-5], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.4e-36], N[(a * N[(1.0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.45 \cdot 10^{-5}:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{elif}\;m \leq 5.4 \cdot 10^{-36}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\end{array}
\end{array}
if m < -1.45e-5Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
if -1.45e-5 < m < 5.40000000000000015e-36Initial program 94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
frac-2neg94.5%
div-inv94.6%
distribute-rgt-neg-in94.6%
+-commutative94.6%
fma-def94.6%
+-commutative94.6%
Applied egg-rr94.6%
associate-*l*94.6%
associate-*r/94.6%
*-rgt-identity94.6%
fma-udef94.6%
+-commutative94.6%
distribute-neg-in94.6%
metadata-eval94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in m around 0 94.1%
if 5.40000000000000015e-36 < m Initial program 80.6%
sqr-neg80.6%
associate-+l+80.6%
sqr-neg80.6%
distribute-rgt-out80.6%
Simplified80.6%
frac-2neg80.6%
div-inv80.6%
distribute-rgt-neg-in80.6%
+-commutative80.6%
fma-def80.6%
+-commutative80.6%
Applied egg-rr80.6%
associate-*r/80.6%
*-rgt-identity80.6%
distribute-rgt-neg-out80.6%
distribute-neg-frac80.6%
associate-/l*80.7%
distribute-neg-frac80.7%
fma-udef80.7%
+-commutative80.7%
distribute-neg-in80.7%
metadata-eval80.7%
sub-neg80.7%
Simplified80.7%
Taylor expanded in k around 0 100.0%
frac-2neg100.0%
div-inv100.0%
remove-double-neg100.0%
distribute-neg-frac100.0%
metadata-eval100.0%
pow-flip100.0%
Applied egg-rr100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (or (<= m -4.4e-10) (not (<= m 5.4e-36))) (* a (pow k m)) (* a (/ 1.0 (+ (* k (+ k 10.0)) 1.0)))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -4.4e-10) || !(m <= 5.4e-36)) {
tmp = a * pow(k, m);
} else {
tmp = a * (1.0 / ((k * (k + 10.0)) + 1.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.4d-10)) .or. (.not. (m <= 5.4d-36))) then
tmp = a * (k ** m)
else
tmp = a * (1.0d0 / ((k * (k + 10.0d0)) + 1.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -4.4e-10) || !(m <= 5.4e-36)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -4.4e-10) or not (m <= 5.4e-36): tmp = a * math.pow(k, m) else: tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0)) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -4.4e-10) || !(m <= 5.4e-36)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(1.0 / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -4.4e-10) || ~((m <= 5.4e-36))) tmp = a * (k ^ m); else tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -4.4e-10], N[Not[LessEqual[m, 5.4e-36]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.4 \cdot 10^{-10} \lor \neg \left(m \leq 5.4 \cdot 10^{-36}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot \left(k + 10\right) + 1}\\
\end{array}
\end{array}
if m < -4.3999999999999998e-10 or 5.40000000000000015e-36 < m Initial program 90.5%
sqr-neg90.5%
associate-+l+90.5%
sqr-neg90.5%
distribute-rgt-out90.5%
Simplified90.5%
Taylor expanded in k around 0 100.0%
if -4.3999999999999998e-10 < m < 5.40000000000000015e-36Initial program 94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
frac-2neg94.5%
div-inv94.6%
distribute-rgt-neg-in94.6%
+-commutative94.6%
fma-def94.6%
+-commutative94.6%
Applied egg-rr94.6%
associate-*l*94.6%
associate-*r/94.6%
*-rgt-identity94.6%
fma-udef94.6%
+-commutative94.6%
distribute-neg-in94.6%
metadata-eval94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in m around 0 94.1%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (if (<= k -2e-310) (* a (/ -0.1 k)) (if (<= k 0.075) (+ a (* -10.0 (* a k))) (/ 0.1 (/ k a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 0.1 / (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 (k <= (-2d-310)) then
tmp = a * ((-0.1d0) / k)
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2e-310: tmp = a * (-0.1 / k) elif k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2e-310) tmp = Float64(a * Float64(-0.1 / k)); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2e-310) tmp = a * (-0.1 / k); elseif (k <= 0.075) tmp = a + (-10.0 * (a * k)); else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2e-310], N[(a * N[(-0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-310}:\\
\;\;\;\;a \cdot \frac{-0.1}{k}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < -1.999999999999994e-310Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 23.3%
Taylor expanded in k around 0 13.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in k around inf 12.5%
metadata-eval12.5%
times-frac12.5%
*-un-lft-identity12.5%
*-commutative12.5%
expm1-log1p-u12.1%
expm1-udef30.3%
frac-2neg30.3%
add-sqr-sqrt15.9%
sqrt-unprod40.4%
sqr-neg40.4%
sqrt-unprod19.1%
add-sqr-sqrt34.9%
distribute-rgt-neg-in34.9%
metadata-eval34.9%
Applied egg-rr34.9%
expm1-def16.9%
expm1-log1p20.2%
*-rgt-identity20.2%
associate-*r/20.2%
*-commutative20.2%
associate-/r*20.2%
metadata-eval20.2%
Simplified20.2%
if -1.999999999999994e-310 < k < 0.0749999999999999972Initial program 99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 44.3%
Taylor expanded in k around 0 43.7%
if 0.0749999999999999972 < k Initial program 87.3%
sqr-neg87.3%
associate-+l+87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
Simplified87.3%
Taylor expanded in m around 0 62.1%
Taylor expanded in k around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in k around inf 24.3%
associate-*r/24.3%
associate-/l*26.2%
Applied egg-rr26.2%
Final simplification31.2%
(FPCore (a k m) :precision binary64 (* a (/ 1.0 (+ (* k (+ k 10.0)) 1.0))))
double code(double a, double k, double m) {
return a * (1.0 / ((k * (k + 10.0)) + 1.0));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a * (1.0d0 / ((k * (k + 10.0d0)) + 1.0d0))
end function
public static double code(double a, double k, double m) {
return a * (1.0 / ((k * (k + 10.0)) + 1.0));
}
def code(a, k, m): return a * (1.0 / ((k * (k + 10.0)) + 1.0))
function code(a, k, m) return Float64(a * Float64(1.0 / Float64(Float64(k * Float64(k + 10.0)) + 1.0))) end
function tmp = code(a, k, m) tmp = a * (1.0 / ((k * (k + 10.0)) + 1.0)); end
code[a_, k_, m_] := N[(a * N[(1.0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot \frac{1}{k \cdot \left(k + 10\right) + 1}
\end{array}
Initial program 91.7%
sqr-neg91.7%
associate-+l+91.7%
sqr-neg91.7%
distribute-rgt-out91.7%
Simplified91.7%
frac-2neg91.7%
div-inv91.7%
distribute-rgt-neg-in91.7%
+-commutative91.7%
fma-def91.7%
+-commutative91.7%
Applied egg-rr91.7%
associate-*l*91.7%
associate-*r/91.7%
*-rgt-identity91.7%
fma-udef91.7%
+-commutative91.7%
distribute-neg-in91.7%
metadata-eval91.7%
sub-neg91.7%
Simplified91.7%
Taylor expanded in m around 0 44.6%
Final simplification44.6%
(FPCore (a k m) :precision binary64 (if (<= k -2e-310) (* a (/ -0.1 k)) (if (<= k 0.1) a (* 0.1 (/ a k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 * (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 (k <= (-2d-310)) then
tmp = a * ((-0.1d0) / k)
else if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2e-310: tmp = a * (-0.1 / k) elif k <= 0.1: tmp = a else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2e-310) tmp = Float64(a * Float64(-0.1 / k)); elseif (k <= 0.1) tmp = a; else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2e-310) tmp = a * (-0.1 / k); elseif (k <= 0.1) tmp = a; else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2e-310], N[(a * N[(-0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], a, N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-310}:\\
\;\;\;\;a \cdot \frac{-0.1}{k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < -1.999999999999994e-310Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 23.3%
Taylor expanded in k around 0 13.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in k around inf 12.5%
metadata-eval12.5%
times-frac12.5%
*-un-lft-identity12.5%
*-commutative12.5%
expm1-log1p-u12.1%
expm1-udef30.3%
frac-2neg30.3%
add-sqr-sqrt15.9%
sqrt-unprod40.4%
sqr-neg40.4%
sqrt-unprod19.1%
add-sqr-sqrt34.9%
distribute-rgt-neg-in34.9%
metadata-eval34.9%
Applied egg-rr34.9%
expm1-def16.9%
expm1-log1p20.2%
*-rgt-identity20.2%
associate-*r/20.2%
*-commutative20.2%
associate-/r*20.2%
metadata-eval20.2%
Simplified20.2%
if -1.999999999999994e-310 < k < 0.10000000000000001Initial program 99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 44.3%
Taylor expanded in k around 0 43.6%
if 0.10000000000000001 < k Initial program 87.3%
sqr-neg87.3%
associate-+l+87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
Simplified87.3%
Taylor expanded in m around 0 62.1%
Taylor expanded in k around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in k around inf 24.3%
Final simplification30.5%
(FPCore (a k m) :precision binary64 (if (<= k -2e-310) (* a (/ -0.1 k)) (if (<= k 0.1) a (/ 0.1 (/ k a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (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 (k <= (-2d-310)) then
tmp = a * ((-0.1d0) / k)
else if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2e-310) {
tmp = a * (-0.1 / k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2e-310: tmp = a * (-0.1 / k) elif k <= 0.1: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2e-310) tmp = Float64(a * Float64(-0.1 / k)); elseif (k <= 0.1) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2e-310) tmp = a * (-0.1 / k); elseif (k <= 0.1) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2e-310], N[(a * N[(-0.1 / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-310}:\\
\;\;\;\;a \cdot \frac{-0.1}{k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < -1.999999999999994e-310Initial program 85.9%
sqr-neg85.9%
associate-+l+85.9%
sqr-neg85.9%
distribute-rgt-out85.9%
Simplified85.9%
Taylor expanded in m around 0 23.3%
Taylor expanded in k around 0 13.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in k around inf 12.5%
metadata-eval12.5%
times-frac12.5%
*-un-lft-identity12.5%
*-commutative12.5%
expm1-log1p-u12.1%
expm1-udef30.3%
frac-2neg30.3%
add-sqr-sqrt15.9%
sqrt-unprod40.4%
sqr-neg40.4%
sqrt-unprod19.1%
add-sqr-sqrt34.9%
distribute-rgt-neg-in34.9%
metadata-eval34.9%
Applied egg-rr34.9%
expm1-def16.9%
expm1-log1p20.2%
*-rgt-identity20.2%
associate-*r/20.2%
*-commutative20.2%
associate-/r*20.2%
metadata-eval20.2%
Simplified20.2%
if -1.999999999999994e-310 < k < 0.10000000000000001Initial program 99.9%
sqr-neg99.9%
associate-+l+99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
Simplified99.9%
Taylor expanded in m around 0 44.3%
Taylor expanded in k around 0 43.6%
if 0.10000000000000001 < k Initial program 87.3%
sqr-neg87.3%
associate-+l+87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
Simplified87.3%
Taylor expanded in m around 0 62.1%
Taylor expanded in k around 0 24.3%
*-commutative24.3%
Simplified24.3%
Taylor expanded in k around inf 24.3%
associate-*r/24.3%
associate-/l*26.2%
Applied egg-rr26.2%
Final simplification31.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.25) (/ 0.1 (/ k a)) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.25) {
tmp = 0.1 / (k / a);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.25d0)) then
tmp = 0.1d0 / (k / a)
else
tmp = a / (1.0d0 + (k * 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.25) {
tmp = 0.1 / (k / a);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.25: tmp = 0.1 / (k / a) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.25) tmp = Float64(0.1 / Float64(k / a)); else tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.25) tmp = 0.1 / (k / a); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.25], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.25:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -0.25Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 39.1%
Taylor expanded in k around 0 22.0%
*-commutative22.0%
Simplified22.0%
Taylor expanded in k around inf 28.1%
associate-*r/28.1%
associate-/l*29.4%
Applied egg-rr29.4%
if -0.25 < m Initial program 87.2%
sqr-neg87.2%
associate-+l+87.2%
sqr-neg87.2%
distribute-rgt-out87.2%
Simplified87.2%
Taylor expanded in m around 0 47.6%
Taylor expanded in k around 0 32.3%
*-commutative32.3%
Simplified32.3%
Final simplification31.3%
(FPCore (a k m) :precision binary64 (/ a (+ (* k (+ k 10.0)) 1.0)))
double code(double a, double k, double m) {
return a / ((k * (k + 10.0)) + 1.0);
}
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 * (k + 10.0d0)) + 1.0d0)
end function
public static double code(double a, double k, double m) {
return a / ((k * (k + 10.0)) + 1.0);
}
def code(a, k, m): return a / ((k * (k + 10.0)) + 1.0)
function code(a, k, m) return Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)) end
function tmp = code(a, k, m) tmp = a / ((k * (k + 10.0)) + 1.0); end
code[a_, k_, m_] := N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a}{k \cdot \left(k + 10\right) + 1}
\end{array}
Initial program 91.7%
sqr-neg91.7%
associate-+l+91.7%
sqr-neg91.7%
distribute-rgt-out91.7%
Simplified91.7%
Taylor expanded in m around 0 44.6%
Final simplification44.6%
(FPCore (a k m) :precision binary64 (if (<= m -0.00295) (* 0.1 (/ a k)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.00295) {
tmp = 0.1 * (a / k);
} else {
tmp = 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.00295d0)) then
tmp = 0.1d0 * (a / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.00295) {
tmp = 0.1 * (a / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.00295: tmp = 0.1 * (a / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.00295) tmp = Float64(0.1 * Float64(a / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.00295) tmp = 0.1 * (a / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.00295], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00295:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -0.00294999999999999993Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 39.1%
Taylor expanded in k around 0 22.0%
*-commutative22.0%
Simplified22.0%
Taylor expanded in k around inf 28.1%
if -0.00294999999999999993 < m Initial program 87.2%
sqr-neg87.2%
associate-+l+87.2%
sqr-neg87.2%
distribute-rgt-out87.2%
Simplified87.2%
Taylor expanded in m around 0 47.6%
Taylor expanded in k around 0 27.1%
Final simplification27.4%
(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.7%
sqr-neg91.7%
associate-+l+91.7%
sqr-neg91.7%
distribute-rgt-out91.7%
Simplified91.7%
Taylor expanded in m around 0 44.6%
Taylor expanded in k around 0 19.0%
Final simplification19.0%
herbie shell --seed 2023301
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))