
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+162) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+162) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+162) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+162) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+162: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+162) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+162) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+162], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+162}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 1.9999999999999999e162Initial program 98.6%
if 1.9999999999999999e162 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 67.9%
Taylor expanded in k around 0 50.0%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= k 0.225) (* a (pow k m)) (/ (* (pow k m) (/ a k)) k)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.225) {
tmp = a * pow(k, m);
} else {
tmp = (pow(k, m) * (a / k)) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.225d0) then
tmp = a * (k ** m)
else
tmp = ((k ** m) * (a / k)) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.225) {
tmp = a * Math.pow(k, m);
} else {
tmp = (Math.pow(k, m) * (a / k)) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.225: tmp = a * math.pow(k, m) else: tmp = (math.pow(k, m) * (a / k)) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.225) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64((k ^ m) * Float64(a / k)) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.225) tmp = a * (k ^ m); else tmp = ((k ^ m) * (a / k)) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.225], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[k, m], $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision] / k), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.225:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{{k}^{m} \cdot \frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 0.225000000000000006Initial program 94.3%
Taylor expanded in k around 0 48.8%
exp-to-pow99.4%
*-commutative99.4%
Simplified99.4%
if 0.225000000000000006 < k Initial program 86.6%
div-inv86.5%
add-cube-cbrt86.3%
associate-*l*86.3%
pow286.3%
associate-+l+86.3%
+-commutative86.3%
distribute-rgt-out86.3%
fma-def86.3%
Applied egg-rr86.3%
Taylor expanded in k around inf 84.6%
unpow284.6%
times-frac93.0%
mul-1-neg93.0%
*-commutative93.0%
distribute-rgt-neg-in93.0%
log-rec93.0%
Simplified93.0%
associate-*r/93.0%
remove-double-neg93.0%
*-commutative93.0%
pow-to-exp93.0%
Applied egg-rr93.0%
Final simplification97.4%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.2e-17) (not (<= m 9.5e-14))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.2e-17) || !(m <= 9.5e-14)) {
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.2d-17)) .or. (.not. (m <= 9.5d-14))) 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.2e-17) || !(m <= 9.5e-14)) {
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.2e-17) or not (m <= 9.5e-14): 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.2e-17) || !(m <= 9.5e-14)) 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.2e-17) || ~((m <= 9.5e-14))) 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.2e-17], N[Not[LessEqual[m, 9.5e-14]], $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.2 \cdot 10^{-17} \lor \neg \left(m \leq 9.5 \cdot 10^{-14}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.20000000000000006e-17 or 9.4999999999999999e-14 < m Initial program 89.6%
Taylor expanded in k around 0 48.8%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -5.20000000000000006e-17 < m < 9.4999999999999999e-14Initial program 96.6%
div-inv96.6%
add-cube-cbrt95.2%
associate-*l*95.2%
pow295.2%
associate-+l+95.2%
+-commutative95.2%
distribute-rgt-out95.2%
fma-def95.2%
Applied egg-rr95.2%
Taylor expanded in m around 0 96.6%
Final simplification98.9%
(FPCore (a k m)
:precision binary64
(if (<= m -0.94)
(/ 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 <= -0.94) {
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 <= (-0.94d0)) 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 <= -0.94) {
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 <= -0.94: 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 <= -0.94) 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 <= -0.94) 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, -0.94], 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 -0.94:\\
\;\;\;\;\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 < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 1.94999999999999996Initial program 96.7%
div-inv96.7%
add-cube-cbrt95.3%
associate-*l*95.3%
pow295.3%
associate-+l+95.3%
+-commutative95.3%
distribute-rgt-out95.3%
fma-def95.3%
Applied egg-rr95.3%
Taylor expanded in m around 0 94.7%
if 1.94999999999999996 < m Initial program 79.5%
Taylor expanded in k around 0 77.3%
Taylor expanded in m around 0 2.7%
Taylor expanded in k around 0 23.2%
associate-*r*23.2%
associate-*r*23.2%
distribute-rgt-out30.0%
*-commutative30.0%
*-commutative30.0%
unpow230.0%
associate-*l*30.0%
Simplified30.0%
Final simplification61.1%
(FPCore (a k m)
:precision binary64
(if (<= m -0.94)
(/ a (* k k))
(if (<= m 1.32e+50)
(/ a (+ 1.0 (* k (+ k 10.0))))
(/ a (+ (* k 10.0) (* 10.0 (/ 1.0 k)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 1.32e+50) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a / ((k * 10.0) + (10.0 * (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 (m <= (-0.94d0)) then
tmp = a / (k * k)
else if (m <= 1.32d+50) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a / ((k * 10.0d0) + (10.0d0 * (1.0d0 / k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 1.32e+50) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a / ((k * 10.0) + (10.0 * (1.0 / k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.94: tmp = a / (k * k) elif m <= 1.32e+50: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a / ((k * 10.0) + (10.0 * (1.0 / k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.32e+50) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a / Float64(Float64(k * 10.0) + Float64(10.0 * Float64(1.0 / k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.94) tmp = a / (k * k); elseif (m <= 1.32e+50) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a / ((k * 10.0) + (10.0 * (1.0 / k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.32e+50], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * 10.0), $MachinePrecision] + N[(10.0 * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.32 \cdot 10^{+50}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 10 \cdot \frac{1}{k}}\\
\end{array}
\end{array}
if m < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 1.3199999999999999e50Initial program 93.8%
div-inv93.7%
add-cube-cbrt92.4%
associate-*l*92.4%
pow292.4%
associate-+l+92.4%
+-commutative92.4%
distribute-rgt-out92.4%
fma-def92.4%
Applied egg-rr92.4%
Taylor expanded in m around 0 87.7%
if 1.3199999999999999e50 < m Initial program 81.5%
Taylor expanded in m around 0 2.9%
associate-+l+2.9%
flip-+2.5%
metadata-eval2.5%
distribute-rgt-out2.5%
distribute-rgt-out2.5%
distribute-rgt-out2.5%
Applied egg-rr2.5%
associate-*r*2.5%
*-commutative2.5%
+-commutative2.5%
*-commutative2.5%
associate-*l*2.5%
+-commutative2.5%
+-commutative2.5%
Simplified2.5%
Taylor expanded in k around 0 2.5%
*-commutative2.5%
unpow22.5%
associate-*l*2.5%
Simplified2.5%
Taylor expanded in k around inf 14.1%
Final simplification55.3%
(FPCore (a k m) :precision binary64 (if (<= m -0.94) (/ a (* k k)) (if (<= m 5.5e+15) (/ a (+ 1.0 (* k (+ k 10.0)))) (+ a (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 5.5e+15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.94d0)) then
tmp = a / (k * k)
else if (m <= 5.5d+15) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 5.5e+15) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.94: tmp = a / (k * k) elif m <= 5.5e+15: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 5.5e+15) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.94) tmp = a / (k * k); elseif (m <= 5.5e+15) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.5e+15], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 5.5 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 5.5e15Initial program 96.8%
div-inv96.7%
add-cube-cbrt95.4%
associate-*l*95.4%
pow295.4%
associate-+l+95.4%
+-commutative95.4%
distribute-rgt-out95.4%
fma-def95.4%
Applied egg-rr95.4%
Taylor expanded in m around 0 93.6%
if 5.5e15 < m Initial program 79.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 7.6%
Final simplification53.4%
(FPCore (a k m) :precision binary64 (if (or (<= k 6.5e-294) (not (<= k 0.23))) (/ a (* k k)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 6.5e-294) || !(k <= 0.23)) {
tmp = a / (k * k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 6.5d-294) .or. (.not. (k <= 0.23d0))) then
tmp = a / (k * k)
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 6.5e-294) || !(k <= 0.23)) {
tmp = a / (k * k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 6.5e-294) or not (k <= 0.23): tmp = a / (k * k) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 6.5e-294) || !(k <= 0.23)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 6.5e-294) || ~((k <= 0.23))) tmp = a / (k * k); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 6.5e-294], N[Not[LessEqual[k, 0.23]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 6.5 \cdot 10^{-294} \lor \neg \left(k \leq 0.23\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if k < 6.4999999999999995e-294 or 0.23000000000000001 < k Initial program 88.1%
Taylor expanded in m around 0 38.7%
Taylor expanded in k around inf 41.5%
unpow241.5%
Simplified41.5%
if 6.4999999999999995e-294 < k < 0.23000000000000001Initial program 99.9%
Taylor expanded in m around 0 56.0%
Taylor expanded in k around 0 55.5%
Final simplification45.9%
(FPCore (a k m) :precision binary64 (if (<= k 1.25e-294) (/ a (* k k)) (if (<= k 0.075) (+ a (* -10.0 (* a k))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.25e-294) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.25d-294) then
tmp = a / (k * k)
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = a / (k * (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.25e-294) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.25e-294: tmp = a / (k * k) elif k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.25e-294) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.25e-294) tmp = a / (k * k); elseif (k <= 0.075) tmp = a + (-10.0 * (a * k)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.25e-294], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.25 \cdot 10^{-294}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 1.2500000000000001e-294Initial program 89.6%
Taylor expanded in m around 0 15.4%
Taylor expanded in k around inf 22.1%
unpow222.1%
Simplified22.1%
if 1.2500000000000001e-294 < k < 0.0749999999999999972Initial program 99.9%
Taylor expanded in m around 0 56.6%
Taylor expanded in k around 0 56.1%
if 0.0749999999999999972 < k Initial program 86.6%
Taylor expanded in m around 0 66.3%
Taylor expanded in k around inf 65.0%
unpow265.0%
distribute-rgt-in65.0%
Simplified65.0%
Final simplification46.2%
(FPCore (a k m) :precision binary64 (if (<= k 5e-295) (/ a (* k k)) (if (<= k 1.0) (/ a (+ 1.0 (* k 10.0))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 5e-295) {
tmp = a / (k * k);
} else if (k <= 1.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 5d-295) then
tmp = a / (k * k)
else if (k <= 1.0d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a / (k * (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 5e-295) {
tmp = a / (k * k);
} else if (k <= 1.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 5e-295: tmp = a / (k * k) elif k <= 1.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 5e-295) tmp = Float64(a / Float64(k * k)); elseif (k <= 1.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 5e-295) tmp = a / (k * k); elseif (k <= 1.0) tmp = a / (1.0 + (k * 10.0)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 5e-295], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5 \cdot 10^{-295}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 1:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 5.00000000000000008e-295Initial program 89.6%
Taylor expanded in m around 0 15.4%
Taylor expanded in k around inf 22.1%
unpow222.1%
Simplified22.1%
if 5.00000000000000008e-295 < k < 1Initial program 99.9%
Taylor expanded in k around 0 99.6%
Taylor expanded in m around 0 55.6%
if 1 < k Initial program 86.4%
Taylor expanded in m around 0 67.0%
Taylor expanded in k around inf 65.8%
unpow265.8%
distribute-rgt-in65.8%
Simplified65.8%
Final simplification46.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.94) (/ a (* k k)) (if (<= m 6.4e+15) (/ a (+ 1.0 (* k k))) (+ a (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 6.4e+15) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.94d0)) then
tmp = a / (k * k)
else if (m <= 6.4d+15) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 6.4e+15) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.94: tmp = a / (k * k) elif m <= 6.4e+15: tmp = a / (1.0 + (k * k)) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 6.4e+15) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.94) tmp = a / (k * k); elseif (m <= 6.4e+15) tmp = a / (1.0 + (k * k)); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.4e+15], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 6.4 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 6.4e15Initial program 96.8%
Taylor expanded in m around 0 93.6%
Taylor expanded in k around 0 90.7%
if 6.4e15 < m Initial program 79.3%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 7.6%
Final simplification52.4%
(FPCore (a k m) :precision binary64 (if (or (<= k 4e-295) (not (<= k 1.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 4e-295) || !(k <= 1.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 <= 4d-295) .or. (.not. (k <= 1.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 <= 4e-295) || !(k <= 1.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 4e-295) or not (k <= 1.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 4e-295) || !(k <= 1.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 <= 4e-295) || ~((k <= 1.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 4e-295], N[Not[LessEqual[k, 1.0]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 4 \cdot 10^{-295} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 4.00000000000000024e-295 or 1 < k Initial program 88.1%
Taylor expanded in m around 0 38.7%
Taylor expanded in k around inf 41.5%
unpow241.5%
Simplified41.5%
if 4.00000000000000024e-295 < k < 1Initial program 99.9%
Taylor expanded in m around 0 56.0%
Taylor expanded in k around 0 54.8%
Final simplification45.7%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (/ a (* k 10.0))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = a / (k * 10.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.1d0) then
tmp = a
else
tmp = a / (k * 10.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = a / (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = a / (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(a / Float64(k * 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = a / (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 94.3%
Taylor expanded in m around 0 34.1%
Taylor expanded in k around 0 28.1%
if 0.10000000000000001 < k Initial program 86.6%
Taylor expanded in k around 0 68.1%
Taylor expanded in m around 0 25.1%
Taylor expanded in k around inf 25.1%
*-commutative25.1%
Simplified25.1%
Final simplification27.2%
(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.9%
Taylor expanded in m around 0 44.2%
Taylor expanded in k around 0 20.8%
Final simplification20.8%
herbie shell --seed 2023279
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))