
(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 11 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))) 1e+147)
(* (/ (pow k m) (- -1.0 (* k (+ k 10.0)))) (- a))
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))) <= 1e+147) {
tmp = (pow(k, m) / (-1.0 - (k * (k + 10.0)))) * -a;
} 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))) <= 1d+147) then
tmp = ((k ** m) / ((-1.0d0) - (k * (k + 10.0d0)))) * -a
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))) <= 1e+147) {
tmp = (Math.pow(k, m) / (-1.0 - (k * (k + 10.0)))) * -a;
} 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))) <= 1e+147: tmp = (math.pow(k, m) / (-1.0 - (k * (k + 10.0)))) * -a 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))) <= 1e+147) tmp = Float64(Float64((k ^ m) / Float64(-1.0 - Float64(k * Float64(k + 10.0)))) * Float64(-a)); 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))) <= 1e+147) tmp = ((k ^ m) / (-1.0 - (k * (k + 10.0)))) * -a; 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], 1e+147], N[(N[(N[Power[k, m], $MachinePrecision] / N[(-1.0 - N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-a)), $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 10^{+147}:\\
\;\;\;\;\frac{{k}^{m}}{-1 - k \cdot \left(k + 10\right)} \cdot \left(-a\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))) < 9.9999999999999998e146Initial program 97.6%
sqr-neg97.6%
associate-+l+97.6%
sqr-neg97.6%
distribute-rgt-out97.6%
Simplified97.6%
frac-2neg97.6%
div-inv97.6%
distribute-rgt-neg-in97.6%
+-commutative97.6%
fma-def97.6%
+-commutative97.6%
Applied egg-rr97.6%
associate-*l*97.6%
associate-*r/97.6%
*-rgt-identity97.6%
fma-udef97.6%
+-commutative97.6%
distribute-neg-in97.6%
metadata-eval97.6%
sub-neg97.6%
Simplified97.6%
if 9.9999999999999998e146 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 70.1%
sqr-neg70.1%
associate-+l+70.1%
sqr-neg70.1%
distribute-rgt-out70.1%
Simplified70.1%
Taylor expanded in k around 0 100.0%
Final simplification98.2%
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m)))) (if (<= m 1.95e-20) (/ t_0 (+ 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 (m <= 1.95e-20) {
tmp = t_0 / (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 (m <= 1.95d-20) then
tmp = t_0 / (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 (m <= 1.95e-20) {
tmp = t_0 / (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 m <= 1.95e-20: tmp = t_0 / (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 (m <= 1.95e-20) tmp = Float64(t_0 / 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 (m <= 1.95e-20) tmp = t_0 / (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[m, 1.95e-20], N[(t$95$0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq 1.95 \cdot 10^{-20}:\\
\;\;\;\;\frac{t_0}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < 1.95000000000000004e-20Initial program 97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
if 1.95000000000000004e-20 < m Initial program 81.9%
sqr-neg81.9%
associate-+l+81.9%
sqr-neg81.9%
distribute-rgt-out81.9%
Simplified81.9%
Taylor expanded in k around 0 98.9%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -4.2) (not (<= m 1.95e-20))) (* 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 <= -4.2) || !(m <= 1.95e-20)) {
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 <= (-4.2d0)) .or. (.not. (m <= 1.95d-20))) 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 <= -4.2) || !(m <= 1.95e-20)) {
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 <= -4.2) or not (m <= 1.95e-20): 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 <= -4.2) || !(m <= 1.95e-20)) 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 <= -4.2) || ~((m <= 1.95e-20))) 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, -4.2], N[Not[LessEqual[m, 1.95e-20]], $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 -4.2 \lor \neg \left(m \leq 1.95 \cdot 10^{-20}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -4.20000000000000018 or 1.95000000000000004e-20 < m Initial program 89.9%
sqr-neg89.9%
associate-+l+89.9%
sqr-neg89.9%
distribute-rgt-out89.9%
Simplified89.9%
Taylor expanded in k around 0 99.4%
if -4.20000000000000018 < m < 1.95000000000000004e-20Initial program 94.6%
sqr-neg94.6%
associate-+l+94.6%
sqr-neg94.6%
distribute-rgt-out94.6%
Simplified94.6%
frac-2neg94.6%
div-inv94.6%
distribute-rgt-neg-in94.6%
+-commutative94.6%
fma-def94.6%
+-commutative94.6%
Applied egg-rr94.6%
associate-*l*94.6%
associate-*r/94.6%
*-rgt-identity94.6%
fma-udef94.6%
+-commutative94.6%
distribute-neg-in94.6%
metadata-eval94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in m around 0 94.5%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (<= m 0.3) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* a (* k 10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.3) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} 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 (m <= 0.3d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
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 (m <= 0.3) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.3: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a * (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.3) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * Float64(k * 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 0.3) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a * (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.3], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.3:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot 10\right)\\
\end{array}
\end{array}
if m < 0.299999999999999989Initial program 97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
frac-2neg97.1%
div-inv97.1%
distribute-rgt-neg-in97.1%
+-commutative97.1%
fma-def97.1%
+-commutative97.1%
Applied egg-rr97.1%
associate-*l*97.1%
associate-*r/97.1%
*-rgt-identity97.1%
fma-udef97.1%
+-commutative97.1%
distribute-neg-in97.1%
metadata-eval97.1%
sub-neg97.1%
Simplified97.1%
Taylor expanded in m around 0 69.4%
if 0.299999999999999989 < m Initial program 81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 6.1%
Taylor expanded in k around inf 23.0%
associate-*r*23.0%
*-commutative23.0%
associate-*r*23.0%
Simplified23.0%
expm1-log1p-u20.3%
expm1-udef42.4%
add-sqr-sqrt23.9%
sqrt-unprod53.3%
*-commutative53.3%
*-commutative53.3%
swap-sqr53.3%
metadata-eval53.3%
metadata-eval53.3%
swap-sqr53.3%
sqrt-unprod21.2%
add-sqr-sqrt44.0%
Applied egg-rr44.0%
expm1-def21.9%
expm1-log1p27.7%
*-commutative27.7%
Simplified27.7%
Final simplification54.2%
(FPCore (a k m) :precision binary64 (if (<= m -3.5e-5) (/ 0.1 (/ k a)) (if (<= m 0.96) (/ a (+ 1.0 (* k 10.0))) (* a (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.5e-5) {
tmp = 0.1 / (k / a);
} else if (m <= 0.96) {
tmp = a / (1.0 + (k * 10.0));
} 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 (m <= (-3.5d-5)) then
tmp = 0.1d0 / (k / a)
else if (m <= 0.96d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
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 (m <= -3.5e-5) {
tmp = 0.1 / (k / a);
} else if (m <= 0.96) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = a * (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.5e-5: tmp = 0.1 / (k / a) elif m <= 0.96: tmp = a / (1.0 + (k * 10.0)) else: tmp = a * (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.5e-5) tmp = Float64(0.1 / Float64(k / a)); elseif (m <= 0.96) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(a * Float64(k * 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.5e-5) tmp = 0.1 / (k / a); elseif (m <= 0.96) tmp = a / (1.0 + (k * 10.0)); else tmp = a * (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.5e-5], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.96], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{elif}\;m \leq 0.96:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot 10\right)\\
\end{array}
\end{array}
if m < -3.4999999999999997e-5Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.4%
Taylor expanded in k around 0 23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 30.0%
associate-*r/30.0%
associate-/l*32.0%
Simplified32.0%
if -3.4999999999999997e-5 < m < 0.95999999999999996Initial program 94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
Taylor expanded in m around 0 94.4%
Taylor expanded in k around 0 60.6%
*-commutative60.6%
Simplified60.6%
if 0.95999999999999996 < m Initial program 81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 6.1%
Taylor expanded in k around inf 23.0%
associate-*r*23.0%
*-commutative23.0%
associate-*r*23.0%
Simplified23.0%
expm1-log1p-u20.3%
expm1-udef42.4%
add-sqr-sqrt23.9%
sqrt-unprod53.3%
*-commutative53.3%
*-commutative53.3%
swap-sqr53.3%
metadata-eval53.3%
metadata-eval53.3%
swap-sqr53.3%
sqrt-unprod21.2%
add-sqr-sqrt44.0%
Applied egg-rr44.0%
expm1-def21.9%
expm1-log1p27.7%
*-commutative27.7%
Simplified27.7%
Final simplification40.0%
(FPCore (a k m) :precision binary64 (if (<= m 1.3) (/ a (+ 1.0 (* k (+ k 10.0)))) (* a (* k 10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.3) {
tmp = a / (1.0 + (k * (k + 10.0)));
} 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 (m <= 1.3d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
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 (m <= 1.3) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a * (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.3: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a * (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.3) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a * Float64(k * 10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.3) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a * (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.3], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.3:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot 10\right)\\
\end{array}
\end{array}
if m < 1.30000000000000004Initial program 97.1%
sqr-neg97.1%
associate-+l+97.1%
sqr-neg97.1%
distribute-rgt-out97.1%
Simplified97.1%
Taylor expanded in m around 0 69.4%
if 1.30000000000000004 < m Initial program 81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 6.1%
Taylor expanded in k around inf 23.0%
associate-*r*23.0%
*-commutative23.0%
associate-*r*23.0%
Simplified23.0%
expm1-log1p-u20.3%
expm1-udef42.4%
add-sqr-sqrt23.9%
sqrt-unprod53.3%
*-commutative53.3%
*-commutative53.3%
swap-sqr53.3%
metadata-eval53.3%
metadata-eval53.3%
swap-sqr53.3%
sqrt-unprod21.2%
add-sqr-sqrt44.0%
Applied egg-rr44.0%
expm1-def21.9%
expm1-log1p27.7%
*-commutative27.7%
Simplified27.7%
Final simplification54.2%
(FPCore (a k m) :precision binary64 (if (<= m -3.45e-12) (* 0.1 (/ a k)) (if (<= m 5e+24) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.45e-12) {
tmp = 0.1 * (a / k);
} else if (m <= 5e+24) {
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 <= (-3.45d-12)) then
tmp = 0.1d0 * (a / k)
else if (m <= 5d+24) 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 <= -3.45e-12) {
tmp = 0.1 * (a / k);
} else if (m <= 5e+24) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.45e-12: tmp = 0.1 * (a / k) elif m <= 5e+24: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.45e-12) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 5e+24) 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 <= -3.45e-12) tmp = 0.1 * (a / k); elseif (m <= 5e+24) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.45e-12], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5e+24], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.45 \cdot 10^{-12}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 5 \cdot 10^{+24}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -3.45e-12Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.4%
Taylor expanded in k around 0 23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 30.0%
if -3.45e-12 < m < 5.00000000000000045e24Initial program 91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
Taylor expanded in m around 0 86.6%
Taylor expanded in k around 0 45.4%
if 5.00000000000000045e24 < m Initial program 83.5%
sqr-neg83.5%
associate-+l+83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
Simplified83.5%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 6.6%
Taylor expanded in k around inf 25.1%
Final simplification34.0%
(FPCore (a k m) :precision binary64 (if (<= m -3e-6) (* 0.1 (/ a k)) (if (<= m 0.27) a (* a (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3e-6) {
tmp = 0.1 * (a / k);
} else if (m <= 0.27) {
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 (m <= (-3d-6)) then
tmp = 0.1d0 * (a / k)
else if (m <= 0.27d0) 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 (m <= -3e-6) {
tmp = 0.1 * (a / k);
} else if (m <= 0.27) {
tmp = a;
} else {
tmp = a * (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3e-6: tmp = 0.1 * (a / k) elif m <= 0.27: tmp = a else: tmp = a * (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3e-6) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 0.27) 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 (m <= -3e-6) tmp = 0.1 * (a / k); elseif (m <= 0.27) tmp = a; else tmp = a * (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3e-6], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.27], a, N[(a * N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3 \cdot 10^{-6}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 0.27:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot 10\right)\\
\end{array}
\end{array}
if m < -3.0000000000000001e-6Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.4%
Taylor expanded in k around 0 23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 30.0%
if -3.0000000000000001e-6 < m < 0.27000000000000002Initial program 94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
Taylor expanded in m around 0 94.4%
Taylor expanded in k around 0 49.3%
if 0.27000000000000002 < m Initial program 81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 6.1%
Taylor expanded in k around inf 23.0%
associate-*r*23.0%
*-commutative23.0%
associate-*r*23.0%
Simplified23.0%
expm1-log1p-u20.3%
expm1-udef42.4%
add-sqr-sqrt23.9%
sqrt-unprod53.3%
*-commutative53.3%
*-commutative53.3%
swap-sqr53.3%
metadata-eval53.3%
metadata-eval53.3%
swap-sqr53.3%
sqrt-unprod21.2%
add-sqr-sqrt44.0%
Applied egg-rr44.0%
expm1-def21.9%
expm1-log1p27.7%
*-commutative27.7%
Simplified27.7%
Final simplification35.6%
(FPCore (a k m) :precision binary64 (if (<= m -3.1e-7) (/ 0.1 (/ k a)) (if (<= m 0.63) a (* a (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.1e-7) {
tmp = 0.1 / (k / a);
} else if (m <= 0.63) {
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 (m <= (-3.1d-7)) then
tmp = 0.1d0 / (k / a)
else if (m <= 0.63d0) 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 (m <= -3.1e-7) {
tmp = 0.1 / (k / a);
} else if (m <= 0.63) {
tmp = a;
} else {
tmp = a * (k * 10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.1e-7: tmp = 0.1 / (k / a) elif m <= 0.63: tmp = a else: tmp = a * (k * 10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.1e-7) tmp = Float64(0.1 / Float64(k / a)); elseif (m <= 0.63) 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 (m <= -3.1e-7) tmp = 0.1 / (k / a); elseif (m <= 0.63) tmp = a; else tmp = a * (k * 10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.1e-7], N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.63], a, N[(a * N[(k * 10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.1 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\mathbf{elif}\;m \leq 0.63:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot 10\right)\\
\end{array}
\end{array}
if m < -3.1e-7Initial program 100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 41.4%
Taylor expanded in k around 0 23.1%
*-commutative23.1%
Simplified23.1%
Taylor expanded in k around inf 30.0%
associate-*r/30.0%
associate-/l*32.0%
Simplified32.0%
if -3.1e-7 < m < 0.630000000000000004Initial program 94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
Taylor expanded in m around 0 94.4%
Taylor expanded in k around 0 49.3%
if 0.630000000000000004 < m Initial program 81.7%
sqr-neg81.7%
associate-+l+81.7%
sqr-neg81.7%
distribute-rgt-out81.7%
Simplified81.7%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 6.1%
Taylor expanded in k around inf 23.0%
associate-*r*23.0%
*-commutative23.0%
associate-*r*23.0%
Simplified23.0%
expm1-log1p-u20.3%
expm1-udef42.4%
add-sqr-sqrt23.9%
sqrt-unprod53.3%
*-commutative53.3%
*-commutative53.3%
swap-sqr53.3%
metadata-eval53.3%
metadata-eval53.3%
swap-sqr53.3%
sqrt-unprod21.2%
add-sqr-sqrt44.0%
Applied egg-rr44.0%
expm1-def21.9%
expm1-log1p27.7%
*-commutative27.7%
Simplified27.7%
Final simplification36.2%
(FPCore (a k m) :precision binary64 (if (<= m 5e+24) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 5e+24) {
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 <= 5d+24) 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 <= 5e+24) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 5e+24: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 5e+24) 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 <= 5e+24) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 5e+24], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 5 \cdot 10^{+24}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 5.00000000000000045e24Initial program 95.5%
sqr-neg95.5%
associate-+l+95.5%
sqr-neg95.5%
distribute-rgt-out95.5%
Simplified95.5%
Taylor expanded in m around 0 66.2%
Taylor expanded in k around 0 26.7%
if 5.00000000000000045e24 < m Initial program 83.5%
sqr-neg83.5%
associate-+l+83.5%
sqr-neg83.5%
distribute-rgt-out83.5%
Simplified83.5%
Taylor expanded in m around 0 3.3%
Taylor expanded in k around 0 6.6%
Taylor expanded in k around inf 25.1%
Final simplification26.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.5%
sqr-neg91.5%
associate-+l+91.5%
sqr-neg91.5%
distribute-rgt-out91.5%
Simplified91.5%
Taylor expanded in m around 0 45.3%
Taylor expanded in k around 0 19.1%
Final simplification19.1%
herbie shell --seed 2023302
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))