
(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 (<= k 1.9e-11) (/ a (pow k (- m))) (* (/ a k) (/ (pow k m) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.9e-11) {
tmp = a / pow(k, -m);
} else {
tmp = (a / k) * (pow(k, m) / 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 <= 1.9d-11) then
tmp = a / (k ** -m)
else
tmp = (a / k) * ((k ** m) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.9e-11) {
tmp = a / Math.pow(k, -m);
} else {
tmp = (a / k) * (Math.pow(k, m) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.9e-11: tmp = a / math.pow(k, -m) else: tmp = (a / k) * (math.pow(k, m) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.9e-11) tmp = Float64(a / (k ^ Float64(-m))); else tmp = Float64(Float64(a / k) * Float64((k ^ m) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.9e-11) tmp = a / (k ^ -m); else tmp = (a / k) * ((k ^ m) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.9e-11], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.9 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{{k}^{m}}{k}\\
\end{array}
\end{array}
if k < 1.8999999999999999e-11Initial program 92.6%
associate-/l*92.6%
associate-+l+92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in k around 0 51.7%
rec-exp51.7%
distribute-rgt-neg-in51.7%
exp-to-pow99.3%
Simplified99.3%
if 1.8999999999999999e-11 < k Initial program 80.0%
associate-/l*80.0%
associate-+l+80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in k around inf 79.3%
unpow279.3%
times-frac94.9%
rem-exp-log92.9%
div-exp92.9%
mul-1-neg92.9%
log-rec92.9%
distribute-lft-neg-in92.9%
remove-double-neg92.9%
div-exp92.9%
exp-to-pow92.9%
rem-exp-log94.9%
Simplified94.9%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.8e-13) (not (<= m 2.6e-42))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.8e-13) || !(m <= 2.6e-42)) {
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 <= (-5.8d-13)) .or. (.not. (m <= 2.6d-42))) 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 <= -5.8e-13) || !(m <= 2.6e-42)) {
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 <= -5.8e-13) or not (m <= 2.6e-42): 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 <= -5.8e-13) || !(m <= 2.6e-42)) 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 <= -5.8e-13) || ~((m <= 2.6e-42))) 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, -5.8e-13], N[Not[LessEqual[m, 2.6e-42]], $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 -5.8 \cdot 10^{-13} \lor \neg \left(m \leq 2.6 \cdot 10^{-42}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.7999999999999995e-13 or 2.6e-42 < m Initial program 87.8%
associate-/l*87.8%
associate-+l+87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in k around 0 55.6%
exp-to-pow98.4%
*-commutative98.4%
Simplified98.4%
if -5.7999999999999995e-13 < m < 2.6e-42Initial program 88.3%
associate-/l*88.3%
associate-+l+88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in m around 0 88.0%
+-commutative88.0%
unpow288.0%
distribute-rgt-in88.0%
fma-udef88.0%
Simplified88.0%
Taylor expanded in a around 0 88.0%
Final simplification95.3%
(FPCore (a k m)
:precision binary64
(if (<= m -430.0)
(* a (/ -1.0 (* k (- k))))
(if (<= m 1.9)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (+ (* k (* k 100.0)) (* k -10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -430.0) {
tmp = a * (-1.0 / (k * -k));
} else if (m <= 1.9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * ((k * (k * 100.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 <= (-430.0d0)) then
tmp = a * ((-1.0d0) / (k * -k))
else if (m <= 1.9d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * ((k * (k * 100.0d0)) + (k * (-10.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -430.0) {
tmp = a * (-1.0 / (k * -k));
} else if (m <= 1.9) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * ((k * (k * 100.0)) + (k * -10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -430.0: tmp = a * (-1.0 / (k * -k)) elif m <= 1.9: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * ((k * (k * 100.0)) + (k * -10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -430.0) tmp = Float64(a * Float64(-1.0 / Float64(k * Float64(-k)))); elseif (m <= 1.9) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(Float64(k * Float64(k * 100.0)) + Float64(k * -10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -430.0) tmp = a * (-1.0 / (k * -k)); elseif (m <= 1.9) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * ((k * (k * 100.0)) + (k * -10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -430.0], N[(a * N[(-1.0 / N[(k * (-k)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision] + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -430:\\
\;\;\;\;a \cdot \frac{-1}{k \cdot \left(-k\right)}\\
\mathbf{elif}\;m \leq 1.9:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100\right) + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -430Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.1%
+-commutative40.1%
unpow240.1%
distribute-rgt-in40.1%
fma-udef40.1%
Simplified40.1%
Taylor expanded in k around inf 64.9%
unpow264.9%
Simplified64.9%
frac-2neg64.9%
div-inv66.0%
distribute-rgt-neg-in66.0%
Applied egg-rr66.0%
if -430 < m < 1.8999999999999999Initial program 88.3%
associate-/l*88.3%
associate-+l+88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in m around 0 84.2%
+-commutative84.2%
unpow284.2%
distribute-rgt-in84.2%
fma-udef84.2%
Simplified84.2%
Taylor expanded in a around 0 84.2%
if 1.8999999999999999 < m Initial program 73.4%
associate-/l*73.4%
associate-+l+73.4%
*-commutative73.4%
Simplified73.4%
Taylor expanded in k around 0 74.7%
*-commutative74.7%
Simplified74.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 29.8%
+-commutative29.8%
unpow229.8%
associate-*r*29.8%
*-commutative29.8%
associate-*r*29.8%
*-commutative29.8%
distribute-rgt-out31.1%
associate-*l*31.1%
Simplified31.1%
Final simplification61.2%
(FPCore (a k m) :precision binary64 (if (<= m -430.0) (* a (/ -1.0 (* k (- k)))) (if (<= m 1.04e+15) (/ a (+ 1.0 (* k (+ k 10.0)))) (* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -430.0) {
tmp = a * (-1.0 / (k * -k));
} else if (m <= 1.04e+15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = k * (a * -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 <= (-430.0d0)) then
tmp = a * ((-1.0d0) / (k * -k))
else if (m <= 1.04d+15) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -430.0) {
tmp = a * (-1.0 / (k * -k));
} else if (m <= 1.04e+15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -430.0: tmp = a * (-1.0 / (k * -k)) elif m <= 1.04e+15: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -430.0) tmp = Float64(a * Float64(-1.0 / Float64(k * Float64(-k)))); elseif (m <= 1.04e+15) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -430.0) tmp = a * (-1.0 / (k * -k)); elseif (m <= 1.04e+15) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -430.0], N[(a * N[(-1.0 / N[(k * (-k)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.04e+15], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -430:\\
\;\;\;\;a \cdot \frac{-1}{k \cdot \left(-k\right)}\\
\mathbf{elif}\;m \leq 1.04 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < -430Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 40.1%
+-commutative40.1%
unpow240.1%
distribute-rgt-in40.1%
fma-udef40.1%
Simplified40.1%
Taylor expanded in k around inf 64.9%
unpow264.9%
Simplified64.9%
frac-2neg64.9%
div-inv66.0%
distribute-rgt-neg-in66.0%
Applied egg-rr66.0%
if -430 < m < 1.04e15Initial program 86.4%
associate-/l*86.4%
associate-+l+86.4%
*-commutative86.4%
Simplified86.4%
Taylor expanded in m around 0 81.3%
+-commutative81.3%
unpow281.3%
distribute-rgt-in81.3%
fma-udef81.3%
Simplified81.3%
Taylor expanded in a around 0 81.3%
if 1.04e15 < m Initial program 75.0%
associate-/l*75.0%
associate-+l+75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 3.2%
+-commutative3.2%
unpow23.2%
distribute-rgt-in3.2%
fma-udef3.2%
Simplified3.2%
Taylor expanded in k around 0 7.3%
Taylor expanded in k around inf 19.9%
*-commutative19.9%
associate-*r*19.9%
Simplified19.9%
Final simplification57.5%
(FPCore (a k m) :precision binary64 (if (<= k 1.92e-283) (/ a (* k k)) (if (<= k 0.1) (* a (+ 1.0 (* k -10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.92e-283) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a * (1.0 + (k * -10.0));
} 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 <= 1.92d-283) then
tmp = a / (k * k)
else if (k <= 0.1d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
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 <= 1.92e-283) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.92e-283: tmp = a / (k * k) elif k <= 0.1: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.92e-283) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.1) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.92e-283) tmp = a / (k * k); elseif (k <= 0.1) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.92e-283], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.92 \cdot 10^{-283}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.92000000000000002e-283Initial program 86.0%
associate-/l*86.0%
associate-+l+86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in m around 0 19.5%
+-commutative19.5%
unpow219.5%
distribute-rgt-in19.5%
fma-udef19.5%
Simplified19.5%
Taylor expanded in k around inf 35.5%
unpow235.5%
Simplified35.5%
if 1.92000000000000002e-283 < k < 0.10000000000000001Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 49.5%
+-commutative49.5%
unpow249.5%
distribute-rgt-in49.5%
fma-udef49.5%
Simplified49.5%
Taylor expanded in k around 0 49.5%
associate-*r*49.5%
distribute-rgt1-in49.5%
*-commutative49.5%
Applied egg-rr49.5%
if 0.10000000000000001 < k Initial program 79.8%
associate-/l*79.8%
associate-+l+79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in k around inf 79.1%
unpow279.1%
times-frac94.9%
rem-exp-log92.8%
div-exp92.8%
mul-1-neg92.8%
log-rec92.8%
distribute-lft-neg-in92.8%
remove-double-neg92.8%
div-exp92.8%
exp-to-pow92.8%
rem-exp-log94.9%
Simplified94.9%
clear-num93.7%
frac-times86.0%
*-un-lft-identity86.0%
Applied egg-rr86.0%
Taylor expanded in m around 0 59.1%
unpow259.1%
associate-/r*63.6%
Simplified63.6%
Final simplification49.9%
(FPCore (a k m) :precision binary64 (if (<= k 1.75e-279) (/ a (* k k)) (if (<= k 960.0) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.75e-279) {
tmp = a / (k * k);
} else if (k <= 960.0) {
tmp = a / (1.0 + (k * 10.0));
} 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 <= 1.75d-279) then
tmp = a / (k * k)
else if (k <= 960.0d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
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 <= 1.75e-279) {
tmp = a / (k * k);
} else if (k <= 960.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.75e-279: tmp = a / (k * k) elif k <= 960.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.75e-279) tmp = Float64(a / Float64(k * k)); elseif (k <= 960.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.75e-279) tmp = a / (k * k); elseif (k <= 960.0) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.75e-279], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 960.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.75 \cdot 10^{-279}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 960:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.75000000000000005e-279Initial program 86.0%
associate-/l*86.0%
associate-+l+86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in m around 0 19.5%
+-commutative19.5%
unpow219.5%
distribute-rgt-in19.5%
fma-udef19.5%
Simplified19.5%
Taylor expanded in k around inf 35.5%
unpow235.5%
Simplified35.5%
if 1.75000000000000005e-279 < k < 960Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 48.9%
if 960 < k Initial program 79.6%
associate-/l*79.6%
associate-+l+79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in k around inf 78.9%
unpow278.9%
times-frac94.8%
rem-exp-log92.7%
div-exp92.7%
mul-1-neg92.7%
log-rec92.7%
distribute-lft-neg-in92.7%
remove-double-neg92.7%
div-exp92.7%
exp-to-pow92.7%
rem-exp-log94.8%
Simplified94.8%
clear-num93.7%
frac-times85.8%
*-un-lft-identity85.8%
Applied egg-rr85.8%
Taylor expanded in m around 0 59.8%
unpow259.8%
associate-/r*64.2%
Simplified64.2%
Final simplification49.9%
(FPCore (a k m) :precision binary64 (if (or (<= k 4.7e-282) (not (<= k 2.75e-19))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 4.7e-282) || !(k <= 2.75e-19)) {
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 <= 4.7d-282) .or. (.not. (k <= 2.75d-19))) 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 <= 4.7e-282) || !(k <= 2.75e-19)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 4.7e-282) or not (k <= 2.75e-19): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 4.7e-282) || !(k <= 2.75e-19)) 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 <= 4.7e-282) || ~((k <= 2.75e-19))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 4.7e-282], N[Not[LessEqual[k, 2.75e-19]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4.7 \cdot 10^{-282} \lor \neg \left(k \leq 2.75 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 4.7e-282 or 2.7499999999999998e-19 < k Initial program 83.2%
associate-/l*83.2%
associate-+l+83.2%
*-commutative83.2%
Simplified83.2%
Taylor expanded in m around 0 40.2%
+-commutative40.2%
unpow240.2%
distribute-rgt-in40.2%
fma-udef40.2%
Simplified40.2%
Taylor expanded in k around inf 47.4%
unpow247.4%
Simplified47.4%
if 4.7e-282 < k < 2.7499999999999998e-19Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 99.9%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 50.6%
Final simplification48.3%
(FPCore (a k m) :precision binary64 (if (<= m -1e+18) (/ a (* k 10.0)) (if (<= m 1.04e+15) a (* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1e+18) {
tmp = a / (k * 10.0);
} else if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = k * (a * -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 <= (-1d+18)) then
tmp = a / (k * 10.0d0)
else if (m <= 1.04d+15) then
tmp = a
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1e+18) {
tmp = a / (k * 10.0);
} else if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1e+18: tmp = a / (k * 10.0) elif m <= 1.04e+15: tmp = a else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1e+18) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 1.04e+15) tmp = a; else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1e+18) tmp = a / (k * 10.0); elseif (m <= 1.04e+15) tmp = a; else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1e+18], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.04e+15], a, N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1 \cdot 10^{+18}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 1.04 \cdot 10^{+15}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < -1e18Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 15.6%
Taylor expanded in k around inf 20.4%
*-commutative20.4%
Simplified20.4%
if -1e18 < m < 1.04e15Initial program 86.9%
associate-/l*86.9%
associate-+l+86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in k around 0 51.7%
exp-to-pow54.1%
*-commutative54.1%
Simplified54.1%
Taylor expanded in m around 0 44.0%
if 1.04e15 < m Initial program 75.0%
associate-/l*75.0%
associate-+l+75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 3.2%
+-commutative3.2%
unpow23.2%
distribute-rgt-in3.2%
fma-udef3.2%
Simplified3.2%
Taylor expanded in k around 0 7.3%
Taylor expanded in k around inf 19.9%
*-commutative19.9%
associate-*r*19.9%
Simplified19.9%
Final simplification28.6%
(FPCore (a k m) :precision binary64 (if (<= k 3.4e-279) (/ a (* k k)) (if (<= k 2.75e-19) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 3.4e-279) {
tmp = a / (k * k);
} else if (k <= 2.75e-19) {
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 <= 3.4d-279) then
tmp = a / (k * k)
else if (k <= 2.75d-19) 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 <= 3.4e-279) {
tmp = a / (k * k);
} else if (k <= 2.75e-19) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 3.4e-279: tmp = a / (k * k) elif k <= 2.75e-19: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 3.4e-279) tmp = Float64(a / Float64(k * k)); elseif (k <= 2.75e-19) 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 <= 3.4e-279) tmp = a / (k * k); elseif (k <= 2.75e-19) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 3.4e-279], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 2.75e-19], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.4 \cdot 10^{-279}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 2.75 \cdot 10^{-19}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 3.40000000000000015e-279Initial program 86.0%
associate-/l*86.0%
associate-+l+86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in m around 0 19.5%
+-commutative19.5%
unpow219.5%
distribute-rgt-in19.5%
fma-udef19.5%
Simplified19.5%
Taylor expanded in k around inf 35.5%
unpow235.5%
Simplified35.5%
if 3.40000000000000015e-279 < k < 2.7499999999999998e-19Initial program 100.0%
associate-/l*100.0%
associate-+l+100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 99.9%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 50.6%
if 2.7499999999999998e-19 < k Initial program 80.6%
associate-/l*80.6%
associate-+l+80.6%
*-commutative80.6%
Simplified80.6%
Taylor expanded in k around inf 79.0%
unpow279.0%
times-frac94.1%
rem-exp-log92.2%
div-exp92.1%
mul-1-neg92.1%
log-rec92.1%
distribute-lft-neg-in92.1%
remove-double-neg92.1%
div-exp92.2%
exp-to-pow92.2%
rem-exp-log94.1%
Simplified94.1%
clear-num93.1%
frac-times85.6%
*-un-lft-identity85.6%
Applied egg-rr85.6%
Taylor expanded in m around 0 57.9%
unpow257.9%
associate-/r*62.2%
Simplified62.2%
Final simplification49.9%
(FPCore (a k m) :precision binary64 (if (<= m 1.04e+15) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = -10.0 * (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 (m <= 1.04d+15) then
tmp = a
else
tmp = (-10.0d0) * (k * a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.04e+15: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.04e+15) tmp = a; else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.04e+15) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.04e+15], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.04 \cdot 10^{+15}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.04e15Initial program 93.4%
associate-/l*93.4%
associate-+l+93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in k around 0 54.2%
exp-to-pow76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in m around 0 23.9%
if 1.04e15 < m Initial program 75.0%
associate-/l*75.0%
associate-+l+75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 3.2%
+-commutative3.2%
unpow23.2%
distribute-rgt-in3.2%
fma-udef3.2%
Simplified3.2%
Taylor expanded in k around 0 7.3%
Taylor expanded in k around inf 19.9%
Final simplification22.7%
(FPCore (a k m) :precision binary64 (if (<= m 1.04e+15) a (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = k * (a * -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 <= 1.04d+15) then
tmp = a
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.04e+15) {
tmp = a;
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.04e+15: tmp = a else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.04e+15) tmp = a; else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.04e+15) tmp = a; else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.04e+15], a, N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.04 \cdot 10^{+15}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 1.04e15Initial program 93.4%
associate-/l*93.4%
associate-+l+93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in k around 0 54.2%
exp-to-pow76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in m around 0 23.9%
if 1.04e15 < m Initial program 75.0%
associate-/l*75.0%
associate-+l+75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 3.2%
+-commutative3.2%
unpow23.2%
distribute-rgt-in3.2%
fma-udef3.2%
Simplified3.2%
Taylor expanded in k around 0 7.3%
Taylor expanded in k around inf 19.9%
*-commutative19.9%
associate-*r*19.9%
Simplified19.9%
Final simplification22.7%
(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 88.0%
associate-/l*88.0%
associate-+l+88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in k around 0 53.3%
exp-to-pow83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in m around 0 18.0%
Final simplification18.0%
herbie shell --seed 2023176
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))