
(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 15 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 0.255) (* a (pow k m)) (* (/ a k) (/ (/ 1.0 (/ 1.0 (pow k m))) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.255) {
tmp = a * pow(k, m);
} else {
tmp = (a / k) * ((1.0 / (1.0 / 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 <= 0.255d0) then
tmp = a * (k ** m)
else
tmp = (a / k) * ((1.0d0 / (1.0d0 / (k ** m))) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.255) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a / k) * ((1.0 / (1.0 / Math.pow(k, m))) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.255: tmp = a * math.pow(k, m) else: tmp = (a / k) * ((1.0 / (1.0 / math.pow(k, m))) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.255) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a / k) * Float64(Float64(1.0 / Float64(1.0 / (k ^ m))) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.255) tmp = a * (k ^ m); else tmp = (a / k) * ((1.0 / (1.0 / (k ^ m))) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.255], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(N[(1.0 / N[(1.0 / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.255:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{\frac{1}{\frac{1}{{k}^{m}}}}{k}\\
\end{array}
\end{array}
if k < 0.255Initial program 94.0%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in k around 0 52.1%
exp-to-pow99.1%
*-commutative99.1%
Simplified99.1%
if 0.255 < k Initial program 75.7%
associate-/l*75.7%
associate-+l+75.7%
*-commutative75.7%
Simplified75.7%
Taylor expanded in k around inf 74.2%
unpow274.2%
Simplified74.2%
Taylor expanded in k around inf 74.2%
unpow274.2%
times-frac94.6%
mul-1-neg94.6%
exp-neg94.6%
log-rec94.6%
distribute-lft-neg-in94.6%
rec-exp94.6%
exp-to-pow94.6%
Simplified94.6%
Final simplification97.3%
(FPCore (a k m) :precision binary64 (if (<= m 2.8) (/ a (/ (+ 1.0 (* k k)) (pow k m))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.8) {
tmp = a / ((1.0 + (k * k)) / pow(k, m));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.8d0) then
tmp = a / ((1.0d0 + (k * k)) / (k ** m))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.8) {
tmp = a / ((1.0 + (k * k)) / Math.pow(k, m));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.8: tmp = a / ((1.0 + (k * k)) / math.pow(k, m)) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.8) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * k)) / (k ^ m))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.8) tmp = a / ((1.0 + (k * k)) / (k ^ m)); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.8], N[(a / N[(N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.8:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot k}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.7999999999999998Initial program 94.9%
associate-/l*94.9%
associate-+l+95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in k around inf 93.3%
unpow293.3%
Simplified93.3%
if 2.7999999999999998 < m Initial program 70.1%
associate-*r/70.1%
associate-+l+70.1%
+-commutative70.1%
distribute-rgt-out70.1%
fma-def70.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in k around 0 56.3%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification95.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -1.5e-9) (not (<= m 2.7e-11))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -1.5e-9) || !(m <= 2.7e-11)) {
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 <= (-1.5d-9)) .or. (.not. (m <= 2.7d-11))) 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 <= -1.5e-9) || !(m <= 2.7e-11)) {
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 <= -1.5e-9) or not (m <= 2.7e-11): 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 <= -1.5e-9) || !(m <= 2.7e-11)) 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 <= -1.5e-9) || ~((m <= 2.7e-11))) 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, -1.5e-9], N[Not[LessEqual[m, 2.7e-11]], $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 -1.5 \cdot 10^{-9} \lor \neg \left(m \leq 2.7 \cdot 10^{-11}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.49999999999999999e-9 or 2.70000000000000005e-11 < m Initial program 84.5%
associate-*r/84.5%
associate-+l+84.5%
+-commutative84.5%
distribute-rgt-out84.5%
fma-def84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in k around 0 57.2%
exp-to-pow99.4%
*-commutative99.4%
Simplified99.4%
if -1.49999999999999999e-9 < m < 2.70000000000000005e-11Initial program 90.3%
associate-*r/90.2%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out90.3%
fma-def90.3%
+-commutative90.3%
Simplified90.3%
Taylor expanded in m around 0 90.3%
Final simplification96.3%
(FPCore (a k m) :precision binary64 (if (<= m -2e-7) (/ a (pow k (- m))) (if (<= m 2.7e-11) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2e-7) {
tmp = a / pow(k, -m);
} else if (m <= 2.7e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-2d-7)) then
tmp = a / (k ** -m)
else if (m <= 2.7d-11) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -2e-7) {
tmp = a / Math.pow(k, -m);
} else if (m <= 2.7e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2e-7: tmp = a / math.pow(k, -m) elif m <= 2.7e-11: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2e-7) tmp = Float64(a / (k ^ Float64(-m))); elseif (m <= 2.7e-11) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -2e-7) tmp = a / (k ^ -m); elseif (m <= 2.7e-11) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2e-7], N[(a / N[Power[k, (-m)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.7e-11], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2 \cdot 10^{-7}:\\
\;\;\;\;\frac{a}{{k}^{\left(-m\right)}}\\
\mathbf{elif}\;m \leq 2.7 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -1.9999999999999999e-7Initial 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 k around 0 100.0%
Taylor expanded in k around 0 57.7%
rec-exp57.7%
distribute-rgt-neg-out57.7%
exp-to-pow100.0%
Simplified100.0%
if -1.9999999999999999e-7 < m < 2.70000000000000005e-11Initial program 90.3%
associate-*r/90.2%
associate-+l+90.3%
+-commutative90.3%
distribute-rgt-out90.3%
fma-def90.3%
+-commutative90.3%
Simplified90.3%
Taylor expanded in m around 0 90.3%
if 2.70000000000000005e-11 < m Initial program 71.1%
associate-*r/71.1%
associate-+l+71.1%
+-commutative71.1%
distribute-rgt-out71.1%
fma-def71.1%
+-commutative71.1%
Simplified71.1%
Taylor expanded in k around 0 56.7%
exp-to-pow99.0%
*-commutative99.0%
Simplified99.0%
Final simplification96.3%
(FPCore (a k m)
:precision binary64
(if (<= m -59000000000.0)
(/ a (* k k))
(if (<= m 1.95)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (+ (* k -10.0) (* k (* k 100.0))))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * ((k * -10.0) + (k * (k * 100.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 <= (-59000000000.0d0)) then
tmp = a / (k * k)
else if (m <= 1.95d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * ((k * (-10.0d0)) + (k * (k * 100.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * ((k * -10.0) + (k * (k * 100.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -59000000000.0: tmp = a / (k * k) elif m <= 1.95: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * ((k * -10.0) + (k * (k * 100.0)))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -59000000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.95) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(Float64(k * -10.0) + Float64(k * Float64(k * 100.0))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -59000000000.0) tmp = a / (k * k); elseif (m <= 1.95) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * ((k * -10.0) + (k * (k * 100.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -59000000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.95], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(N[(k * -10.0), $MachinePrecision] + N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -59000000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.95:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot -10 + k \cdot \left(k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -5.9e10Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
Taylor expanded in k around inf 59.1%
unpow259.1%
Simplified59.1%
if -5.9e10 < m < 1.94999999999999996Initial program 90.9%
associate-*r/90.8%
associate-+l+90.9%
+-commutative90.9%
distribute-rgt-out90.9%
fma-def90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in m around 0 88.0%
if 1.94999999999999996 < m Initial program 70.1%
associate-*r/70.1%
associate-+l+70.1%
+-commutative70.1%
distribute-rgt-out70.1%
fma-def70.1%
+-commutative70.1%
Simplified70.1%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 2.8%
*-commutative2.8%
Simplified2.8%
Taylor expanded in k around 0 29.1%
associate-*r*29.1%
associate-*r*29.1%
*-commutative29.1%
distribute-rgt-out39.5%
*-commutative39.5%
unpow239.5%
associate-*l*39.5%
Simplified39.5%
Final simplification63.0%
(FPCore (a k m) :precision binary64 (if (<= m -59000000000.0) (/ a (* k k)) (if (<= m 700000000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 700000000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} 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 <= (-59000000000.0d0)) then
tmp = a / (k * k)
else if (m <= 700000000.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
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 <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 700000000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -59000000000.0: tmp = a / (k * k) elif m <= 700000000.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -59000000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 700000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -59000000000.0) tmp = a / (k * k); elseif (m <= 700000000.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -59000000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 700000000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -59000000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 700000000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -5.9e10Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
Taylor expanded in k around inf 59.1%
unpow259.1%
Simplified59.1%
if -5.9e10 < m < 7e8Initial program 90.2%
associate-*r/90.1%
associate-+l+90.1%
+-commutative90.1%
distribute-rgt-out90.1%
fma-def90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in m around 0 85.4%
if 7e8 < m Initial program 70.2%
associate-*r/70.2%
associate-+l+70.2%
+-commutative70.2%
distribute-rgt-out70.2%
fma-def70.2%
+-commutative70.2%
Simplified70.2%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in k around inf 18.4%
Final simplification55.7%
(FPCore (a k m) :precision binary64 (if (<= k 3.9e-301) (/ a (* k k)) (if (<= k 0.26) (* a (+ 1.0 (* k -10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 3.9e-301) {
tmp = a / (k * k);
} else if (k <= 0.26) {
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 <= 3.9d-301) then
tmp = a / (k * k)
else if (k <= 0.26d0) 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 <= 3.9e-301) {
tmp = a / (k * k);
} else if (k <= 0.26) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 3.9e-301: tmp = a / (k * k) elif k <= 0.26: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 3.9e-301) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.26) 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 <= 3.9e-301) tmp = a / (k * k); elseif (k <= 0.26) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 3.9e-301], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.26], 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 3.9 \cdot 10^{-301}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.26:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 3.9000000000000001e-301Initial program 87.7%
associate-*r/87.7%
associate-+l+87.7%
+-commutative87.7%
distribute-rgt-out87.7%
fma-def87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in m around 0 20.7%
Taylor expanded in k around inf 32.0%
unpow232.0%
Simplified32.0%
if 3.9000000000000001e-301 < k < 0.26000000000000001Initial program 99.9%
associate-*r/99.9%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 52.2%
Taylor expanded in k around 0 51.5%
*-commutative51.5%
Simplified51.5%
if 0.26000000000000001 < k Initial program 75.5%
associate-*r/75.4%
associate-+l+75.4%
+-commutative75.4%
distribute-rgt-out75.4%
fma-def75.4%
+-commutative75.4%
Simplified75.4%
Taylor expanded in m around 0 53.6%
Taylor expanded in k around inf 52.1%
unpow252.1%
Simplified52.1%
associate-/r*58.4%
div-inv58.4%
Applied egg-rr58.4%
un-div-inv58.4%
Applied egg-rr58.4%
Final simplification48.8%
(FPCore (a k m) :precision binary64 (if (<= k 1.9e-300) (/ a (* k k)) (if (<= k 0.26) (* a (+ 1.0 (* k -10.0))) (* (/ a k) (/ 1.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.9e-300) {
tmp = a / (k * k);
} else if (k <= 0.26) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) * (1.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 (k <= 1.9d-300) then
tmp = a / (k * k)
else if (k <= 0.26d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = (a / k) * (1.0d0 / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.9e-300) {
tmp = a / (k * k);
} else if (k <= 0.26) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) * (1.0 / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.9e-300: tmp = a / (k * k) elif k <= 0.26: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) * (1.0 / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.9e-300) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.26) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(Float64(a / k) * Float64(1.0 / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.9e-300) tmp = a / (k * k); elseif (k <= 0.26) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) * (1.0 / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.9e-300], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.26], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.9 \cdot 10^{-300}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.26:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
\end{array}
\end{array}
if k < 1.90000000000000006e-300Initial program 87.7%
associate-*r/87.7%
associate-+l+87.7%
+-commutative87.7%
distribute-rgt-out87.7%
fma-def87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in m around 0 20.7%
Taylor expanded in k around inf 32.0%
unpow232.0%
Simplified32.0%
if 1.90000000000000006e-300 < k < 0.26000000000000001Initial program 99.9%
associate-*r/99.9%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 52.2%
Taylor expanded in k around 0 51.5%
*-commutative51.5%
Simplified51.5%
if 0.26000000000000001 < k Initial program 75.5%
associate-*r/75.4%
associate-+l+75.4%
+-commutative75.4%
distribute-rgt-out75.4%
fma-def75.4%
+-commutative75.4%
Simplified75.4%
Taylor expanded in m around 0 53.6%
Taylor expanded in k around inf 52.1%
unpow252.1%
Simplified52.1%
associate-/r*58.4%
div-inv58.4%
Applied egg-rr58.4%
Final simplification48.8%
(FPCore (a k m) :precision binary64 (if (<= k 1.45e-300) (/ a (* k k)) (if (<= k 3.2) (/ a (+ 1.0 (* k 10.0))) (* (/ a k) (/ 1.0 k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.45e-300) {
tmp = a / (k * k);
} else if (k <= 3.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) * (1.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 (k <= 1.45d-300) then
tmp = a / (k * k)
else if (k <= 3.2d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / k) * (1.0d0 / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.45e-300) {
tmp = a / (k * k);
} else if (k <= 3.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) * (1.0 / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.45e-300: tmp = a / (k * k) elif k <= 3.2: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) * (1.0 / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.45e-300) tmp = Float64(a / Float64(k * k)); elseif (k <= 3.2) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) * Float64(1.0 / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.45e-300) tmp = a / (k * k); elseif (k <= 3.2) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) * (1.0 / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.45e-300], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.2], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.45 \cdot 10^{-300}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 3.2:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
\end{array}
\end{array}
if k < 1.44999999999999996e-300Initial program 87.7%
associate-*r/87.7%
associate-+l+87.7%
+-commutative87.7%
distribute-rgt-out87.7%
fma-def87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in m around 0 20.7%
Taylor expanded in k around inf 32.0%
unpow232.0%
Simplified32.0%
if 1.44999999999999996e-300 < k < 3.2000000000000002Initial program 99.9%
associate-*r/99.9%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 52.2%
Taylor expanded in k around 0 51.8%
*-commutative51.8%
Simplified51.8%
if 3.2000000000000002 < k Initial program 75.5%
associate-*r/75.4%
associate-+l+75.4%
+-commutative75.4%
distribute-rgt-out75.4%
fma-def75.4%
+-commutative75.4%
Simplified75.4%
Taylor expanded in m around 0 53.6%
Taylor expanded in k around inf 52.1%
unpow252.1%
Simplified52.1%
associate-/r*58.4%
div-inv58.4%
Applied egg-rr58.4%
Final simplification48.9%
(FPCore (a k m) :precision binary64 (if (<= m -59000000000.0) (/ a (* k k)) (if (<= m 80000000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 80000000000.0) {
tmp = a / (1.0 + (k * k));
} 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 <= (-59000000000.0d0)) then
tmp = a / (k * k)
else if (m <= 80000000000.0d0) then
tmp = a / (1.0d0 + (k * k))
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 <= -59000000000.0) {
tmp = a / (k * k);
} else if (m <= 80000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -59000000000.0: tmp = a / (k * k) elif m <= 80000000000.0: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -59000000000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 80000000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(-10.0 * Float64(k * a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -59000000000.0) tmp = a / (k * k); elseif (m <= 80000000000.0) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -59000000000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 80000000000.0], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -59000000000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 80000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -5.9e10Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 35.8%
Taylor expanded in k around inf 59.1%
unpow259.1%
Simplified59.1%
if -5.9e10 < m < 8e10Initial program 90.2%
associate-*r/90.1%
associate-+l+90.1%
+-commutative90.1%
distribute-rgt-out90.1%
fma-def90.1%
+-commutative90.1%
Simplified90.1%
Taylor expanded in m around 0 85.4%
Taylor expanded in k around inf 82.4%
unpow282.4%
Simplified82.4%
if 8e10 < m Initial program 70.2%
associate-*r/70.2%
associate-+l+70.2%
+-commutative70.2%
distribute-rgt-out70.2%
fma-def70.2%
+-commutative70.2%
Simplified70.2%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in k around inf 18.4%
Final simplification54.6%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.9e-300) (not (<= k 3.3))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.9e-300) || !(k <= 3.3)) {
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 <= 1.9d-300) .or. (.not. (k <= 3.3d0))) 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 <= 1.9e-300) || !(k <= 3.3)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.9e-300) or not (k <= 3.3): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.9e-300) || !(k <= 3.3)) 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 <= 1.9e-300) || ~((k <= 3.3))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.9e-300], N[Not[LessEqual[k, 3.3]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.9 \cdot 10^{-300} \lor \neg \left(k \leq 3.3\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.90000000000000006e-300 or 3.2999999999999998 < k Initial program 80.4%
associate-*r/80.4%
associate-+l+80.4%
+-commutative80.4%
distribute-rgt-out80.4%
fma-def80.4%
+-commutative80.4%
Simplified80.4%
Taylor expanded in m around 0 40.2%
Taylor expanded in k around inf 44.1%
unpow244.1%
Simplified44.1%
if 1.90000000000000006e-300 < k < 3.2999999999999998Initial program 99.9%
associate-*r/99.9%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.6%
Taylor expanded in k around 0 50.0%
Final simplification45.9%
(FPCore (a k m) :precision binary64 (if (<= m -6.4e-56) (* (/ a k) 0.1) (if (<= m 41000000000.0) a (* -10.0 (* k a)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -6.4e-56) {
tmp = (a / k) * 0.1;
} else if (m <= 41000000000.0) {
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 <= (-6.4d-56)) then
tmp = (a / k) * 0.1d0
else if (m <= 41000000000.0d0) 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 <= -6.4e-56) {
tmp = (a / k) * 0.1;
} else if (m <= 41000000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -6.4e-56: tmp = (a / k) * 0.1 elif m <= 41000000000.0: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -6.4e-56) tmp = Float64(Float64(a / k) * 0.1); elseif (m <= 41000000000.0) 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 <= -6.4e-56) tmp = (a / k) * 0.1; elseif (m <= 41000000000.0) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -6.4e-56], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], If[LessEqual[m, 41000000000.0], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -6.4 \cdot 10^{-56}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{elif}\;m \leq 41000000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < -6.39999999999999971e-56Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 43.9%
Taylor expanded in k around 0 21.0%
*-commutative21.0%
Simplified21.0%
Taylor expanded in k around inf 24.3%
if -6.39999999999999971e-56 < m < 4.1e10Initial program 88.7%
associate-*r/88.6%
associate-+l+88.6%
+-commutative88.6%
distribute-rgt-out88.6%
fma-def88.6%
+-commutative88.6%
Simplified88.6%
Taylor expanded in m around 0 84.6%
Taylor expanded in k around 0 46.4%
if 4.1e10 < m Initial program 70.2%
associate-*r/70.2%
associate-+l+70.2%
+-commutative70.2%
distribute-rgt-out70.2%
fma-def70.2%
+-commutative70.2%
Simplified70.2%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in k around inf 18.4%
Final simplification29.6%
(FPCore (a k m) :precision binary64 (if (<= k 2.1e-300) (/ a (* k k)) (if (<= k 3.3) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.1e-300) {
tmp = a / (k * k);
} else if (k <= 3.3) {
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 <= 2.1d-300) then
tmp = a / (k * k)
else if (k <= 3.3d0) 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 <= 2.1e-300) {
tmp = a / (k * k);
} else if (k <= 3.3) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.1e-300: tmp = a / (k * k) elif k <= 3.3: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.1e-300) tmp = Float64(a / Float64(k * k)); elseif (k <= 3.3) 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 <= 2.1e-300) tmp = a / (k * k); elseif (k <= 3.3) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.1e-300], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 3.3], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.1 \cdot 10^{-300}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 3.3:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 2.10000000000000004e-300Initial program 87.7%
associate-*r/87.7%
associate-+l+87.7%
+-commutative87.7%
distribute-rgt-out87.7%
fma-def87.7%
+-commutative87.7%
Simplified87.7%
Taylor expanded in m around 0 20.7%
Taylor expanded in k around inf 32.0%
unpow232.0%
Simplified32.0%
if 2.10000000000000004e-300 < k < 3.2999999999999998Initial program 99.9%
associate-*r/99.9%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 51.6%
Taylor expanded in k around 0 50.0%
if 3.2999999999999998 < k Initial program 75.3%
associate-*r/75.2%
associate-+l+75.2%
+-commutative75.2%
distribute-rgt-out75.2%
fma-def75.2%
+-commutative75.2%
Simplified75.2%
Taylor expanded in m around 0 54.1%
Taylor expanded in k around inf 52.6%
unpow252.6%
Simplified52.6%
associate-/r*58.9%
div-inv59.0%
Applied egg-rr59.0%
un-div-inv58.9%
Applied egg-rr58.9%
Final simplification48.5%
(FPCore (a k m) :precision binary64 (if (<= m 1900000000.0) a (* -10.0 (* k a))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1900000000.0) {
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 <= 1900000000.0d0) 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 <= 1900000000.0) {
tmp = a;
} else {
tmp = -10.0 * (k * a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1900000000.0: tmp = a else: tmp = -10.0 * (k * a) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1900000000.0) 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 <= 1900000000.0) tmp = a; else tmp = -10.0 * (k * a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1900000000.0], a, N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1900000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(k \cdot a\right)\\
\end{array}
\end{array}
if m < 1.9e9Initial program 94.5%
associate-*r/94.4%
associate-+l+94.4%
+-commutative94.4%
distribute-rgt-out94.4%
fma-def94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in m around 0 63.8%
Taylor expanded in k around 0 25.8%
if 1.9e9 < m Initial program 70.2%
associate-*r/70.2%
associate-+l+70.2%
+-commutative70.2%
distribute-rgt-out70.2%
fma-def70.2%
+-commutative70.2%
Simplified70.2%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in k around inf 18.4%
Final simplification23.4%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 86.5%
associate-*r/86.5%
associate-+l+86.5%
+-commutative86.5%
distribute-rgt-out86.5%
fma-def86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in m around 0 43.8%
Taylor expanded in k around 0 18.6%
Final simplification18.6%
herbie shell --seed 2023242
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))