
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 2e+303)
(* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0)))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+303) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} 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) :: tmp
t_0 = a * (k ** m)
if ((t_0 / ((k * k) + (1.0d0 + (k * 10.0d0)))) <= 2d+303) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
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 tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+303) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+303: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 2e+303) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+303) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); 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]}, If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+303], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 2 \cdot 10^{+303}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) < 2e303Initial program 98.6%
associate-/l*98.6%
remove-double-neg98.6%
distribute-frac-neg298.6%
distribute-neg-frac298.6%
remove-double-neg98.6%
sqr-neg98.6%
associate-+l+98.6%
sqr-neg98.6%
distribute-rgt-out98.6%
Simplified98.6%
if 2e303 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 10 binary64) k)) (*.f64 k k))) Initial program 68.8%
associate-/l*68.8%
remove-double-neg68.8%
distribute-frac-neg268.8%
distribute-neg-frac268.8%
remove-double-neg68.8%
sqr-neg68.8%
associate-+l+68.8%
sqr-neg68.8%
distribute-rgt-out68.8%
Simplified68.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (pow (/ (sqrt (* a (pow k m))) (hypot 1.0 k)) 2.0))
double code(double a, double k, double m) {
return pow((sqrt((a * pow(k, m))) / hypot(1.0, k)), 2.0);
}
public static double code(double a, double k, double m) {
return Math.pow((Math.sqrt((a * Math.pow(k, m))) / Math.hypot(1.0, k)), 2.0);
}
def code(a, k, m): return math.pow((math.sqrt((a * math.pow(k, m))) / math.hypot(1.0, k)), 2.0)
function code(a, k, m) return Float64(sqrt(Float64(a * (k ^ m))) / hypot(1.0, k)) ^ 2.0 end
function tmp = code(a, k, m) tmp = (sqrt((a * (k ^ m))) / hypot(1.0, k)) ^ 2.0; end
code[a_, k_, m_] := N[Power[N[(N[Sqrt[N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[1.0 ^ 2 + k ^ 2], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{\sqrt{a \cdot {k}^{m}}}{\mathsf{hypot}\left(1, k\right)}\right)}^{2}
\end{array}
Initial program 93.0%
*-commutative93.0%
Simplified93.0%
Taylor expanded in k around 0 91.6%
add-sqr-sqrt67.7%
sqrt-div63.4%
hypot-1-def63.4%
sqrt-div63.4%
hypot-1-def66.0%
Applied egg-rr66.0%
unpow266.0%
Simplified66.0%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 2.95) (/ t_0 (+ 1.0 (* k k))) t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= 2.95) {
tmp = t_0 / (1.0 + (k * k));
} 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) :: tmp
t_0 = a * (k ** m)
if (m <= 2.95d0) then
tmp = t_0 / (1.0d0 + (k * k))
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 tmp;
if (m <= 2.95) {
tmp = t_0 / (1.0 + (k * k));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= 2.95: tmp = t_0 / (1.0 + (k * k)) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= 2.95) tmp = Float64(t_0 / Float64(1.0 + Float64(k * k))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= 2.95) tmp = t_0 / (1.0 + (k * k)); 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]}, If[LessEqual[m, 2.95], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 2.95:\\
\;\;\;\;\frac{t\_0}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < 2.9500000000000002Initial program 98.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in k around 0 96.2%
if 2.9500000000000002 < m Initial program 82.8%
associate-/l*82.8%
remove-double-neg82.8%
distribute-frac-neg282.8%
distribute-neg-frac282.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-+l+82.8%
sqr-neg82.8%
distribute-rgt-out82.8%
Simplified82.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (if (<= m -2.4e-5) (* a (/ (pow k m) (+ 1.0 (* k 10.0)))) (if (<= m 4.2e-9) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.4e-5) {
tmp = a * (pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 4.2e-9) {
tmp = a * (1.0 / (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 <= (-2.4d-5)) then
tmp = a * ((k ** m) / (1.0d0 + (k * 10.0d0)))
else if (m <= 4.2d-9) then
tmp = a * (1.0d0 / (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 <= -2.4e-5) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * 10.0)));
} else if (m <= 4.2e-9) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.4e-5: tmp = a * (math.pow(k, m) / (1.0 + (k * 10.0))) elif m <= 4.2e-9: tmp = a * (1.0 / (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 <= -2.4e-5) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * 10.0)))); elseif (m <= 4.2e-9) tmp = Float64(a * Float64(1.0 / 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 <= -2.4e-5) tmp = a * ((k ^ m) / (1.0 + (k * 10.0))); elseif (m <= 4.2e-9) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.4e-5], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.2e-9], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.4 \cdot 10^{-5}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 4.2 \cdot 10^{-9}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < -2.4000000000000001e-5Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -2.4000000000000001e-5 < m < 4.20000000000000039e-9Initial program 96.3%
associate-/l*96.4%
remove-double-neg96.4%
distribute-frac-neg296.4%
distribute-neg-frac296.4%
remove-double-neg96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out96.4%
Simplified96.4%
Taylor expanded in m around 0 96.3%
if 4.20000000000000039e-9 < m Initial program 82.8%
associate-/l*82.8%
remove-double-neg82.8%
distribute-frac-neg282.8%
distribute-neg-frac282.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-+l+82.8%
sqr-neg82.8%
distribute-rgt-out82.8%
Simplified82.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.0152) (not (<= m 0.015))) (* a (pow k m)) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.0152) || !(m <= 0.015)) {
tmp = a * pow(k, m);
} else {
tmp = a * (1.0 / (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.0152d0)) .or. (.not. (m <= 0.015d0))) then
tmp = a * (k ** m)
else
tmp = a * (1.0d0 / (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.0152) || !(m <= 0.015)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.0152) or not (m <= 0.015): tmp = a * math.pow(k, m) else: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.0152) || !(m <= 0.015)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a * Float64(1.0 / 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.0152) || ~((m <= 0.015))) tmp = a * (k ^ m); else tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.0152], N[Not[LessEqual[m, 0.015]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0152 \lor \neg \left(m \leq 0.015\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.0152 or 0.014999999999999999 < m Initial program 91.6%
associate-/l*91.6%
remove-double-neg91.6%
distribute-frac-neg291.6%
distribute-neg-frac291.6%
remove-double-neg91.6%
sqr-neg91.6%
associate-+l+91.6%
sqr-neg91.6%
distribute-rgt-out91.6%
Simplified91.6%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if -0.0152 < m < 0.014999999999999999Initial program 96.3%
associate-/l*96.4%
remove-double-neg96.4%
distribute-frac-neg296.4%
distribute-neg-frac296.4%
remove-double-neg96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out96.4%
Simplified96.4%
Taylor expanded in m around 0 96.3%
Final simplification98.5%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (/ a k))))
(if (<= m -2.1e-93)
t_0
(if (<= m 1.9e-49) a (if (<= m 1.35e+15) t_0 (* -10.0 (* a k)))))))
double code(double a, double k, double m) {
double t_0 = k * (a / k);
double tmp;
if (m <= -2.1e-93) {
tmp = t_0;
} else if (m <= 1.9e-49) {
tmp = a;
} else if (m <= 1.35e+15) {
tmp = t_0;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = k * (a / k)
if (m <= (-2.1d-93)) then
tmp = t_0
else if (m <= 1.9d-49) then
tmp = a
else if (m <= 1.35d+15) then
tmp = t_0
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (a / k);
double tmp;
if (m <= -2.1e-93) {
tmp = t_0;
} else if (m <= 1.9e-49) {
tmp = a;
} else if (m <= 1.35e+15) {
tmp = t_0;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): t_0 = k * (a / k) tmp = 0 if m <= -2.1e-93: tmp = t_0 elif m <= 1.9e-49: tmp = a elif m <= 1.35e+15: tmp = t_0 else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(a / k)) tmp = 0.0 if (m <= -2.1e-93) tmp = t_0; elseif (m <= 1.9e-49) tmp = a; elseif (m <= 1.35e+15) tmp = t_0; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (a / k); tmp = 0.0; if (m <= -2.1e-93) tmp = t_0; elseif (m <= 1.9e-49) tmp = a; elseif (m <= 1.35e+15) tmp = t_0; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -2.1e-93], t$95$0, If[LessEqual[m, 1.9e-49], a, If[LessEqual[m, 1.35e+15], t$95$0, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \frac{a}{k}\\
\mathbf{if}\;m \leq -2.1 \cdot 10^{-93}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 1.9 \cdot 10^{-49}:\\
\;\;\;\;a\\
\mathbf{elif}\;m \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -2.1000000000000001e-93 or 1.8999999999999999e-49 < m < 1.35e15Initial program 99.1%
associate-/l*99.1%
remove-double-neg99.1%
distribute-frac-neg299.1%
distribute-neg-frac299.1%
remove-double-neg99.1%
sqr-neg99.1%
associate-+l+99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
Simplified99.1%
Taylor expanded in m around 0 40.8%
Taylor expanded in k around 0 8.4%
Taylor expanded in k around inf 14.5%
Taylor expanded in k around 0 25.8%
if -2.1000000000000001e-93 < m < 1.8999999999999999e-49Initial program 95.5%
associate-/l*95.5%
remove-double-neg95.5%
distribute-frac-neg295.5%
distribute-neg-frac295.5%
remove-double-neg95.5%
sqr-neg95.5%
associate-+l+95.5%
sqr-neg95.5%
distribute-rgt-out95.5%
Simplified95.5%
Taylor expanded in m around 0 95.5%
Taylor expanded in k around 0 55.5%
if 1.35e15 < m Initial program 83.7%
associate-/l*83.7%
remove-double-neg83.7%
distribute-frac-neg283.7%
distribute-neg-frac283.7%
remove-double-neg83.7%
sqr-neg83.7%
associate-+l+83.7%
sqr-neg83.7%
distribute-rgt-out83.7%
Simplified83.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.3%
Taylor expanded in k around inf 17.6%
(FPCore (a k m) :precision binary64 (if (<= m -54.0) (* k (/ a k)) (if (<= m 2.4) (/ a (+ 1.0 (* k 10.0))) (* a (+ 1.0 (* k (* k 99.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -54.0) {
tmp = k * (a / k);
} else if (m <= 2.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * (k * 99.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 <= (-54.0d0)) then
tmp = k * (a / k)
else if (m <= 2.4d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -54.0) {
tmp = k * (a / k);
} else if (m <= 2.4) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -54.0: tmp = k * (a / k) elif m <= 2.4: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -54.0) tmp = Float64(k * Float64(a / k)); elseif (m <= 2.4) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -54.0) tmp = k * (a / k); elseif (m <= 2.4) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -54.0], N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.4], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -54:\\
\;\;\;\;k \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 2.4:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < -54Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 31.9%
Taylor expanded in k around 0 3.0%
Taylor expanded in k around inf 12.3%
Taylor expanded in k around 0 20.2%
if -54 < m < 2.39999999999999991Initial program 96.4%
associate-/l*96.4%
remove-double-neg96.4%
distribute-frac-neg296.4%
distribute-neg-frac296.4%
remove-double-neg96.4%
sqr-neg96.4%
associate-+l+96.4%
sqr-neg96.4%
distribute-rgt-out96.4%
Simplified96.4%
Taylor expanded in m around 0 95.1%
Taylor expanded in k around 0 65.7%
*-commutative66.9%
Simplified65.7%
if 2.39999999999999991 < m Initial program 82.8%
associate-/l*82.8%
remove-double-neg82.8%
distribute-frac-neg282.8%
distribute-neg-frac282.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-+l+82.8%
sqr-neg82.8%
distribute-rgt-out82.8%
Simplified82.8%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 29.2%
Taylor expanded in k around inf 29.2%
*-commutative29.2%
Simplified29.2%
(FPCore (a k m) :precision binary64 (if (<= m -18000.0) (* k (/ a k)) (if (<= m 1.35e+15) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -18000.0) {
tmp = k * (a / k);
} else if (m <= 1.35e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-18000.0d0)) then
tmp = k * (a / k)
else if (m <= 1.35d+15) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -18000.0) {
tmp = k * (a / k);
} else if (m <= 1.35e+15) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -18000.0: tmp = k * (a / k) elif m <= 1.35e+15: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -18000.0) tmp = Float64(k * Float64(a / k)); elseif (m <= 1.35e+15) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -18000.0) tmp = k * (a / k); elseif (m <= 1.35e+15) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -18000.0], N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.35e+15], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -18000:\\
\;\;\;\;k \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -18000Initial program 100.0%
associate-/l*100.0%
remove-double-neg100.0%
distribute-frac-neg2100.0%
distribute-neg-frac2100.0%
remove-double-neg100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 31.9%
Taylor expanded in k around 0 3.0%
Taylor expanded in k around inf 12.3%
Taylor expanded in k around 0 20.2%
if -18000 < m < 1.35e15Initial program 95.2%
associate-/l*95.2%
remove-double-neg95.2%
distribute-frac-neg295.2%
distribute-neg-frac295.2%
remove-double-neg95.2%
sqr-neg95.2%
associate-+l+95.2%
sqr-neg95.2%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around 0 94.0%
Taylor expanded in k around 0 64.9%
*-commutative67.4%
Simplified64.9%
if 1.35e15 < m Initial program 83.7%
associate-/l*83.7%
remove-double-neg83.7%
distribute-frac-neg283.7%
distribute-neg-frac283.7%
remove-double-neg83.7%
sqr-neg83.7%
associate-+l+83.7%
sqr-neg83.7%
distribute-rgt-out83.7%
Simplified83.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.3%
Taylor expanded in k around inf 17.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.0) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * (1.0 + (k * (k * 99.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 <= 2.0d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.0) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.0: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.0) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.0) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.0], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 2Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 61.5%
if 2 < m Initial program 82.8%
associate-/l*82.8%
remove-double-neg82.8%
distribute-frac-neg282.8%
distribute-neg-frac282.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-+l+82.8%
sqr-neg82.8%
distribute-rgt-out82.8%
Simplified82.8%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 29.2%
Taylor expanded in k around inf 29.2%
*-commutative29.2%
Simplified29.2%
Final simplification50.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.95) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (+ 1.0 (* k (* k 99.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * (k * 99.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.95d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (1.0 + (k * (k * 99.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.95: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (1.0 + (k * (k * 99.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.95) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.95) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (1.0 + (k * (k * 99.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.95], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.95:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\end{array}
\end{array}
if m < 1.94999999999999996Initial program 98.3%
associate-/l*98.3%
remove-double-neg98.3%
distribute-frac-neg298.3%
distribute-neg-frac298.3%
remove-double-neg98.3%
sqr-neg98.3%
associate-+l+98.3%
sqr-neg98.3%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in m around 0 61.4%
if 1.94999999999999996 < m Initial program 82.8%
associate-/l*82.8%
remove-double-neg82.8%
distribute-frac-neg282.8%
distribute-neg-frac282.8%
remove-double-neg82.8%
sqr-neg82.8%
associate-+l+82.8%
sqr-neg82.8%
distribute-rgt-out82.8%
Simplified82.8%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 29.2%
Taylor expanded in k around inf 29.2%
*-commutative29.2%
Simplified29.2%
Final simplification50.5%
(FPCore (a k m) :precision binary64 (if (<= m 1.35e+15) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.35e+15) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 1.35d+15) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.35e+15) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.35e+15: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.35e+15) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.35e+15) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.35e+15], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.35 \cdot 10^{+15}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 1.35e15Initial program 97.7%
associate-/l*97.7%
remove-double-neg97.7%
distribute-frac-neg297.7%
distribute-neg-frac297.7%
remove-double-neg97.7%
sqr-neg97.7%
associate-+l+97.7%
sqr-neg97.7%
distribute-rgt-out97.7%
Simplified97.7%
Taylor expanded in m around 0 61.1%
Taylor expanded in k around 0 26.3%
if 1.35e15 < m Initial program 83.7%
associate-/l*83.7%
remove-double-neg83.7%
distribute-frac-neg283.7%
distribute-neg-frac283.7%
remove-double-neg83.7%
sqr-neg83.7%
associate-+l+83.7%
sqr-neg83.7%
distribute-rgt-out83.7%
Simplified83.7%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 6.3%
Taylor expanded in k around inf 17.6%
(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 93.0%
associate-/l*93.0%
remove-double-neg93.0%
distribute-frac-neg293.0%
distribute-neg-frac293.0%
remove-double-neg93.0%
sqr-neg93.0%
associate-+l+93.0%
sqr-neg93.0%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 41.6%
Taylor expanded in k around 0 18.8%
herbie shell --seed 2024090
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))