
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 1e+150) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 1e+150) {
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 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 1d+150) 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 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 1e+150) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 1e+150: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 1e+150) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 1e+150) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+150], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 10^{+150}:\\
\;\;\;\;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))) < 9.99999999999999981e149Initial program 97.9%
if 9.99999999999999981e149 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 63.2%
associate-*r/63.2%
*-commutative63.2%
sqr-neg63.2%
associate-+l+63.2%
+-commutative63.2%
sqr-neg63.2%
distribute-rgt-out63.2%
fma-def63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in k around 0 100.0%
Final simplification98.3%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.3e-6) (not (<= m 2.9e-6))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.3e-6) || !(m <= 2.9e-6)) {
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 <= (-3.3d-6)) .or. (.not. (m <= 2.9d-6))) 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 <= -3.3e-6) || !(m <= 2.9e-6)) {
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 <= -3.3e-6) or not (m <= 2.9e-6): 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 <= -3.3e-6) || !(m <= 2.9e-6)) 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 <= -3.3e-6) || ~((m <= 2.9e-6))) 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, -3.3e-6], N[Not[LessEqual[m, 2.9e-6]], $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 -3.3 \cdot 10^{-6} \lor \neg \left(m \leq 2.9 \cdot 10^{-6}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.30000000000000017e-6 or 2.9000000000000002e-6 < m Initial program 88.3%
associate-*r/88.3%
*-commutative88.3%
sqr-neg88.3%
associate-+l+88.3%
+-commutative88.3%
sqr-neg88.3%
distribute-rgt-out88.3%
fma-def88.3%
+-commutative88.3%
Simplified88.3%
Taylor expanded in k around 0 100.0%
if -3.30000000000000017e-6 < m < 2.9000000000000002e-6Initial program 94.4%
associate-*r/94.4%
*-commutative94.4%
sqr-neg94.4%
associate-+l+94.4%
+-commutative94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
fma-def94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 94.4%
Final simplification98.3%
(FPCore (a k m)
:precision binary64
(if (<= m -0.64)
(* a (/ 1.0 (* k k)))
(if (<= m 64000000000000.0)
(/ a (+ 1.0 (* k (+ k 10.0))))
(* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.64) {
tmp = a * (1.0 / (k * k));
} else if (m <= 64000000000000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.64d0)) then
tmp = a * (1.0d0 / (k * k))
else if (m <= 64000000000000.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.64) {
tmp = a * (1.0 / (k * k));
} else if (m <= 64000000000000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.64: tmp = a * (1.0 / (k * k)) elif m <= 64000000000000.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.64) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 64000000000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.64) tmp = a * (1.0 / (k * k)); elseif (m <= 64000000000000.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.64], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 64000000000000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.64:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 64000000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.640000000000000013Initial 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 inf 54.3%
*-commutative54.3%
unpow254.3%
times-frac54.3%
associate-*r*54.3%
exp-prod54.3%
mul-1-neg54.3%
log-rec54.3%
Simplified54.3%
*-commutative54.3%
clear-num54.3%
frac-times54.3%
*-un-lft-identity54.3%
add-sqr-sqrt27.2%
sqrt-unprod27.4%
sqr-neg27.4%
sqrt-unprod0.2%
add-sqr-sqrt0.5%
pow-exp0.5%
add-sqr-sqrt0.5%
sqrt-unprod0.5%
sqr-neg0.5%
sqrt-unprod0.0%
add-sqr-sqrt54.3%
log-pow100.0%
add-exp-log100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 53.2%
unpow253.2%
associate-/r*39.0%
Simplified39.0%
associate-/l/53.2%
div-inv54.2%
Applied egg-rr54.2%
if -0.640000000000000013 < m < 6.4e13Initial program 94.5%
associate-*r/94.5%
*-commutative94.5%
sqr-neg94.5%
associate-+l+94.5%
+-commutative94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
fma-def94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in m around 0 92.1%
if 6.4e13 < m Initial program 75.6%
associate-*r/75.6%
*-commutative75.6%
sqr-neg75.6%
associate-+l+75.6%
+-commutative75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
fma-def75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 9.3%
Taylor expanded in k around inf 21.1%
Final simplification54.6%
(FPCore (a k m) :precision binary64 (if (<= k 4.8e-267) (/ a (* k k)) (if (<= k 0.1) (+ a (* -10.0 (* a k))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 4.8e-267) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a + (-10.0 * (a * k));
} 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 <= 4.8d-267) then
tmp = a / (k * k)
else if (k <= 0.1d0) then
tmp = a + ((-10.0d0) * (a * k))
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 <= 4.8e-267) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 4.8e-267: tmp = a / (k * k) elif k <= 0.1: tmp = a + (-10.0 * (a * k)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 4.8e-267) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.1) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 4.8e-267) tmp = a / (k * k); elseif (k <= 0.1) tmp = a + (-10.0 * (a * k)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 4.8e-267], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.8 \cdot 10^{-267}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 4.7999999999999996e-267Initial program 92.9%
associate-*r/92.9%
*-commutative92.9%
sqr-neg92.9%
associate-+l+92.9%
+-commutative92.9%
sqr-neg92.9%
distribute-rgt-out92.9%
fma-def92.9%
+-commutative92.9%
Simplified92.9%
Taylor expanded in m around 0 17.7%
Taylor expanded in k around inf 27.4%
unpow227.4%
Simplified27.4%
if 4.7999999999999996e-267 < k < 0.10000000000000001Initial program 99.9%
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 54.0%
Taylor expanded in k around 0 51.4%
if 0.10000000000000001 < k Initial program 79.3%
associate-*r/79.3%
*-commutative79.3%
sqr-neg79.3%
associate-+l+79.3%
+-commutative79.3%
sqr-neg79.3%
distribute-rgt-out79.3%
fma-def79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in k around inf 78.6%
*-commutative78.6%
unpow278.6%
times-frac90.1%
associate-*r*90.1%
exp-prod90.1%
mul-1-neg90.1%
log-rec90.1%
Simplified90.1%
*-commutative90.1%
clear-num89.0%
frac-times83.9%
*-un-lft-identity83.9%
add-sqr-sqrt38.4%
sqrt-unprod40.3%
sqr-neg40.3%
sqrt-unprod39.1%
add-sqr-sqrt39.1%
pow-exp39.1%
add-sqr-sqrt22.2%
sqrt-unprod54.6%
sqr-neg54.6%
sqrt-unprod32.4%
add-sqr-sqrt83.9%
log-pow83.9%
add-exp-log83.9%
Applied egg-rr83.9%
Taylor expanded in m around 0 54.7%
unpow254.7%
associate-/r*55.1%
Simplified55.1%
Final simplification43.4%
(FPCore (a k m) :precision binary64 (if (<= m -2.4e-158) (* a (/ 1.0 (* k k))) (if (<= m 67000000000000.0) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.4e-158) {
tmp = a * (1.0 / (k * k));
} else if (m <= 67000000000000.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 <= (-2.4d-158)) then
tmp = a * (1.0d0 / (k * k))
else if (m <= 67000000000000.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 <= -2.4e-158) {
tmp = a * (1.0 / (k * k));
} else if (m <= 67000000000000.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 <= -2.4e-158: tmp = a * (1.0 / (k * k)) elif m <= 67000000000000.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 <= -2.4e-158) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 67000000000000.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 <= -2.4e-158) tmp = a * (1.0 / (k * k)); elseif (m <= 67000000000000.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, -2.4e-158], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 67000000000000.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 -2.4 \cdot 10^{-158}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 67000000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -2.40000000000000007e-158Initial program 98.3%
associate-*r/98.3%
*-commutative98.3%
sqr-neg98.3%
associate-+l+98.3%
+-commutative98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
fma-def98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in k around inf 54.8%
*-commutative54.8%
unpow254.8%
times-frac56.5%
associate-*r*56.5%
exp-prod56.5%
mul-1-neg56.5%
log-rec56.5%
Simplified56.5%
*-commutative56.5%
clear-num56.5%
frac-times56.4%
*-un-lft-identity56.4%
add-sqr-sqrt33.0%
sqrt-unprod34.1%
sqr-neg34.1%
sqrt-unprod11.6%
add-sqr-sqrt11.8%
pow-exp11.8%
add-sqr-sqrt11.8%
sqrt-unprod11.8%
sqr-neg11.8%
sqrt-unprod0.0%
add-sqr-sqrt56.4%
log-pow94.3%
add-exp-log94.3%
Applied egg-rr94.3%
Taylor expanded in m around 0 53.8%
unpow253.8%
associate-/r*43.8%
Simplified43.8%
associate-/l/53.8%
div-inv54.7%
Applied egg-rr54.7%
if -2.40000000000000007e-158 < m < 6.7e13Initial program 96.0%
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 m around 0 92.7%
Taylor expanded in k around 0 66.6%
*-commutative66.6%
Simplified66.6%
if 6.7e13 < m Initial program 75.6%
associate-*r/75.6%
*-commutative75.6%
sqr-neg75.6%
associate-+l+75.6%
+-commutative75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
fma-def75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 9.3%
Taylor expanded in k around inf 21.1%
Final simplification46.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.48) (* a (/ 1.0 (* k k))) (if (<= m 64000000000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.48) {
tmp = a * (1.0 / (k * k));
} else if (m <= 64000000000000.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 <= (-0.48d0)) then
tmp = a * (1.0d0 / (k * k))
else if (m <= 64000000000000.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 <= -0.48) {
tmp = a * (1.0 / (k * k));
} else if (m <= 64000000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.48: tmp = a * (1.0 / (k * k)) elif m <= 64000000000000.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 <= -0.48) tmp = Float64(a * Float64(1.0 / Float64(k * k))); elseif (m <= 64000000000000.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 <= -0.48) tmp = a * (1.0 / (k * k)); elseif (m <= 64000000000000.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, -0.48], N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 64000000000000.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 -0.48:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\mathbf{elif}\;m \leq 64000000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.47999999999999998Initial 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 inf 54.3%
*-commutative54.3%
unpow254.3%
times-frac54.3%
associate-*r*54.3%
exp-prod54.3%
mul-1-neg54.3%
log-rec54.3%
Simplified54.3%
*-commutative54.3%
clear-num54.3%
frac-times54.3%
*-un-lft-identity54.3%
add-sqr-sqrt27.2%
sqrt-unprod27.4%
sqr-neg27.4%
sqrt-unprod0.2%
add-sqr-sqrt0.5%
pow-exp0.5%
add-sqr-sqrt0.5%
sqrt-unprod0.5%
sqr-neg0.5%
sqrt-unprod0.0%
add-sqr-sqrt54.3%
log-pow100.0%
add-exp-log100.0%
Applied egg-rr100.0%
Taylor expanded in m around 0 53.2%
unpow253.2%
associate-/r*39.0%
Simplified39.0%
associate-/l/53.2%
div-inv54.2%
Applied egg-rr54.2%
if -0.47999999999999998 < m < 6.4e13Initial program 94.5%
associate-*r/94.5%
*-commutative94.5%
sqr-neg94.5%
associate-+l+94.5%
+-commutative94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
fma-def94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in m around 0 92.1%
Taylor expanded in k around inf 88.1%
unpow288.1%
Simplified88.1%
if 6.4e13 < m Initial program 75.6%
associate-*r/75.6%
*-commutative75.6%
sqr-neg75.6%
associate-+l+75.6%
+-commutative75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
fma-def75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 9.3%
Taylor expanded in k around inf 21.1%
Final simplification53.4%
(FPCore (a k m) :precision binary64 (if (or (<= k 2.2e-266) (not (<= k 0.135))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 2.2e-266) || !(k <= 0.135)) {
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-266) .or. (.not. (k <= 0.135d0))) 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-266) || !(k <= 0.135)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 2.2e-266) or not (k <= 0.135): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 2.2e-266) || !(k <= 0.135)) 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-266) || ~((k <= 0.135))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 2.2e-266], N[Not[LessEqual[k, 0.135]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.2 \cdot 10^{-266} \lor \neg \left(k \leq 0.135\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 2.2e-266 or 0.13500000000000001 < k Initial program 86.5%
associate-*r/86.5%
*-commutative86.5%
sqr-neg86.5%
associate-+l+86.5%
+-commutative86.5%
sqr-neg86.5%
distribute-rgt-out86.5%
fma-def86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in m around 0 35.4%
Taylor expanded in k around inf 40.2%
unpow240.2%
Simplified40.2%
if 2.2e-266 < k < 0.13500000000000001Initial program 99.9%
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 54.0%
Taylor expanded in k around 0 50.4%
Final simplification43.0%
(FPCore (a k m) :precision binary64 (if (<= m -7.2e-28) (/ a (* k 10.0)) (if (<= m 64000000000000.0) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.2e-28) {
tmp = a / (k * 10.0);
} else if (m <= 64000000000000.0) {
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 <= (-7.2d-28)) then
tmp = a / (k * 10.0d0)
else if (m <= 64000000000000.0d0) 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 <= -7.2e-28) {
tmp = a / (k * 10.0);
} else if (m <= 64000000000000.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -7.2e-28: tmp = a / (k * 10.0) elif m <= 64000000000000.0: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -7.2e-28) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 64000000000000.0) 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 <= -7.2e-28) tmp = a / (k * 10.0); elseif (m <= 64000000000000.0) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -7.2e-28], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 64000000000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.2 \cdot 10^{-28}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 64000000000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -7.1999999999999997e-28Initial 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 33.3%
Taylor expanded in k around 0 15.7%
*-commutative15.7%
Simplified15.7%
Taylor expanded in k around inf 20.1%
*-commutative20.1%
Simplified20.1%
if -7.1999999999999997e-28 < m < 6.4e13Initial program 94.4%
associate-*r/94.4%
*-commutative94.4%
sqr-neg94.4%
associate-+l+94.4%
+-commutative94.4%
sqr-neg94.4%
distribute-rgt-out94.4%
fma-def94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 91.9%
Taylor expanded in k around 0 52.9%
if 6.4e13 < m Initial program 75.6%
associate-*r/75.6%
*-commutative75.6%
sqr-neg75.6%
associate-+l+75.6%
+-commutative75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
fma-def75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 9.3%
Taylor expanded in k around inf 21.1%
Final simplification30.2%
(FPCore (a k m) :precision binary64 (if (<= k 5.8e-267) (/ a (* k k)) (if (<= k 0.135) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 5.8e-267) {
tmp = a / (k * k);
} else if (k <= 0.135) {
tmp = 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 <= 5.8d-267) then
tmp = a / (k * k)
else if (k <= 0.135d0) then
tmp = 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 <= 5.8e-267) {
tmp = a / (k * k);
} else if (k <= 0.135) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 5.8e-267: tmp = a / (k * k) elif k <= 0.135: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 5.8e-267) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.135) tmp = a; else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 5.8e-267) tmp = a / (k * k); elseif (k <= 0.135) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 5.8e-267], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.135], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.8 \cdot 10^{-267}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.135:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 5.80000000000000043e-267Initial program 92.9%
associate-*r/92.9%
*-commutative92.9%
sqr-neg92.9%
associate-+l+92.9%
+-commutative92.9%
sqr-neg92.9%
distribute-rgt-out92.9%
fma-def92.9%
+-commutative92.9%
Simplified92.9%
Taylor expanded in m around 0 17.7%
Taylor expanded in k around inf 27.4%
unpow227.4%
Simplified27.4%
if 5.80000000000000043e-267 < k < 0.13500000000000001Initial program 99.9%
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 54.0%
Taylor expanded in k around 0 50.4%
if 0.13500000000000001 < k Initial program 79.3%
associate-*r/79.3%
*-commutative79.3%
sqr-neg79.3%
associate-+l+79.3%
+-commutative79.3%
sqr-neg79.3%
distribute-rgt-out79.3%
fma-def79.3%
+-commutative79.3%
Simplified79.3%
Taylor expanded in k around inf 78.6%
*-commutative78.6%
unpow278.6%
times-frac90.1%
associate-*r*90.1%
exp-prod90.1%
mul-1-neg90.1%
log-rec90.1%
Simplified90.1%
*-commutative90.1%
clear-num89.0%
frac-times83.9%
*-un-lft-identity83.9%
add-sqr-sqrt38.4%
sqrt-unprod40.3%
sqr-neg40.3%
sqrt-unprod39.1%
add-sqr-sqrt39.1%
pow-exp39.1%
add-sqr-sqrt22.2%
sqrt-unprod54.6%
sqr-neg54.6%
sqrt-unprod32.4%
add-sqr-sqrt83.9%
log-pow83.9%
add-exp-log83.9%
Applied egg-rr83.9%
Taylor expanded in m around 0 54.7%
unpow254.7%
associate-/r*55.1%
Simplified55.1%
Final simplification43.1%
(FPCore (a k m) :precision binary64 (if (<= m 68000000000000.0) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 68000000000000.0) {
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 <= 68000000000000.0d0) 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 <= 68000000000000.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 68000000000000.0: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 68000000000000.0) 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 <= 68000000000000.0) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 68000000000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 68000000000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 6.8e13Initial program 97.5%
associate-*r/97.5%
*-commutative97.5%
sqr-neg97.5%
associate-+l+97.5%
+-commutative97.5%
sqr-neg97.5%
distribute-rgt-out97.5%
fma-def97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in m around 0 59.5%
Taylor expanded in k around 0 25.6%
if 6.8e13 < m Initial program 75.6%
associate-*r/75.6%
*-commutative75.6%
sqr-neg75.6%
associate-+l+75.6%
+-commutative75.6%
sqr-neg75.6%
distribute-rgt-out75.6%
fma-def75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 9.3%
Taylor expanded in k around inf 21.1%
Final simplification24.1%
(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 m around 0 40.4%
Taylor expanded in k around 0 18.2%
Final simplification18.2%
herbie shell --seed 2023287
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))