
(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 9 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 (+ (+ 1.0 (* k 10.0)) (* k k))) 2e+108)
(* 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 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+108) {
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 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 2d+108) 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 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+108) {
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 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+108: 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(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 2e+108) 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 / ((1.0 + (k * 10.0)) + (k * k))) <= 2e+108) 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[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+108], 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}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 2 \cdot 10^{+108}:\\
\;\;\;\;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 1 (*.f64 10 k)) (*.f64 k k))) < 2.0000000000000001e108Initial 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%
if 2.0000000000000001e108 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 64.6%
associate-/l*64.6%
remove-double-neg64.6%
distribute-frac-neg264.6%
distribute-neg-frac264.6%
remove-double-neg64.6%
sqr-neg64.6%
associate-+l+64.6%
sqr-neg64.6%
distribute-rgt-out64.6%
Simplified64.6%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification99.2%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.155) (not (<= m 4e-29))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.155) || !(m <= 4e-29)) {
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.155d0)) .or. (.not. (m <= 4d-29))) 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.155) || !(m <= 4e-29)) {
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.155) or not (m <= 4e-29): 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.155) || !(m <= 4e-29)) 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.155) || ~((m <= 4e-29))) 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.155], N[Not[LessEqual[m, 4e-29]], $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.155 \lor \neg \left(m \leq 4 \cdot 10^{-29}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.154999999999999999 or 3.99999999999999977e-29 < m Initial program 90.1%
associate-/l*90.1%
remove-double-neg90.1%
distribute-frac-neg290.1%
distribute-neg-frac290.1%
remove-double-neg90.1%
sqr-neg90.1%
associate-+l+90.1%
sqr-neg90.1%
distribute-rgt-out90.1%
Simplified90.1%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if -0.154999999999999999 < m < 3.99999999999999977e-29Initial 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 97.4%
Final simplification98.8%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (+ k 10.0))))
(if (<= m -0.22)
(/ a (* k k))
(if (<= m 1.42) (/ a (+ 1.0 t_0)) (* a t_0)))))
double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.22) {
tmp = a / (k * k);
} else if (m <= 1.42) {
tmp = a / (1.0 + t_0);
} else {
tmp = a * 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 = k * (k + 10.0d0)
if (m <= (-0.22d0)) then
tmp = a / (k * k)
else if (m <= 1.42d0) then
tmp = a / (1.0d0 + t_0)
else
tmp = a * t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (k + 10.0);
double tmp;
if (m <= -0.22) {
tmp = a / (k * k);
} else if (m <= 1.42) {
tmp = a / (1.0 + t_0);
} else {
tmp = a * t_0;
}
return tmp;
}
def code(a, k, m): t_0 = k * (k + 10.0) tmp = 0 if m <= -0.22: tmp = a / (k * k) elif m <= 1.42: tmp = a / (1.0 + t_0) else: tmp = a * t_0 return tmp
function code(a, k, m) t_0 = Float64(k * Float64(k + 10.0)) tmp = 0.0 if (m <= -0.22) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.42) tmp = Float64(a / Float64(1.0 + t_0)); else tmp = Float64(a * t_0); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (k + 10.0); tmp = 0.0; if (m <= -0.22) tmp = a / (k * k); elseif (m <= 1.42) tmp = a / (1.0 + t_0); else tmp = a * t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.22], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.42], N[(a / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(a * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \left(k + 10\right)\\
\mathbf{if}\;m \leq -0.22:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.42:\\
\;\;\;\;\frac{a}{1 + t\_0}\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\_0\\
\end{array}
\end{array}
if m < -0.220000000000000001Initial 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 47.3%
add-exp-log47.2%
log-rec47.2%
+-commutative47.2%
log1p-define47.2%
Applied egg-rr47.2%
Taylor expanded in k around inf 37.0%
exp-neg38.1%
associate-*r/38.1%
*-rgt-identity38.1%
*-commutative38.1%
exp-to-pow62.4%
Simplified62.4%
inv-pow62.4%
pow-pow62.4%
metadata-eval62.4%
pow262.4%
Applied egg-rr62.4%
if -0.220000000000000001 < m < 1.4199999999999999Initial program 97.8%
associate-/l*97.8%
remove-double-neg97.8%
distribute-frac-neg297.8%
distribute-neg-frac297.8%
remove-double-neg97.8%
sqr-neg97.8%
associate-+l+97.8%
sqr-neg97.8%
distribute-rgt-out97.8%
Simplified97.8%
Taylor expanded in m around 0 95.7%
if 1.4199999999999999 < m Initial program 79.8%
associate-/l*79.8%
remove-double-neg79.8%
distribute-frac-neg279.8%
distribute-neg-frac279.8%
remove-double-neg79.8%
sqr-neg79.8%
associate-+l+79.8%
sqr-neg79.8%
distribute-rgt-out79.8%
Simplified79.8%
Taylor expanded in m around 0 3.2%
add-exp-log3.2%
log-rec3.2%
+-commutative3.2%
log1p-define3.2%
Applied egg-rr3.2%
add-sqr-sqrt1.1%
sqrt-unprod35.2%
sqr-neg35.2%
sqrt-unprod34.1%
add-sqr-sqrt35.2%
log1p-undefine35.2%
rem-exp-log35.2%
+-commutative35.2%
Applied egg-rr35.2%
Taylor expanded in k around inf 42.2%
*-commutative42.2%
unpow242.2%
associate-*r*38.9%
distribute-lft-in44.8%
+-commutative44.8%
associate-*r*48.1%
Simplified48.1%
Final simplification69.3%
(FPCore (a k m) :precision binary64 (if (<= m -7.5e-299) (/ a (* k k)) (if (<= m 1.3) a (* a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -7.5e-299) {
tmp = a / (k * k);
} else if (m <= 1.3) {
tmp = a;
} 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 (m <= (-7.5d-299)) then
tmp = a / (k * k)
else if (m <= 1.3d0) then
tmp = a
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 (m <= -7.5e-299) {
tmp = a / (k * k);
} else if (m <= 1.3) {
tmp = a;
} else {
tmp = a * (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -7.5e-299: tmp = a / (k * k) elif m <= 1.3: tmp = a else: tmp = a * (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -7.5e-299) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.3) tmp = a; 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 (m <= -7.5e-299) tmp = a / (k * k); elseif (m <= 1.3) tmp = a; else tmp = a * (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -7.5e-299], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.3], a, N[(a * N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.5 \cdot 10^{-299}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.3:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k + 10\right)\right)\\
\end{array}
\end{array}
if m < -7.4999999999999999e-299Initial program 99.3%
associate-/l*99.3%
remove-double-neg99.3%
distribute-frac-neg299.3%
distribute-neg-frac299.3%
remove-double-neg99.3%
sqr-neg99.3%
associate-+l+99.3%
sqr-neg99.3%
distribute-rgt-out99.3%
Simplified99.3%
Taylor expanded in m around 0 66.2%
add-exp-log65.7%
log-rec65.7%
+-commutative65.7%
log1p-define65.7%
Applied egg-rr65.7%
Taylor expanded in k around inf 46.7%
exp-neg47.4%
associate-*r/47.4%
*-rgt-identity47.4%
*-commutative47.4%
exp-to-pow62.9%
Simplified62.9%
inv-pow62.9%
pow-pow62.9%
metadata-eval62.9%
pow262.9%
Applied egg-rr62.9%
if -7.4999999999999999e-299 < m < 1.30000000000000004Initial program 97.4%
associate-/l*97.4%
remove-double-neg97.4%
distribute-frac-neg297.4%
distribute-neg-frac297.4%
remove-double-neg97.4%
sqr-neg97.4%
associate-+l+97.4%
sqr-neg97.4%
distribute-rgt-out97.4%
Simplified97.4%
Taylor expanded in m around 0 93.2%
Taylor expanded in k around 0 53.1%
if 1.30000000000000004 < m Initial program 79.8%
associate-/l*79.8%
remove-double-neg79.8%
distribute-frac-neg279.8%
distribute-neg-frac279.8%
remove-double-neg79.8%
sqr-neg79.8%
associate-+l+79.8%
sqr-neg79.8%
distribute-rgt-out79.8%
Simplified79.8%
Taylor expanded in m around 0 3.2%
add-exp-log3.2%
log-rec3.2%
+-commutative3.2%
log1p-define3.2%
Applied egg-rr3.2%
add-sqr-sqrt1.1%
sqrt-unprod35.2%
sqr-neg35.2%
sqrt-unprod34.1%
add-sqr-sqrt35.2%
log1p-undefine35.2%
rem-exp-log35.2%
+-commutative35.2%
Applied egg-rr35.2%
Taylor expanded in k around inf 42.2%
*-commutative42.2%
unpow242.2%
associate-*r*38.9%
distribute-lft-in44.8%
+-commutative44.8%
associate-*r*48.1%
Simplified48.1%
Final simplification56.6%
(FPCore (a k m) :precision binary64 (if (<= m -3.1e-58) (/ a (* k k)) (if (<= m 1.45) (/ a (+ 1.0 (* k 10.0))) (* a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.1e-58) {
tmp = a / (k * k);
} else if (m <= 1.45) {
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 (m <= (-3.1d-58)) then
tmp = a / (k * k)
else if (m <= 1.45d0) 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 (m <= -3.1e-58) {
tmp = a / (k * k);
} else if (m <= 1.45) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.1e-58: tmp = a / (k * k) elif m <= 1.45: 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 (m <= -3.1e-58) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.45) 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 (m <= -3.1e-58) tmp = a / (k * k); elseif (m <= 1.45) 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[m, -3.1e-58], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.45], 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}\;m \leq -3.1 \cdot 10^{-58}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.45:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot \left(k + 10\right)\right)\\
\end{array}
\end{array}
if m < -3.0999999999999999e-58Initial 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 55.0%
add-exp-log54.8%
log-rec54.8%
+-commutative54.8%
log1p-define54.8%
Applied egg-rr54.8%
Taylor expanded in k around inf 42.8%
exp-neg43.7%
associate-*r/43.7%
*-rgt-identity43.7%
*-commutative43.7%
exp-to-pow64.0%
Simplified64.0%
inv-pow64.0%
pow-pow64.0%
metadata-eval64.0%
pow264.0%
Applied egg-rr64.0%
if -3.0999999999999999e-58 < m < 1.44999999999999996Initial program 98.6%
associate-/l*98.5%
remove-double-neg98.5%
distribute-frac-neg298.5%
distribute-neg-frac298.5%
remove-double-neg98.5%
sqr-neg98.5%
associate-+l+98.5%
sqr-neg98.5%
distribute-rgt-out98.6%
Simplified98.6%
Taylor expanded in m around 0 96.3%
Taylor expanded in k around 0 66.1%
*-commutative66.1%
Simplified66.1%
if 1.44999999999999996 < m Initial program 79.8%
associate-/l*79.8%
remove-double-neg79.8%
distribute-frac-neg279.8%
distribute-neg-frac279.8%
remove-double-neg79.8%
sqr-neg79.8%
associate-+l+79.8%
sqr-neg79.8%
distribute-rgt-out79.8%
Simplified79.8%
Taylor expanded in m around 0 3.2%
add-exp-log3.2%
log-rec3.2%
+-commutative3.2%
log1p-define3.2%
Applied egg-rr3.2%
add-sqr-sqrt1.1%
sqrt-unprod35.2%
sqr-neg35.2%
sqrt-unprod34.1%
add-sqr-sqrt35.2%
log1p-undefine35.2%
rem-exp-log35.2%
+-commutative35.2%
Applied egg-rr35.2%
Taylor expanded in k around inf 42.2%
*-commutative42.2%
unpow242.2%
associate-*r*38.9%
distribute-lft-in44.8%
+-commutative44.8%
associate-*r*48.1%
Simplified48.1%
Final simplification59.4%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.3e-296) (not (<= k 1.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.3e-296) || !(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 <= 1.3d-296) .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 <= 1.3e-296) || !(k <= 1.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.3e-296) or not (k <= 1.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.3e-296) || !(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 <= 1.3e-296) || ~((k <= 1.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.3e-296], 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 1.3 \cdot 10^{-296} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.3e-296 or 1 < k Initial program 89.4%
associate-/l*89.4%
remove-double-neg89.4%
distribute-frac-neg289.4%
distribute-neg-frac289.4%
remove-double-neg89.4%
sqr-neg89.4%
associate-+l+89.4%
sqr-neg89.4%
distribute-rgt-out89.4%
Simplified89.4%
Taylor expanded in m around 0 48.2%
add-exp-log47.6%
log-rec47.6%
+-commutative47.6%
log1p-define47.6%
Applied egg-rr47.6%
Taylor expanded in k around inf 37.7%
exp-neg38.2%
associate-*r/38.2%
*-rgt-identity38.2%
*-commutative38.2%
exp-to-pow50.5%
Simplified50.5%
inv-pow50.5%
pow-pow50.5%
metadata-eval50.5%
pow250.5%
Applied egg-rr50.5%
if 1.3e-296 < k < 1Initial program 99.9%
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 52.9%
Taylor expanded in k around 0 49.1%
Final simplification50.1%
(FPCore (a k m) :precision binary64 (if (<= m -6.2e-17) (* 0.1 (/ a k)) (if (<= m 6.5e+18) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -6.2e-17) {
tmp = 0.1 * (a / k);
} else if (m <= 6.5e+18) {
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 <= (-6.2d-17)) then
tmp = 0.1d0 * (a / k)
else if (m <= 6.5d+18) 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 <= -6.2e-17) {
tmp = 0.1 * (a / k);
} else if (m <= 6.5e+18) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -6.2e-17: tmp = 0.1 * (a / k) elif m <= 6.5e+18: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -6.2e-17) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 6.5e+18) 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 <= -6.2e-17) tmp = 0.1 * (a / k); elseif (m <= 6.5e+18) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -6.2e-17], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.5e+18], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -6.2 \cdot 10^{-17}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -6.1999999999999997e-17Initial 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 48.8%
Taylor expanded in k around 0 16.2%
*-commutative16.2%
Simplified16.2%
Taylor expanded in k around inf 23.5%
if -6.1999999999999997e-17 < m < 6.5e18Initial program 96.7%
associate-/l*96.7%
remove-double-neg96.7%
distribute-frac-neg296.7%
distribute-neg-frac296.7%
remove-double-neg96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in m around 0 92.7%
Taylor expanded in k around 0 44.3%
if 6.5e18 < m Initial program 80.2%
associate-/l*80.2%
remove-double-neg80.2%
distribute-frac-neg280.2%
distribute-neg-frac280.2%
remove-double-neg80.2%
sqr-neg80.2%
associate-+l+80.2%
sqr-neg80.2%
distribute-rgt-out80.2%
Simplified80.2%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 22.9%
Final simplification30.5%
(FPCore (a k m) :precision binary64 (if (<= m 5.5e+17) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5.5e+17) {
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 <= 5.5d+17) 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 <= 5.5e+17) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5.5e+17: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5.5e+17) 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 <= 5.5e+17) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5.5e+17], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5.5 \cdot 10^{+17}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 5.5e17Initial 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 71.1%
Taylor expanded in k around 0 24.6%
if 5.5e17 < m Initial program 80.2%
associate-/l*80.2%
remove-double-neg80.2%
distribute-frac-neg280.2%
distribute-neg-frac280.2%
remove-double-neg80.2%
sqr-neg80.2%
associate-+l+80.2%
sqr-neg80.2%
distribute-rgt-out80.2%
Simplified80.2%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 9.5%
Taylor expanded in k around inf 22.9%
Final simplification24.0%
(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 92.6%
associate-/l*92.6%
remove-double-neg92.6%
distribute-frac-neg292.6%
distribute-neg-frac292.6%
remove-double-neg92.6%
sqr-neg92.6%
associate-+l+92.6%
sqr-neg92.6%
distribute-rgt-out92.6%
Simplified92.6%
Taylor expanded in m around 0 49.6%
Taylor expanded in k around 0 18.1%
Final simplification18.1%
herbie shell --seed 2024046
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))