
(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 18 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 (hypot k (sqrt (fma k 10.0 1.0)))) (t_1 (* (pow k m) a)))
(if (<= m -2.55e-14)
(/ t_1 (+ (+ 1.0 (* k 10.0)) (* k k)))
(if (<= m 0.009) (/ (/ a t_0) t_0) t_1))))
double code(double a, double k, double m) {
double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double t_1 = pow(k, m) * a;
double tmp;
if (m <= -2.55e-14) {
tmp = t_1 / ((1.0 + (k * 10.0)) + (k * k));
} else if (m <= 0.009) {
tmp = (a / t_0) / t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(a, k, m) t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0))) t_1 = Float64((k ^ m) * a) tmp = 0.0 if (m <= -2.55e-14) tmp = Float64(t_1 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); elseif (m <= 0.009) tmp = Float64(Float64(a / t_0) / t_0); else tmp = t_1; end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[m, -2.55e-14], N[(t$95$1 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.009], N[(N[(a / t$95$0), $MachinePrecision] / t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
t_1 := {k}^{m} \cdot a\\
\mathbf{if}\;m \leq -2.55 \cdot 10^{-14}:\\
\;\;\;\;\frac{t_1}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{elif}\;m \leq 0.009:\\
\;\;\;\;\frac{\frac{a}{t_0}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if m < -2.5499999999999999e-14Initial program 100.0%
if -2.5499999999999999e-14 < m < 0.00899999999999999932Initial program 90.8%
associate-*r/90.8%
*-commutative90.8%
sqr-neg90.8%
associate-+l+90.8%
+-commutative90.8%
sqr-neg90.8%
distribute-rgt-out90.8%
fma-def90.8%
+-commutative90.8%
Simplified90.8%
Taylor expanded in m around 0 90.8%
*-un-lft-identity90.8%
distribute-rgt-in90.8%
associate-+l+90.8%
add-sqr-sqrt90.8%
times-frac90.8%
+-commutative90.8%
add-sqr-sqrt90.8%
hypot-def90.8%
+-commutative90.8%
*-commutative90.8%
fma-def90.8%
+-commutative90.8%
add-sqr-sqrt90.8%
hypot-def99.6%
Applied egg-rr99.6%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
if 0.00899999999999999932 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in k around 0 100.0%
Final simplification99.8%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (hypot k (sqrt (fma k 10.0 1.0)))))
(if (<= k 1e-10)
(* (* (fma k -10.0 1.0) (pow k m)) a)
(* (/ (pow k m) t_0) (/ a t_0)))))
double code(double a, double k, double m) {
double t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0)));
double tmp;
if (k <= 1e-10) {
tmp = (fma(k, -10.0, 1.0) * pow(k, m)) * a;
} else {
tmp = (pow(k, m) / t_0) * (a / t_0);
}
return tmp;
}
function code(a, k, m) t_0 = hypot(k, sqrt(fma(k, 10.0, 1.0))) tmp = 0.0 if (k <= 1e-10) tmp = Float64(Float64(fma(k, -10.0, 1.0) * (k ^ m)) * a); else tmp = Float64(Float64((k ^ m) / t_0) * Float64(a / t_0)); end return tmp end
code[a_, k_, m_] := Block[{t$95$0 = N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[k, 1e-10], N[(N[(N[(k * -10.0 + 1.0), $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(a / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)\\
\mathbf{if}\;k \leq 10^{-10}:\\
\;\;\;\;\left(\mathsf{fma}\left(k, -10, 1\right) \cdot {k}^{m}\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{t_0} \cdot \frac{a}{t_0}\\
\end{array}
\end{array}
if k < 1.00000000000000004e-10Initial program 95.6%
associate-*r/95.6%
*-commutative95.6%
sqr-neg95.6%
associate-+l+95.6%
+-commutative95.6%
sqr-neg95.6%
distribute-rgt-out95.6%
fma-def95.6%
+-commutative95.6%
Simplified95.6%
Taylor expanded in k around 0 86.2%
associate-*r*86.2%
distribute-lft1-in100.0%
*-commutative100.0%
fma-def100.0%
Simplified100.0%
if 1.00000000000000004e-10 < k Initial program 80.9%
add-cube-cbrt80.8%
pow380.8%
*-commutative80.8%
Applied egg-rr80.8%
unpow380.8%
add-cube-cbrt80.9%
add-sqr-sqrt80.9%
times-frac80.9%
+-commutative80.9%
add-sqr-sqrt80.9%
hypot-def80.9%
+-commutative80.9%
*-commutative80.9%
fma-def80.9%
+-commutative80.9%
add-sqr-sqrt80.9%
Applied egg-rr95.8%
Final simplification98.4%
(FPCore (a k m) :precision binary64 (if (<= k 0.096) (* (* (fma k -10.0 1.0) (pow k m)) a) (* (/ (pow k m) (hypot k (sqrt (fma k 10.0 1.0)))) (/ a k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.096) {
tmp = (fma(k, -10.0, 1.0) * pow(k, m)) * a;
} else {
tmp = (pow(k, m) / hypot(k, sqrt(fma(k, 10.0, 1.0)))) * (a / k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 0.096) tmp = Float64(Float64(fma(k, -10.0, 1.0) * (k ^ m)) * a); else tmp = Float64(Float64((k ^ m) / hypot(k, sqrt(fma(k, 10.0, 1.0)))) * Float64(a / k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 0.096], N[(N[(N[(k * -10.0 + 1.0), $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] / N[Sqrt[k ^ 2 + N[Sqrt[N[(k * 10.0 + 1.0), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.096:\\
\;\;\;\;\left(\mathsf{fma}\left(k, -10, 1\right) \cdot {k}^{m}\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m}}{\mathsf{hypot}\left(k, \sqrt{\mathsf{fma}\left(k, 10, 1\right)}\right)} \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 0.096000000000000002Initial program 95.7%
associate-*r/95.7%
*-commutative95.7%
sqr-neg95.7%
associate-+l+95.7%
+-commutative95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in k around 0 85.8%
associate-*r*85.8%
distribute-lft1-in99.2%
*-commutative99.2%
fma-def99.2%
Simplified99.2%
if 0.096000000000000002 < k Initial program 80.1%
add-cube-cbrt80.0%
pow380.0%
*-commutative80.0%
Applied egg-rr80.0%
unpow380.0%
add-cube-cbrt80.1%
add-sqr-sqrt80.1%
times-frac80.1%
+-commutative80.1%
add-sqr-sqrt80.1%
hypot-def80.1%
+-commutative80.1%
*-commutative80.1%
fma-def80.1%
+-commutative80.1%
add-sqr-sqrt80.1%
Applied egg-rr95.6%
Taylor expanded in k around inf 95.6%
Final simplification97.9%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) (* (* (fma k -10.0 1.0) (pow k m)) a) (* (/ a k) (/ (pow (exp (- m)) (- (log k))) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = (fma(k, -10.0, 1.0) * pow(k, m)) * a;
} else {
tmp = (a / k) * (pow(exp(-m), -log(k)) / k);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(Float64(fma(k, -10.0, 1.0) * (k ^ m)) * a); else tmp = Float64(Float64(a / k) * Float64((exp(Float64(-m)) ^ Float64(-log(k))) / k)); end return tmp end
code[a_, k_, m_] := If[LessEqual[k, 0.1], N[(N[(N[(k * -10.0 + 1.0), $MachinePrecision] * N[Power[k, m], $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(N[Power[N[Exp[(-m)], $MachinePrecision], (-N[Log[k], $MachinePrecision])], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;\left(\mathsf{fma}\left(k, -10, 1\right) \cdot {k}^{m}\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{{\left(e^{-m}\right)}^{\left(-\log k\right)}}{k}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 95.7%
associate-*r/95.7%
*-commutative95.7%
sqr-neg95.7%
associate-+l+95.7%
+-commutative95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in k around 0 85.8%
associate-*r*85.8%
distribute-lft1-in99.2%
*-commutative99.2%
fma-def99.2%
Simplified99.2%
if 0.10000000000000001 < k Initial program 80.1%
associate-*r/80.1%
*-commutative80.1%
sqr-neg80.1%
associate-+l+80.1%
+-commutative80.1%
sqr-neg80.1%
distribute-rgt-out80.1%
fma-def80.1%
+-commutative80.1%
Simplified80.1%
Taylor expanded in k around inf 80.1%
*-commutative80.1%
unpow280.1%
times-frac95.6%
associate-*r*95.6%
exp-prod95.4%
mul-1-neg95.4%
log-rec95.4%
Simplified95.4%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* (pow k m) a)) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 4e+63) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = pow(k, m) * a;
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 4e+63) {
tmp = t_1;
} else {
tmp = 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 = (k ** m) * a
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 4d+63) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = Math.pow(k, m) * a;
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 4e+63) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = math.pow(k, m) * a t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 4e+63: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64((k ^ m) * a) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 4e+63) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = (k ^ m) * a; t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 4e+63) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+63], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {k}^{m} \cdot a\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{+63}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 4.00000000000000023e63Initial program 96.0%
if 4.00000000000000023e63 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 63.0%
associate-*r/63.0%
*-commutative63.0%
sqr-neg63.0%
associate-+l+63.0%
+-commutative63.0%
sqr-neg63.0%
distribute-rgt-out63.0%
fma-def63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in k around 0 100.0%
Final simplification96.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.4e-5) (not (<= m 0.0142))) (* (pow k m) a) (/ a (fma k (+ k 10.0) 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.4e-5) || !(m <= 0.0142)) {
tmp = pow(k, m) * a;
} else {
tmp = a / fma(k, (k + 10.0), 1.0);
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -5.4e-5) || !(m <= 0.0142)) tmp = Float64((k ^ m) * a); else tmp = Float64(a / fma(k, Float64(k + 10.0), 1.0)); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -5.4e-5], N[Not[LessEqual[m, 0.0142]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.4 \cdot 10^{-5} \lor \neg \left(m \leq 0.0142\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\mathsf{fma}\left(k, k + 10, 1\right)}\\
\end{array}
\end{array}
if m < -5.3999999999999998e-5 or 0.014200000000000001 < m Initial program 89.6%
associate-*r/89.6%
*-commutative89.6%
sqr-neg89.6%
associate-+l+89.6%
+-commutative89.6%
sqr-neg89.6%
distribute-rgt-out89.6%
fma-def89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in k around 0 100.0%
if -5.3999999999999998e-5 < m < 0.014200000000000001Initial program 91.0%
associate-*r/91.0%
*-commutative91.0%
sqr-neg91.0%
associate-+l+91.0%
+-commutative91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 90.7%
+-commutative90.7%
+-commutative90.7%
fma-udef90.7%
Simplified90.7%
Final simplification96.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.8e-7) (not (<= m 0.088))) (* (pow k m) a) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.8e-7) || !(m <= 0.088)) {
tmp = pow(k, m) * a;
} 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 <= (-3.8d-7)) .or. (.not. (m <= 0.088d0))) then
tmp = (k ** m) * a
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 <= -3.8e-7) || !(m <= 0.088)) {
tmp = Math.pow(k, m) * a;
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -3.8e-7) or not (m <= 0.088): tmp = math.pow(k, m) * a else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -3.8e-7) || !(m <= 0.088)) tmp = Float64((k ^ m) * a); 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 <= -3.8e-7) || ~((m <= 0.088))) tmp = (k ^ m) * a; else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -3.8e-7], N[Not[LessEqual[m, 0.088]], $MachinePrecision]], N[(N[Power[k, m], $MachinePrecision] * a), $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 -3.8 \cdot 10^{-7} \lor \neg \left(m \leq 0.088\right):\\
\;\;\;\;{k}^{m} \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.80000000000000015e-7 or 0.087999999999999995 < m Initial program 89.6%
associate-*r/89.6%
*-commutative89.6%
sqr-neg89.6%
associate-+l+89.6%
+-commutative89.6%
sqr-neg89.6%
distribute-rgt-out89.6%
fma-def89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in k around 0 100.0%
if -3.80000000000000015e-7 < m < 0.087999999999999995Initial program 91.0%
associate-*r/91.0%
*-commutative91.0%
sqr-neg91.0%
associate-+l+91.0%
+-commutative91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 90.7%
Final simplification96.6%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (+ 1.0 (* k (+ k 10.0)))))
(if (<= m -4.1e+15)
(/ a (+ t_0 -1.0))
(if (<= m 1.68)
(/ a t_0)
(/ a (- (+ -99.0 (/ -1000.0 k)) (/ 10000.0 (* k k))))))))
double code(double a, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -4.1e+15) {
tmp = a / (t_0 + -1.0);
} else if (m <= 1.68) {
tmp = a / t_0;
} else {
tmp = a / ((-99.0 + (-1000.0 / k)) - (10000.0 / (k * 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (k * (k + 10.0d0))
if (m <= (-4.1d+15)) then
tmp = a / (t_0 + (-1.0d0))
else if (m <= 1.68d0) then
tmp = a / t_0
else
tmp = a / (((-99.0d0) + ((-1000.0d0) / k)) - (10000.0d0 / (k * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -4.1e+15) {
tmp = a / (t_0 + -1.0);
} else if (m <= 1.68) {
tmp = a / t_0;
} else {
tmp = a / ((-99.0 + (-1000.0 / k)) - (10000.0 / (k * k)));
}
return tmp;
}
def code(a, k, m): t_0 = 1.0 + (k * (k + 10.0)) tmp = 0 if m <= -4.1e+15: tmp = a / (t_0 + -1.0) elif m <= 1.68: tmp = a / t_0 else: tmp = a / ((-99.0 + (-1000.0 / k)) - (10000.0 / (k * k))) return tmp
function code(a, k, m) t_0 = Float64(1.0 + Float64(k * Float64(k + 10.0))) tmp = 0.0 if (m <= -4.1e+15) tmp = Float64(a / Float64(t_0 + -1.0)); elseif (m <= 1.68) tmp = Float64(a / t_0); else tmp = Float64(a / Float64(Float64(-99.0 + Float64(-1000.0 / k)) - Float64(10000.0 / Float64(k * k)))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = 1.0 + (k * (k + 10.0)); tmp = 0.0; if (m <= -4.1e+15) tmp = a / (t_0 + -1.0); elseif (m <= 1.68) tmp = a / t_0; else tmp = a / ((-99.0 + (-1000.0 / k)) - (10000.0 / (k * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -4.1e+15], N[(a / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.68], N[(a / t$95$0), $MachinePrecision], N[(a / N[(N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision] - N[(10000.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{t_0 + -1}\\
\mathbf{elif}\;m \leq 1.68:\\
\;\;\;\;\frac{a}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\left(-99 + \frac{-1000}{k}\right) - \frac{10000}{k \cdot k}}\\
\end{array}
\end{array}
if m < -4.1e15Initial program 100.0%
Taylor expanded in m around 0 30.4%
Taylor expanded in k around inf 35.0%
unpow235.0%
+-commutative35.0%
distribute-rgt-in35.0%
Simplified35.0%
expm1-log1p-u35.0%
expm1-udef75.5%
log1p-udef75.5%
add-exp-log75.5%
Applied egg-rr75.5%
if -4.1e15 < m < 1.67999999999999994Initial program 91.4%
associate-*r/91.4%
*-commutative91.4%
sqr-neg91.4%
associate-+l+91.4%
+-commutative91.4%
sqr-neg91.4%
distribute-rgt-out91.4%
fma-def91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in m around 0 90.3%
if 1.67999999999999994 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
+-commutative2.9%
flip-+2.9%
associate-*l/2.9%
metadata-eval2.9%
Applied egg-rr2.9%
Taylor expanded in k around 0 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around inf 33.1%
neg-sub033.1%
metadata-eval33.1%
associate-+r+33.1%
associate--r+33.1%
metadata-eval33.1%
neg-sub033.1%
distribute-neg-in33.1%
metadata-eval33.1%
associate-*r/33.1%
metadata-eval33.1%
distribute-neg-frac33.1%
metadata-eval33.1%
associate-*r/33.1%
metadata-eval33.1%
unpow233.1%
Simplified33.1%
Final simplification65.1%
(FPCore (a k m)
:precision binary64
(if (<= k -6.2e-130)
(/ a (* k k))
(if (<= k 5.5e-304)
(/ a (+ -99.0 (/ -1000.0 k)))
(if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ a (* k (+ k 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (k <= -6.2e-130) {
tmp = a / (k * k);
} else if (k <= 5.5e-304) {
tmp = a / (-99.0 + (-1000.0 / k));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (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 (k <= (-6.2d-130)) then
tmp = a / (k * k)
else if (k <= 5.5d-304) then
tmp = a / ((-99.0d0) + ((-1000.0d0) / k))
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = a / (k * (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -6.2e-130) {
tmp = a / (k * k);
} else if (k <= 5.5e-304) {
tmp = a / (-99.0 + (-1000.0 / k));
} else if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -6.2e-130: tmp = a / (k * k) elif k <= 5.5e-304: tmp = a / (-99.0 + (-1000.0 / k)) elif k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= -6.2e-130) tmp = Float64(a / Float64(k * k)); elseif (k <= 5.5e-304) tmp = Float64(a / Float64(-99.0 + Float64(-1000.0 / k))); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -6.2e-130) tmp = a / (k * k); elseif (k <= 5.5e-304) tmp = a / (-99.0 + (-1000.0 / k)); elseif (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -6.2e-130], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5.5e-304], N[(a / N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -6.2 \cdot 10^{-130}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 5.5 \cdot 10^{-304}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < -6.20000000000000021e-130Initial program 87.3%
associate-*r/87.3%
*-commutative87.3%
sqr-neg87.3%
associate-+l+87.3%
+-commutative87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
fma-def87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in m around 0 17.2%
Taylor expanded in k around inf 20.4%
unpow220.4%
Simplified20.4%
if -6.20000000000000021e-130 < k < 5.50000000000000035e-304Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 3.0%
+-commutative3.0%
*-commutative3.0%
+-commutative3.0%
flip-+3.0%
associate-*l/3.0%
metadata-eval3.0%
Applied egg-rr3.0%
Taylor expanded in k around 0 3.0%
*-commutative3.0%
Simplified3.0%
Taylor expanded in k around inf 35.6%
distribute-neg-in35.6%
metadata-eval35.6%
associate-*r/35.6%
metadata-eval35.6%
distribute-neg-frac35.6%
metadata-eval35.6%
Simplified35.6%
if 5.50000000000000035e-304 < k < 0.0749999999999999972Initial program 99.9%
associate-*r/99.9%
*-commutative99.9%
sqr-neg99.9%
associate-+l+99.9%
+-commutative99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 53.6%
Taylor expanded in k around 0 52.2%
if 0.0749999999999999972 < k Initial program 80.1%
Taylor expanded in m around 0 54.9%
Taylor expanded in k around inf 54.9%
unpow254.9%
+-commutative54.9%
distribute-rgt-in54.9%
Simplified54.9%
Final simplification45.2%
(FPCore (a k m)
:precision binary64
(if (<= m -4.1e+15)
(/ a (* k k))
(if (<= m 0.82)
(/ a (+ 1.0 (* k (+ k 10.0))))
(/ a (+ -99.0 (/ -1000.0 k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e+15) {
tmp = a / (k * k);
} else if (m <= 0.82) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a / (-99.0 + (-1000.0 / 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 <= (-4.1d+15)) then
tmp = a / (k * k)
else if (m <= 0.82d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a / ((-99.0d0) + ((-1000.0d0) / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e+15) {
tmp = a / (k * k);
} else if (m <= 0.82) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a / (-99.0 + (-1000.0 / k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.1e+15: tmp = a / (k * k) elif m <= 0.82: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a / (-99.0 + (-1000.0 / k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.1e+15) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.82) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a / Float64(-99.0 + Float64(-1000.0 / k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.1e+15) tmp = a / (k * k); elseif (m <= 0.82) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a / (-99.0 + (-1000.0 / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.1e+15], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.82], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.82:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\
\end{array}
\end{array}
if m < -4.1e15Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.4%
Taylor expanded in k around inf 58.5%
unpow258.5%
Simplified58.5%
if -4.1e15 < m < 0.819999999999999951Initial program 91.4%
associate-*r/91.4%
*-commutative91.4%
sqr-neg91.4%
associate-+l+91.4%
+-commutative91.4%
sqr-neg91.4%
distribute-rgt-out91.4%
fma-def91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in m around 0 90.3%
if 0.819999999999999951 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
+-commutative2.9%
flip-+2.9%
associate-*l/2.9%
metadata-eval2.9%
Applied egg-rr2.9%
Taylor expanded in k around 0 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around inf 13.5%
distribute-neg-in13.5%
metadata-eval13.5%
associate-*r/13.5%
metadata-eval13.5%
distribute-neg-frac13.5%
metadata-eval13.5%
Simplified13.5%
Final simplification53.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (+ 1.0 (* k (+ k 10.0)))))
(if (<= m -4.1e+15)
(/ a (+ t_0 -1.0))
(if (<= m 1.7) (/ a t_0) (/ a (+ -99.0 (/ -1000.0 k)))))))
double code(double a, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -4.1e+15) {
tmp = a / (t_0 + -1.0);
} else if (m <= 1.7) {
tmp = a / t_0;
} else {
tmp = a / (-99.0 + (-1000.0 / 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (k * (k + 10.0d0))
if (m <= (-4.1d+15)) then
tmp = a / (t_0 + (-1.0d0))
else if (m <= 1.7d0) then
tmp = a / t_0
else
tmp = a / ((-99.0d0) + ((-1000.0d0) / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = 1.0 + (k * (k + 10.0));
double tmp;
if (m <= -4.1e+15) {
tmp = a / (t_0 + -1.0);
} else if (m <= 1.7) {
tmp = a / t_0;
} else {
tmp = a / (-99.0 + (-1000.0 / k));
}
return tmp;
}
def code(a, k, m): t_0 = 1.0 + (k * (k + 10.0)) tmp = 0 if m <= -4.1e+15: tmp = a / (t_0 + -1.0) elif m <= 1.7: tmp = a / t_0 else: tmp = a / (-99.0 + (-1000.0 / k)) return tmp
function code(a, k, m) t_0 = Float64(1.0 + Float64(k * Float64(k + 10.0))) tmp = 0.0 if (m <= -4.1e+15) tmp = Float64(a / Float64(t_0 + -1.0)); elseif (m <= 1.7) tmp = Float64(a / t_0); else tmp = Float64(a / Float64(-99.0 + Float64(-1000.0 / k))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = 1.0 + (k * (k + 10.0)); tmp = 0.0; if (m <= -4.1e+15) tmp = a / (t_0 + -1.0); elseif (m <= 1.7) tmp = a / t_0; else tmp = a / (-99.0 + (-1000.0 / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -4.1e+15], N[(a / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.7], N[(a / t$95$0), $MachinePrecision], N[(a / N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{t_0 + -1}\\
\mathbf{elif}\;m \leq 1.7:\\
\;\;\;\;\frac{a}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\
\end{array}
\end{array}
if m < -4.1e15Initial program 100.0%
Taylor expanded in m around 0 30.4%
Taylor expanded in k around inf 35.0%
unpow235.0%
+-commutative35.0%
distribute-rgt-in35.0%
Simplified35.0%
expm1-log1p-u35.0%
expm1-udef75.5%
log1p-udef75.5%
add-exp-log75.5%
Applied egg-rr75.5%
if -4.1e15 < m < 1.69999999999999996Initial program 91.4%
associate-*r/91.4%
*-commutative91.4%
sqr-neg91.4%
associate-+l+91.4%
+-commutative91.4%
sqr-neg91.4%
distribute-rgt-out91.4%
fma-def91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in m around 0 90.3%
if 1.69999999999999996 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
+-commutative2.9%
flip-+2.9%
associate-*l/2.9%
metadata-eval2.9%
Applied egg-rr2.9%
Taylor expanded in k around 0 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around inf 13.5%
distribute-neg-in13.5%
metadata-eval13.5%
associate-*r/13.5%
metadata-eval13.5%
distribute-neg-frac13.5%
metadata-eval13.5%
Simplified13.5%
Final simplification57.6%
(FPCore (a k m) :precision binary64 (if (<= m -1.2e-17) (/ a (* k k)) (if (<= m 0.76) (/ a (+ 1.0 (* k 10.0))) (/ a (+ -99.0 (/ -1000.0 k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.2e-17) {
tmp = a / (k * k);
} else if (m <= 0.76) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a / (-99.0 + (-1000.0 / 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.2d-17)) then
tmp = a / (k * k)
else if (m <= 0.76d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a / ((-99.0d0) + ((-1000.0d0) / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.2e-17) {
tmp = a / (k * k);
} else if (m <= 0.76) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a / (-99.0 + (-1000.0 / k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.2e-17: tmp = a / (k * k) elif m <= 0.76: tmp = a / (1.0 + (k * 10.0)) else: tmp = a / (-99.0 + (-1000.0 / k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.2e-17) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.76) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a / Float64(-99.0 + Float64(-1000.0 / k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.2e-17) tmp = a / (k * k); elseif (m <= 0.76) tmp = a / (1.0 + (k * 10.0)); else tmp = a / (-99.0 + (-1000.0 / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.2e-17], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.76], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.2 \cdot 10^{-17}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.76:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\
\end{array}
\end{array}
if m < -1.19999999999999993e-17Initial program 98.7%
associate-*r/98.7%
*-commutative98.7%
sqr-neg98.7%
associate-+l+98.7%
+-commutative98.7%
sqr-neg98.7%
distribute-rgt-out98.7%
fma-def98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 36.4%
Taylor expanded in k around inf 60.7%
unpow260.7%
Simplified60.7%
if -1.19999999999999993e-17 < m < 0.76000000000000001Initial program 91.6%
associate-*r/91.6%
*-commutative91.6%
sqr-neg91.6%
associate-+l+91.6%
+-commutative91.6%
sqr-neg91.6%
distribute-rgt-out91.6%
fma-def91.6%
+-commutative91.6%
Simplified91.6%
Taylor expanded in m around 0 91.6%
Taylor expanded in k around 0 75.2%
*-commutative75.2%
Simplified75.2%
if 0.76000000000000001 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
+-commutative2.9%
flip-+2.9%
associate-*l/2.9%
metadata-eval2.9%
Applied egg-rr2.9%
Taylor expanded in k around 0 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around inf 13.5%
distribute-neg-in13.5%
metadata-eval13.5%
associate-*r/13.5%
metadata-eval13.5%
distribute-neg-frac13.5%
metadata-eval13.5%
Simplified13.5%
Final simplification47.8%
(FPCore (a k m) :precision binary64 (if (<= m -4.1e+15) (/ a (* k k)) (if (<= m 1.16) (/ a (+ 1.0 (* k k))) (/ a (+ -99.0 (/ -1000.0 k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e+15) {
tmp = a / (k * k);
} else if (m <= 1.16) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a / (-99.0 + (-1000.0 / 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 <= (-4.1d+15)) then
tmp = a / (k * k)
else if (m <= 1.16d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a / ((-99.0d0) + ((-1000.0d0) / k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -4.1e+15) {
tmp = a / (k * k);
} else if (m <= 1.16) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a / (-99.0 + (-1000.0 / k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -4.1e+15: tmp = a / (k * k) elif m <= 1.16: tmp = a / (1.0 + (k * k)) else: tmp = a / (-99.0 + (-1000.0 / k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -4.1e+15) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.16) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a / Float64(-99.0 + Float64(-1000.0 / k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -4.1e+15) tmp = a / (k * k); elseif (m <= 1.16) tmp = a / (1.0 + (k * k)); else tmp = a / (-99.0 + (-1000.0 / k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -4.1e+15], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.16], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(-99.0 + N[(-1000.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4.1 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.16:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{-99 + \frac{-1000}{k}}\\
\end{array}
\end{array}
if m < -4.1e15Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.4%
Taylor expanded in k around inf 58.5%
unpow258.5%
Simplified58.5%
if -4.1e15 < m < 1.15999999999999992Initial program 91.4%
associate-*r/91.4%
*-commutative91.4%
sqr-neg91.4%
associate-+l+91.4%
+-commutative91.4%
sqr-neg91.4%
distribute-rgt-out91.4%
fma-def91.4%
+-commutative91.4%
Simplified91.4%
Taylor expanded in m around 0 90.3%
Taylor expanded in k around inf 87.6%
unpow287.6%
Simplified87.6%
if 1.15999999999999992 < m Initial program 82.5%
associate-*r/82.5%
*-commutative82.5%
sqr-neg82.5%
associate-+l+82.5%
+-commutative82.5%
sqr-neg82.5%
distribute-rgt-out82.5%
fma-def82.5%
+-commutative82.5%
Simplified82.5%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
+-commutative2.9%
flip-+2.9%
associate-*l/2.9%
metadata-eval2.9%
Applied egg-rr2.9%
Taylor expanded in k around 0 2.3%
*-commutative2.3%
Simplified2.3%
Taylor expanded in k around inf 13.5%
distribute-neg-in13.5%
metadata-eval13.5%
associate-*r/13.5%
metadata-eval13.5%
distribute-neg-frac13.5%
metadata-eval13.5%
Simplified13.5%
Final simplification52.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -2.2e-233) (not (<= k 1.4e+30))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2.2e-233) || !(k <= 1.4e+30)) {
tmp = a / (k * 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 ((k <= (-2.2d-233)) .or. (.not. (k <= 1.4d+30))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -2.2e-233) || !(k <= 1.4e+30)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2.2e-233) or not (k <= 1.4e+30): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2.2e-233) || !(k <= 1.4e+30)) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -2.2e-233) || ~((k <= 1.4e+30))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2.2e-233], N[Not[LessEqual[k, 1.4e+30]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.2 \cdot 10^{-233} \lor \neg \left(k \leq 1.4 \cdot 10^{+30}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -2.2e-233 or 1.39999999999999992e30 < k Initial program 83.1%
associate-*r/83.1%
*-commutative83.1%
sqr-neg83.1%
associate-+l+83.1%
+-commutative83.1%
sqr-neg83.1%
distribute-rgt-out83.1%
fma-def83.1%
+-commutative83.1%
Simplified83.1%
Taylor expanded in m around 0 40.1%
Taylor expanded in k around inf 41.8%
unpow241.8%
Simplified41.8%
if -2.2e-233 < k < 1.39999999999999992e30Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 97.5%
Taylor expanded in m around 0 43.9%
Final simplification42.6%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) (+ a (* -10.0 (* k a))) (/ a (* k k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (k * 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 <= 0.1d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = a / (k * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (k * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a + (-10.0 * (k * a)) else: tmp = a / (k * k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(a / Float64(k * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a + (-10.0 * (k * a)); else tmp = a / (k * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 95.7%
associate-*r/95.7%
*-commutative95.7%
sqr-neg95.7%
associate-+l+95.7%
+-commutative95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 35.8%
Taylor expanded in k around 0 34.5%
if 0.10000000000000001 < k Initial program 80.1%
associate-*r/80.1%
*-commutative80.1%
sqr-neg80.1%
associate-+l+80.1%
+-commutative80.1%
sqr-neg80.1%
distribute-rgt-out80.1%
fma-def80.1%
+-commutative80.1%
Simplified80.1%
Taylor expanded in m around 0 54.9%
Taylor expanded in k around inf 54.9%
unpow254.9%
Simplified54.9%
Final simplification41.8%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (+ a (* -10.0 (* k a))) (/ a (* k (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (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 (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = a / (k * (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a + (-10.0 * (k * a)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a + (-10.0 * (k * a)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 95.7%
associate-*r/95.7%
*-commutative95.7%
sqr-neg95.7%
associate-+l+95.7%
+-commutative95.7%
sqr-neg95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 35.8%
Taylor expanded in k around 0 34.5%
if 0.0749999999999999972 < k Initial program 80.1%
Taylor expanded in m around 0 54.9%
Taylor expanded in k around inf 54.9%
unpow254.9%
+-commutative54.9%
distribute-rgt-in54.9%
Simplified54.9%
Final simplification41.8%
(FPCore (a k m) :precision binary64 (if (<= k 2.05e+30) a (/ a (* k 10.0))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.05e+30) {
tmp = a;
} else {
tmp = a / (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 (k <= 2.05d+30) then
tmp = a
else
tmp = a / (k * 10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.05e+30) {
tmp = a;
} else {
tmp = a / (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.05e+30: tmp = a else: tmp = a / (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.05e+30) tmp = a; else tmp = Float64(a / Float64(k * 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.05e+30) tmp = a; else tmp = a / (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.05e+30], a, N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\end{array}
\end{array}
if k < 2.05000000000000003e30Initial program 95.9%
associate-*r/95.9%
*-commutative95.9%
sqr-neg95.9%
associate-+l+95.9%
+-commutative95.9%
sqr-neg95.9%
distribute-rgt-out95.9%
fma-def95.9%
+-commutative95.9%
Simplified95.9%
Taylor expanded in k around 0 98.4%
Taylor expanded in m around 0 28.6%
if 2.05000000000000003e30 < k Initial program 78.5%
associate-*r/78.4%
*-commutative78.4%
sqr-neg78.4%
associate-+l+78.4%
+-commutative78.4%
sqr-neg78.4%
distribute-rgt-out78.4%
fma-def78.4%
+-commutative78.4%
Simplified78.4%
Taylor expanded in m around 0 59.1%
Taylor expanded in k around 0 32.8%
*-commutative32.8%
Simplified32.8%
Taylor expanded in k around inf 32.8%
*-commutative32.8%
Simplified32.8%
Final simplification30.0%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 90.1%
associate-*r/90.1%
*-commutative90.1%
sqr-neg90.1%
associate-+l+90.1%
+-commutative90.1%
sqr-neg90.1%
distribute-rgt-out90.1%
fma-def90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in k around 0 81.8%
Taylor expanded in m around 0 20.7%
Final simplification20.7%
herbie shell --seed 2023271
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))