
(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 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (if (<= m 8.8e-30) (/ a (/ (fma k k (fma k 10.0 1.0)) (pow k m))) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.8e-30) {
tmp = a / (fma(k, k, fma(k, 10.0, 1.0)) / pow(k, m));
} else {
tmp = a * pow(k, (m - 2.0));
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if (m <= 8.8e-30) tmp = Float64(a / Float64(fma(k, k, fma(k, 10.0, 1.0)) / (k ^ m))); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
code[a_, k_, m_] := If[LessEqual[m, 8.8e-30], N[(a / N[(N[(k * k + N[(k * 10.0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{a}{\frac{\mathsf{fma}\left(k, k, \mathsf{fma}\left(k, 10, 1\right)\right)}{{k}^{m}}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if m < 8.79999999999999933e-30Initial program 97.7%
associate-/l*97.7%
sqr-neg97.7%
+-commutative97.7%
sqr-neg97.7%
fma-def97.7%
+-commutative97.7%
*-commutative97.7%
fma-def97.7%
Simplified97.7%
if 8.79999999999999933e-30 < m Initial program 80.4%
associate-*r/80.4%
*-commutative80.4%
sqr-neg80.4%
associate-+l+80.4%
+-commutative80.4%
sqr-neg80.4%
distribute-rgt-out80.4%
fma-def80.4%
+-commutative80.4%
Simplified80.4%
associate-*l/80.4%
fma-udef80.4%
distribute-rgt-in80.4%
associate-+r+80.4%
+-commutative80.4%
+-commutative80.4%
associate-/l*75.3%
+-commutative75.3%
+-commutative75.3%
associate-+r+75.3%
distribute-rgt-in75.3%
fma-udef75.3%
Applied egg-rr75.3%
Taylor expanded in k around inf 44.3%
unpow244.3%
Simplified44.3%
associate-/r/54.6%
pow254.6%
pow-div100.0%
Applied egg-rr100.0%
Final simplification98.6%
(FPCore (a k m) :precision binary64 (if (<= m 8.8e-30) (/ (* a (pow k m)) (+ (+ 1.0 (* k 10.0)) (* k k))) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 8.8e-30) {
tmp = (a * pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = a * pow(k, (m - 2.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 <= 8.8d-30) then
tmp = (a * (k ** m)) / ((1.0d0 + (k * 10.0d0)) + (k * k))
else
tmp = a * (k ** (m - 2.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 8.8e-30) {
tmp = (a * Math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k));
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 8.8e-30: tmp = (a * math.pow(k, m)) / ((1.0 + (k * 10.0)) + (k * k)) else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 8.8e-30) tmp = Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 8.8e-30) tmp = (a * (k ^ m)) / ((1.0 + (k * 10.0)) + (k * k)); else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 8.8e-30], N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 8.8 \cdot 10^{-30}:\\
\;\;\;\;\frac{a \cdot {k}^{m}}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if m < 8.79999999999999933e-30Initial program 97.7%
if 8.79999999999999933e-30 < m Initial program 80.4%
associate-*r/80.4%
*-commutative80.4%
sqr-neg80.4%
associate-+l+80.4%
+-commutative80.4%
sqr-neg80.4%
distribute-rgt-out80.4%
fma-def80.4%
+-commutative80.4%
Simplified80.4%
associate-*l/80.4%
fma-udef80.4%
distribute-rgt-in80.4%
associate-+r+80.4%
+-commutative80.4%
+-commutative80.4%
associate-/l*75.3%
+-commutative75.3%
+-commutative75.3%
associate-+r+75.3%
distribute-rgt-in75.3%
fma-udef75.3%
Applied egg-rr75.3%
Taylor expanded in k around inf 44.3%
unpow244.3%
Simplified44.3%
associate-/r/54.6%
pow254.6%
pow-div100.0%
Applied egg-rr100.0%
Final simplification98.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.000215) (not (<= m 1.46e-8))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.000215) || !(m <= 1.46e-8)) {
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 <= (-0.000215d0)) .or. (.not. (m <= 1.46d-8))) 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 <= -0.000215) || !(m <= 1.46e-8)) {
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 <= -0.000215) or not (m <= 1.46e-8): 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 <= -0.000215) || !(m <= 1.46e-8)) 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 <= -0.000215) || ~((m <= 1.46e-8))) 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, -0.000215], N[Not[LessEqual[m, 1.46e-8]], $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 -0.000215 \lor \neg \left(m \leq 1.46 \cdot 10^{-8}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -2.14999999999999995e-4 or 1.46e-8 < m Initial program 89.0%
associate-*r/89.0%
*-commutative89.0%
sqr-neg89.0%
associate-+l+89.0%
+-commutative89.0%
sqr-neg89.0%
distribute-rgt-out89.0%
fma-def89.0%
+-commutative89.0%
Simplified89.0%
Taylor expanded in k around 0 100.0%
if -2.14999999999999995e-4 < m < 1.46e-8Initial program 95.6%
associate-*r/95.5%
*-commutative95.5%
sqr-neg95.5%
associate-+l+95.5%
+-commutative95.5%
sqr-neg95.5%
distribute-rgt-out95.5%
fma-def95.5%
+-commutative95.5%
Simplified95.5%
Taylor expanded in m around 0 94.8%
Final simplification98.3%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (* a (pow k (- m 2.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = a * pow(k, (m - 2.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.0d0) then
tmp = a * (k ** m)
else
tmp = a * (k ** (m - 2.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * Math.pow(k, (m - 2.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = a * math.pow(k, (m - 2.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * (k ^ Float64(m - 2.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = a * (k ^ (m - 2.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, N[(m - 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{\left(m - 2\right)}\\
\end{array}
\end{array}
if k < 1Initial program 94.6%
associate-*r/94.6%
*-commutative94.6%
sqr-neg94.6%
associate-+l+94.6%
+-commutative94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
fma-def94.6%
+-commutative94.6%
Simplified94.6%
Taylor expanded in k around 0 98.3%
if 1 < k Initial program 84.7%
associate-*r/84.6%
*-commutative84.6%
sqr-neg84.6%
associate-+l+84.6%
+-commutative84.6%
sqr-neg84.6%
distribute-rgt-out84.6%
fma-def84.6%
+-commutative84.6%
Simplified84.6%
associate-*l/84.7%
fma-udef84.7%
distribute-rgt-in84.7%
associate-+r+84.7%
+-commutative84.7%
+-commutative84.7%
associate-/l*83.5%
+-commutative83.5%
+-commutative83.5%
associate-+r+83.5%
distribute-rgt-in83.5%
fma-udef83.5%
Applied egg-rr83.5%
Taylor expanded in k around inf 83.4%
unpow283.4%
Simplified83.4%
associate-/r/84.5%
pow284.5%
pow-div95.9%
Applied egg-rr95.9%
Final simplification97.5%
(FPCore (a k m)
:precision binary64
(if (or (<= k -2.3e-293)
(and (not (<= k 3.2e-218)) (or (<= k 7e-159) (not (<= k 65.0)))))
(/ a (* k k))
a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -2.3e-293) || (!(k <= 3.2e-218) && ((k <= 7e-159) || !(k <= 65.0)))) {
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.3d-293)) .or. (.not. (k <= 3.2d-218)) .and. (k <= 7d-159) .or. (.not. (k <= 65.0d0))) 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.3e-293) || (!(k <= 3.2e-218) && ((k <= 7e-159) || !(k <= 65.0)))) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -2.3e-293) or (not (k <= 3.2e-218) and ((k <= 7e-159) or not (k <= 65.0))): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -2.3e-293) || (!(k <= 3.2e-218) && ((k <= 7e-159) || !(k <= 65.0)))) 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.3e-293) || (~((k <= 3.2e-218)) && ((k <= 7e-159) || ~((k <= 65.0))))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -2.3e-293], And[N[Not[LessEqual[k, 3.2e-218]], $MachinePrecision], Or[LessEqual[k, 7e-159], N[Not[LessEqual[k, 65.0]], $MachinePrecision]]]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2.3 \cdot 10^{-293} \lor \neg \left(k \leq 3.2 \cdot 10^{-218}\right) \land \left(k \leq 7 \cdot 10^{-159} \lor \neg \left(k \leq 65\right)\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -2.29999999999999995e-293 or 3.2000000000000001e-218 < k < 7.00000000000000005e-159 or 65 < k Initial program 87.4%
associate-*r/87.3%
*-commutative87.3%
sqr-neg87.3%
associate-+l+87.3%
+-commutative87.3%
sqr-neg87.3%
distribute-rgt-out87.3%
fma-def87.3%
+-commutative87.3%
Simplified87.3%
Taylor expanded in m around 0 37.0%
Taylor expanded in k around inf 44.2%
unpow244.2%
Simplified44.2%
if -2.29999999999999995e-293 < k < 3.2000000000000001e-218 or 7.00000000000000005e-159 < k < 65Initial program 99.9%
associate-*r/99.9%
*-commutative99.9%
sqr-neg99.9%
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 50.1%
Taylor expanded in k around 0 46.5%
Final simplification44.9%
(FPCore (a k m)
:precision binary64
(if (<= m -24500000.0)
(/ a (* k k))
(if (<= m 1.25e+77)
(/ a (+ 1.0 (* k k)))
(if (<= m 2.15e+285) (* a (+ 1.0 (* k -10.0))) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -24500000.0) {
tmp = a / (k * k);
} else if (m <= 1.25e+77) {
tmp = a / (1.0 + (k * k));
} else if (m <= 2.15e+285) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-24500000.0d0)) then
tmp = a / (k * k)
else if (m <= 1.25d+77) then
tmp = a / (1.0d0 + (k * k))
else if (m <= 2.15d+285) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -24500000.0) {
tmp = a / (k * k);
} else if (m <= 1.25e+77) {
tmp = a / (1.0 + (k * k));
} else if (m <= 2.15e+285) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -24500000.0: tmp = a / (k * k) elif m <= 1.25e+77: tmp = a / (1.0 + (k * k)) elif m <= 2.15e+285: tmp = a * (1.0 + (k * -10.0)) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -24500000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.25e+77) tmp = Float64(a / Float64(1.0 + Float64(k * k))); elseif (m <= 2.15e+285) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -24500000.0) tmp = a / (k * k); elseif (m <= 1.25e+77) tmp = a / (1.0 + (k * k)); elseif (m <= 2.15e+285) tmp = a * (1.0 + (k * -10.0)); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -24500000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.25e+77], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.15e+285], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], a]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -24500000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.25 \cdot 10^{+77}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq 2.15 \cdot 10^{+285}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -2.45e7Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.0%
Taylor expanded in k around inf 62.6%
unpow262.6%
Simplified62.6%
if -2.45e7 < m < 1.25000000000000001e77Initial program 92.5%
associate-*r/92.4%
*-commutative92.4%
sqr-neg92.4%
associate-+l+92.4%
+-commutative92.4%
sqr-neg92.4%
distribute-rgt-out92.5%
fma-def92.5%
+-commutative92.5%
Simplified92.5%
Taylor expanded in m around 0 77.8%
Taylor expanded in k around inf 75.0%
unpow275.0%
Simplified75.0%
if 1.25000000000000001e77 < m < 2.15e285Initial program 81.4%
associate-*r/81.4%
*-commutative81.4%
sqr-neg81.4%
associate-+l+81.4%
+-commutative81.4%
sqr-neg81.4%
distribute-rgt-out81.4%
fma-def81.4%
+-commutative81.4%
Simplified81.4%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 8.6%
*-commutative8.6%
Simplified8.6%
if 2.15e285 < m Initial program 71.4%
associate-*r/71.4%
*-commutative71.4%
sqr-neg71.4%
associate-+l+71.4%
+-commutative71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
fma-def71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 3.7%
Final simplification51.2%
(FPCore (a k m)
:precision binary64
(if (<= m -24500000.0)
(/ a (* k k))
(if (<= m 3.6e+77)
(/ a (+ 1.0 (* k (+ k 10.0))))
(if (<= m 2.15e+285) (* a (+ 1.0 (* k -10.0))) a))))
double code(double a, double k, double m) {
double tmp;
if (m <= -24500000.0) {
tmp = a / (k * k);
} else if (m <= 3.6e+77) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.15e+285) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-24500000.0d0)) then
tmp = a / (k * k)
else if (m <= 3.6d+77) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else if (m <= 2.15d+285) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -24500000.0) {
tmp = a / (k * k);
} else if (m <= 3.6e+77) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.15e+285) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -24500000.0: tmp = a / (k * k) elif m <= 3.6e+77: tmp = a / (1.0 + (k * (k + 10.0))) elif m <= 2.15e+285: tmp = a * (1.0 + (k * -10.0)) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -24500000.0) tmp = Float64(a / Float64(k * k)); elseif (m <= 3.6e+77) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); elseif (m <= 2.15e+285) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -24500000.0) tmp = a / (k * k); elseif (m <= 3.6e+77) tmp = a / (1.0 + (k * (k + 10.0))); elseif (m <= 2.15e+285) tmp = a * (1.0 + (k * -10.0)); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -24500000.0], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.6e+77], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.15e+285], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], a]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -24500000:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 3.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2.15 \cdot 10^{+285}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -2.45e7Initial program 100.0%
associate-*r/100.0%
*-commutative100.0%
sqr-neg100.0%
associate-+l+100.0%
+-commutative100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 30.0%
Taylor expanded in k around inf 62.6%
unpow262.6%
Simplified62.6%
if -2.45e7 < m < 3.5999999999999998e77Initial program 92.5%
associate-*r/92.4%
*-commutative92.4%
sqr-neg92.4%
associate-+l+92.4%
+-commutative92.4%
sqr-neg92.4%
distribute-rgt-out92.5%
fma-def92.5%
+-commutative92.5%
Simplified92.5%
Taylor expanded in m around 0 77.8%
if 3.5999999999999998e77 < m < 2.15e285Initial program 81.4%
associate-*r/81.4%
*-commutative81.4%
sqr-neg81.4%
associate-+l+81.4%
+-commutative81.4%
sqr-neg81.4%
distribute-rgt-out81.4%
fma-def81.4%
+-commutative81.4%
Simplified81.4%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 8.6%
*-commutative8.6%
Simplified8.6%
if 2.15e285 < m Initial program 71.4%
associate-*r/71.4%
*-commutative71.4%
sqr-neg71.4%
associate-+l+71.4%
+-commutative71.4%
sqr-neg71.4%
distribute-rgt-out71.4%
fma-def71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 3.7%
Final simplification52.3%
(FPCore (a k m) :precision binary64 (if (<= m -7.5e-282) (/ a (* k k)) (if (<= m 4.8e+34) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k -10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.5e-282) {
tmp = a / (k * k);
} else if (m <= 4.8e+34) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-7.5d-282)) then
tmp = a / (k * k)
else if (m <= 4.8d+34) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a * (1.0d0 + (k * (-10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -7.5e-282) {
tmp = a / (k * k);
} else if (m <= 4.8e+34) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -7.5e-282: tmp = a / (k * k) elif m <= 4.8e+34: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -7.5e-282) tmp = Float64(a / Float64(k * k)); elseif (m <= 4.8e+34) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -7.5e-282) tmp = a / (k * k); elseif (m <= 4.8e+34) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -7.5e-282], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.8e+34], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.5 \cdot 10^{-282}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 4.8 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -7.49999999999999937e-282Initial program 97.6%
associate-*r/97.6%
*-commutative97.6%
sqr-neg97.6%
associate-+l+97.6%
+-commutative97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
fma-def97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in m around 0 49.4%
Taylor expanded in k around inf 61.3%
unpow261.3%
Simplified61.3%
if -7.49999999999999937e-282 < m < 4.79999999999999974e34Initial program 96.3%
associate-*r/96.3%
*-commutative96.3%
sqr-neg96.3%
associate-+l+96.3%
+-commutative96.3%
sqr-neg96.3%
distribute-rgt-out96.3%
fma-def96.3%
+-commutative96.3%
Simplified96.3%
Taylor expanded in m around 0 85.7%
Taylor expanded in k around 0 68.4%
*-commutative68.4%
Simplified68.4%
if 4.79999999999999974e34 < m Initial program 79.5%
associate-*r/79.5%
*-commutative79.5%
sqr-neg79.5%
associate-+l+79.5%
+-commutative79.5%
sqr-neg79.5%
distribute-rgt-out79.5%
fma-def79.5%
+-commutative79.5%
Simplified79.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 7.3%
*-commutative7.3%
Simplified7.3%
Final simplification44.2%
(FPCore (a k m) :precision binary64 (if (<= m -5.4e-283) (/ a (* k k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.4e-283) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-5.4d-283)) then
tmp = a / (k * k)
else
tmp = a * (1.0d0 + (k * (-10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.4e-283) {
tmp = a / (k * k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.4e-283: tmp = a / (k * k) else: tmp = a * (1.0 + (k * -10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.4e-283) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.4e-283) tmp = a / (k * k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.4e-283], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.4 \cdot 10^{-283}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if m < -5.4e-283Initial program 97.6%
associate-*r/97.6%
*-commutative97.6%
sqr-neg97.6%
associate-+l+97.6%
+-commutative97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
fma-def97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in m around 0 49.4%
Taylor expanded in k around inf 61.3%
unpow261.3%
Simplified61.3%
if -5.4e-283 < m Initial program 85.8%
associate-*r/85.8%
*-commutative85.8%
sqr-neg85.8%
associate-+l+85.8%
+-commutative85.8%
sqr-neg85.8%
distribute-rgt-out85.9%
fma-def85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in m around 0 34.0%
Taylor expanded in k around 0 24.3%
*-commutative24.3%
Simplified24.3%
Final simplification40.9%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 91.1%
associate-*r/91.1%
*-commutative91.1%
sqr-neg91.1%
associate-+l+91.1%
+-commutative91.1%
sqr-neg91.1%
distribute-rgt-out91.1%
fma-def91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in m around 0 40.9%
Taylor expanded in k around 0 17.9%
Final simplification17.9%
herbie shell --seed 2023275
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))