
(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 15 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 10.0) 1.0) (* k k))) 1e+248)
(/ t_0 (+ (* k (+ k 10.0)) 1.0))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / (((k * 10.0) + 1.0) + (k * k))) <= 1e+248) {
tmp = t_0 / ((k * (k + 10.0)) + 1.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 * 10.0d0) + 1.0d0) + (k * k))) <= 1d+248) then
tmp = t_0 / ((k * (k + 10.0d0)) + 1.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 * 10.0) + 1.0) + (k * k))) <= 1e+248) {
tmp = t_0 / ((k * (k + 10.0)) + 1.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 * 10.0) + 1.0) + (k * k))) <= 1e+248: tmp = t_0 / ((k * (k + 10.0)) + 1.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(Float64(k * 10.0) + 1.0) + Float64(k * k))) <= 1e+248) tmp = Float64(t_0 / Float64(Float64(k * Float64(k + 10.0)) + 1.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 * 10.0) + 1.0) + (k * k))) <= 1e+248) tmp = t_0 / ((k * (k + 10.0)) + 1.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[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e+248], N[(t$95$0 / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t\_0}{\left(k \cdot 10 + 1\right) + k \cdot k} \leq 10^{+248}:\\
\;\;\;\;\frac{t\_0}{k \cdot \left(k + 10\right) + 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.00000000000000005e248Initial program 97.0%
associate-/l*97.0%
remove-double-neg97.0%
distribute-frac-neg297.0%
distribute-neg-frac297.0%
remove-double-neg97.0%
sqr-neg97.0%
associate-+l+97.0%
sqr-neg97.0%
distribute-rgt-out97.0%
Simplified97.0%
Taylor expanded in a around 0 97.0%
if 1.00000000000000005e248 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 62.2%
associate-/l*62.2%
remove-double-neg62.2%
distribute-frac-neg262.2%
distribute-neg-frac262.2%
remove-double-neg62.2%
sqr-neg62.2%
associate-+l+62.2%
sqr-neg62.2%
distribute-rgt-out62.2%
Simplified62.2%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (if (<= m 3.3) (* a (/ (pow k m) (+ (* k (+ k 10.0)) 1.0))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.3) {
tmp = a * (pow(k, m) / ((k * (k + 10.0)) + 1.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 <= 3.3d0) then
tmp = a * ((k ** m) / ((k * (k + 10.0d0)) + 1.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 <= 3.3) {
tmp = a * (Math.pow(k, m) / ((k * (k + 10.0)) + 1.0));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.3: tmp = a * (math.pow(k, m) / ((k * (k + 10.0)) + 1.0)) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.3) tmp = Float64(a * Float64((k ^ m) / Float64(Float64(k * Float64(k + 10.0)) + 1.0))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.3) tmp = a * ((k ^ m) / ((k * (k + 10.0)) + 1.0)); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.3], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.3:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 3.2999999999999998Initial program 96.5%
associate-/l*96.5%
remove-double-neg96.5%
distribute-frac-neg296.5%
distribute-neg-frac296.5%
remove-double-neg96.5%
sqr-neg96.5%
associate-+l+96.5%
sqr-neg96.5%
distribute-rgt-out96.5%
Simplified96.5%
if 3.2999999999999998 < m Initial program 77.0%
associate-/l*77.0%
remove-double-neg77.0%
distribute-frac-neg277.0%
distribute-neg-frac277.0%
remove-double-neg77.0%
sqr-neg77.0%
associate-+l+77.0%
sqr-neg77.0%
distribute-rgt-out77.0%
Simplified77.0%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.5%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) (* a (pow k m)) (* (pow k m) (/ (/ a k) (+ k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a * pow(k, m);
} else {
tmp = pow(k, m) * ((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 <= 0.1d0) then
tmp = a * (k ** m)
else
tmp = (k ** m) * ((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 <= 0.1) {
tmp = a * Math.pow(k, m);
} else {
tmp = Math.pow(k, m) * ((a / k) / (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a * math.pow(k, m) else: tmp = math.pow(k, m) * ((a / k) / (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = Float64(a * (k ^ m)); else tmp = Float64((k ^ m) * Float64(Float64(a / k) / Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a * (k ^ m); else tmp = (k ^ m) * ((a / k) / (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[Power[k, m], $MachinePrecision] * N[(N[(a / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;{k}^{m} \cdot \frac{\frac{a}{k}}{k + 10}\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 94.3%
associate-/l*94.3%
remove-double-neg94.3%
distribute-frac-neg294.3%
distribute-neg-frac294.3%
remove-double-neg94.3%
sqr-neg94.3%
associate-+l+94.3%
sqr-neg94.3%
distribute-rgt-out94.3%
Simplified94.3%
Taylor expanded in k around 0 99.6%
*-commutative99.6%
Simplified99.6%
if 0.10000000000000001 < k Initial program 85.3%
associate-/l*85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-neg-frac285.3%
remove-double-neg85.3%
sqr-neg85.3%
associate-+l+85.3%
sqr-neg85.3%
distribute-rgt-out85.3%
Simplified85.3%
distribute-rgt-in85.3%
associate-+l+85.3%
associate-*r/85.3%
clear-num85.3%
associate-/r*84.2%
associate-+l+84.2%
distribute-rgt-in84.2%
+-commutative84.2%
fma-define84.2%
+-commutative84.2%
Applied egg-rr84.2%
associate-/r/84.2%
associate-*l/84.2%
*-lft-identity84.2%
Simplified84.2%
Taylor expanded in k around inf 82.6%
+-commutative82.6%
unpow282.6%
distribute-rgt-in82.6%
Simplified82.6%
div-inv82.6%
clear-num82.6%
associate-/r*90.0%
Applied egg-rr90.0%
Final simplification95.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -2.9e-10) (not (<= m 1.15e-5))) (* a (pow k m)) (/ a (+ (* k (+ k 10.0)) 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -2.9e-10) || !(m <= 1.15e-5)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((k * (k + 10.0)) + 1.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.9d-10)) .or. (.not. (m <= 1.15d-5))) then
tmp = a * (k ** m)
else
tmp = a / ((k * (k + 10.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -2.9e-10) || !(m <= 1.15e-5)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((k * (k + 10.0)) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -2.9e-10) or not (m <= 1.15e-5): tmp = a * math.pow(k, m) else: tmp = a / ((k * (k + 10.0)) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -2.9e-10) || !(m <= 1.15e-5)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -2.9e-10) || ~((m <= 1.15e-5))) tmp = a * (k ^ m); else tmp = a / ((k * (k + 10.0)) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -2.9e-10], N[Not[LessEqual[m, 1.15e-5]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.9 \cdot 10^{-10} \lor \neg \left(m \leq 1.15 \cdot 10^{-5}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\end{array}
\end{array}
if m < -2.89999999999999981e-10 or 1.15e-5 < m Initial program 89.3%
associate-/l*89.3%
remove-double-neg89.3%
distribute-frac-neg289.3%
distribute-neg-frac289.3%
remove-double-neg89.3%
sqr-neg89.3%
associate-+l+89.3%
sqr-neg89.3%
distribute-rgt-out89.3%
Simplified89.3%
Taylor expanded in k around 0 99.4%
*-commutative99.4%
Simplified99.4%
if -2.89999999999999981e-10 < m < 1.15e-5Initial program 93.9%
associate-/l*93.9%
remove-double-neg93.9%
distribute-frac-neg293.9%
distribute-neg-frac293.9%
remove-double-neg93.9%
sqr-neg93.9%
associate-+l+93.9%
sqr-neg93.9%
distribute-rgt-out93.9%
Simplified93.9%
Taylor expanded in m around 0 92.9%
Final simplification97.2%
(FPCore (a k m)
:precision binary64
(if (<= m -0.35)
(/ a (* k k))
(if (<= m 1.3e-182)
(/ (/ a k) k)
(if (<= m 2.3e+34) (/ a (+ (* k 10.0) 1.0)) (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.35) {
tmp = a / (k * k);
} else if (m <= 1.3e-182) {
tmp = (a / k) / k;
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.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 <= (-0.35d0)) then
tmp = a / (k * k)
else if (m <= 1.3d-182) then
tmp = (a / k) / k
else if (m <= 2.3d+34) then
tmp = a / ((k * 10.0d0) + 1.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 <= -0.35) {
tmp = a / (k * k);
} else if (m <= 1.3e-182) {
tmp = (a / k) / k;
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.35: tmp = a / (k * k) elif m <= 1.3e-182: tmp = (a / k) / k elif m <= 2.3e+34: tmp = a / ((k * 10.0) + 1.0) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.35) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.3e-182) tmp = Float64(Float64(a / k) / k); elseif (m <= 2.3e+34) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.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 <= -0.35) tmp = a / (k * k); elseif (m <= 1.3e-182) tmp = (a / k) / k; elseif (m <= 2.3e+34) tmp = a / ((k * 10.0) + 1.0); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.35], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.3e-182], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], If[LessEqual[m, 2.3e+34], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.35:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.3 \cdot 10^{-182}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.34999999999999998Initial 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 42.3%
Taylor expanded in k around inf 63.9%
*-un-lft-identity63.9%
unpow263.9%
times-frac52.0%
Applied egg-rr52.0%
frac-2neg52.0%
metadata-eval52.0%
frac-times63.9%
neg-mul-163.9%
Applied egg-rr63.9%
if -0.34999999999999998 < m < 1.30000000000000003e-182Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
distribute-frac-neg291.8%
distribute-neg-frac291.8%
remove-double-neg91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
Taylor expanded in m around 0 88.6%
Taylor expanded in k around inf 53.0%
*-un-lft-identity53.0%
unpow253.0%
times-frac60.2%
Applied egg-rr60.2%
associate-*l/60.2%
*-un-lft-identity60.2%
Applied egg-rr60.2%
if 1.30000000000000003e-182 < m < 2.2999999999999998e34Initial program 94.8%
associate-/l*94.8%
remove-double-neg94.8%
distribute-frac-neg294.8%
distribute-neg-frac294.8%
remove-double-neg94.8%
sqr-neg94.8%
associate-+l+94.8%
sqr-neg94.8%
distribute-rgt-out94.8%
Simplified94.8%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around 0 59.5%
*-commutative59.5%
Simplified59.5%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification52.1%
(FPCore (a k m)
:precision binary64
(if (<= m -0.25)
(/ a (* k k))
(if (<= m 1.32e-183)
(/ (/ 1.0 k) (/ k a))
(if (<= m 2.3e+34) (/ a (+ (* k 10.0) 1.0)) (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.25) {
tmp = a / (k * k);
} else if (m <= 1.32e-183) {
tmp = (1.0 / k) / (k / a);
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.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 <= (-0.25d0)) then
tmp = a / (k * k)
else if (m <= 1.32d-183) then
tmp = (1.0d0 / k) / (k / a)
else if (m <= 2.3d+34) then
tmp = a / ((k * 10.0d0) + 1.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 <= -0.25) {
tmp = a / (k * k);
} else if (m <= 1.32e-183) {
tmp = (1.0 / k) / (k / a);
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.25: tmp = a / (k * k) elif m <= 1.32e-183: tmp = (1.0 / k) / (k / a) elif m <= 2.3e+34: tmp = a / ((k * 10.0) + 1.0) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.25) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.32e-183) tmp = Float64(Float64(1.0 / k) / Float64(k / a)); elseif (m <= 2.3e+34) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.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 <= -0.25) tmp = a / (k * k); elseif (m <= 1.32e-183) tmp = (1.0 / k) / (k / a); elseif (m <= 2.3e+34) tmp = a / ((k * 10.0) + 1.0); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.25], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.32e-183], N[(N[(1.0 / k), $MachinePrecision] / N[(k / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+34], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.25:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.32 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{1}{k}}{\frac{k}{a}}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.25Initial 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 42.3%
Taylor expanded in k around inf 63.9%
*-un-lft-identity63.9%
unpow263.9%
times-frac52.0%
Applied egg-rr52.0%
frac-2neg52.0%
metadata-eval52.0%
frac-times63.9%
neg-mul-163.9%
Applied egg-rr63.9%
if -0.25 < m < 1.3199999999999999e-183Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
distribute-frac-neg291.8%
distribute-neg-frac291.8%
remove-double-neg91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
Taylor expanded in m around 0 88.6%
Taylor expanded in k around inf 53.0%
*-un-lft-identity53.0%
unpow253.0%
times-frac60.2%
Applied egg-rr60.2%
clear-num60.2%
un-div-inv60.2%
Applied egg-rr60.2%
if 1.3199999999999999e-183 < m < 2.2999999999999998e34Initial program 94.8%
associate-/l*94.8%
remove-double-neg94.8%
distribute-frac-neg294.8%
distribute-neg-frac294.8%
remove-double-neg94.8%
sqr-neg94.8%
associate-+l+94.8%
sqr-neg94.8%
distribute-rgt-out94.8%
Simplified94.8%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around 0 59.5%
*-commutative59.5%
Simplified59.5%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification52.1%
(FPCore (a k m)
:precision binary64
(if (<= m -0.082)
(/ a (* k k))
(if (<= m 1.5e-183)
(/ (/ a k) (+ k 10.0))
(if (<= m 2.3e+34) (/ a (+ (* k 10.0) 1.0)) (* -10.0 (* a k))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.082) {
tmp = a / (k * k);
} else if (m <= 1.5e-183) {
tmp = (a / k) / (k + 10.0);
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.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 <= (-0.082d0)) then
tmp = a / (k * k)
else if (m <= 1.5d-183) then
tmp = (a / k) / (k + 10.0d0)
else if (m <= 2.3d+34) then
tmp = a / ((k * 10.0d0) + 1.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 <= -0.082) {
tmp = a / (k * k);
} else if (m <= 1.5e-183) {
tmp = (a / k) / (k + 10.0);
} else if (m <= 2.3e+34) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.082: tmp = a / (k * k) elif m <= 1.5e-183: tmp = (a / k) / (k + 10.0) elif m <= 2.3e+34: tmp = a / ((k * 10.0) + 1.0) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.082) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.5e-183) tmp = Float64(Float64(a / k) / Float64(k + 10.0)); elseif (m <= 2.3e+34) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.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 <= -0.082) tmp = a / (k * k); elseif (m <= 1.5e-183) tmp = (a / k) / (k + 10.0); elseif (m <= 2.3e+34) tmp = a / ((k * 10.0) + 1.0); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.082], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.5e-183], N[(N[(a / k), $MachinePrecision] / N[(k + 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+34], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.082:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.5 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{a}{k}}{k + 10}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.0820000000000000034Initial 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 42.3%
Taylor expanded in k around inf 63.9%
*-un-lft-identity63.9%
unpow263.9%
times-frac52.0%
Applied egg-rr52.0%
frac-2neg52.0%
metadata-eval52.0%
frac-times63.9%
neg-mul-163.9%
Applied egg-rr63.9%
if -0.0820000000000000034 < m < 1.4999999999999999e-183Initial program 91.8%
associate-/l*91.8%
remove-double-neg91.8%
distribute-frac-neg291.8%
distribute-neg-frac291.8%
remove-double-neg91.8%
sqr-neg91.8%
associate-+l+91.8%
sqr-neg91.8%
distribute-rgt-out91.8%
Simplified91.8%
distribute-rgt-in91.8%
associate-+l+91.8%
associate-*r/91.8%
clear-num91.6%
associate-/r*91.6%
associate-+l+91.6%
distribute-rgt-in91.6%
+-commutative91.6%
fma-define91.6%
+-commutative91.6%
Applied egg-rr91.6%
associate-/r/91.6%
associate-*l/91.6%
*-lft-identity91.6%
Simplified91.6%
Taylor expanded in k around inf 54.5%
+-commutative54.5%
unpow254.5%
distribute-rgt-in54.5%
Simplified54.5%
div-inv54.5%
clear-num54.6%
associate-/r*62.6%
Applied egg-rr62.6%
Taylor expanded in m around 0 54.3%
associate-/r*61.5%
+-commutative61.5%
Simplified61.5%
if 1.4999999999999999e-183 < m < 2.2999999999999998e34Initial program 94.8%
associate-/l*94.8%
remove-double-neg94.8%
distribute-frac-neg294.8%
distribute-neg-frac294.8%
remove-double-neg94.8%
sqr-neg94.8%
associate-+l+94.8%
sqr-neg94.8%
distribute-rgt-out94.8%
Simplified94.8%
Taylor expanded in m around 0 67.5%
Taylor expanded in k around 0 59.5%
*-commutative59.5%
Simplified59.5%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification52.4%
(FPCore (a k m) :precision binary64 (if (<= m -8.5) (/ a (* k k)) (if (<= m 2.3e+34) (/ a (+ (* k (+ k 10.0)) 1.0)) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -8.5) {
tmp = a / (k * k);
} else if (m <= 2.3e+34) {
tmp = a / ((k * (k + 10.0)) + 1.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 <= (-8.5d0)) then
tmp = a / (k * k)
else if (m <= 2.3d+34) then
tmp = a / ((k * (k + 10.0d0)) + 1.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 <= -8.5) {
tmp = a / (k * k);
} else if (m <= 2.3e+34) {
tmp = a / ((k * (k + 10.0)) + 1.0);
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -8.5: tmp = a / (k * k) elif m <= 2.3e+34: tmp = a / ((k * (k + 10.0)) + 1.0) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -8.5) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.3e+34) tmp = Float64(a / Float64(Float64(k * Float64(k + 10.0)) + 1.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 <= -8.5) tmp = a / (k * k); elseif (m <= 2.3e+34) tmp = a / ((k * (k + 10.0)) + 1.0); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -8.5], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+34], N[(a / N[(N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.5:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right) + 1}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -8.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 m around 0 41.7%
Taylor expanded in k around inf 63.5%
*-un-lft-identity63.5%
unpow263.5%
times-frac52.5%
Applied egg-rr52.5%
frac-2neg52.5%
metadata-eval52.5%
frac-times63.5%
neg-mul-163.5%
Applied egg-rr63.5%
if -8.5 < m < 2.2999999999999998e34Initial program 93.0%
associate-/l*92.9%
remove-double-neg92.9%
distribute-frac-neg292.9%
distribute-neg-frac292.9%
remove-double-neg92.9%
sqr-neg92.9%
associate-+l+93.0%
sqr-neg93.0%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 81.0%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification60.5%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.15e-294) (not (<= k 0.1))) (/ (/ a k) k) (* a (+ (* k -10.0) 1.0))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.15e-294) || !(k <= 0.1)) {
tmp = (a / k) / k;
} else {
tmp = a * ((k * -10.0) + 1.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.15d-294) .or. (.not. (k <= 0.1d0))) then
tmp = (a / k) / k
else
tmp = a * ((k * (-10.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 1.15e-294) || !(k <= 0.1)) {
tmp = (a / k) / k;
} else {
tmp = a * ((k * -10.0) + 1.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.15e-294) or not (k <= 0.1): tmp = (a / k) / k else: tmp = a * ((k * -10.0) + 1.0) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.15e-294) || !(k <= 0.1)) tmp = Float64(Float64(a / k) / k); else tmp = Float64(a * Float64(Float64(k * -10.0) + 1.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 1.15e-294) || ~((k <= 0.1))) tmp = (a / k) / k; else tmp = a * ((k * -10.0) + 1.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.15e-294], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], N[(a * N[(N[(k * -10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.15 \cdot 10^{-294} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(k \cdot -10 + 1\right)\\
\end{array}
\end{array}
if k < 1.15000000000000008e-294 or 0.10000000000000001 < k Initial program 86.9%
associate-/l*86.9%
remove-double-neg86.9%
distribute-frac-neg286.9%
distribute-neg-frac286.9%
remove-double-neg86.9%
sqr-neg86.9%
associate-+l+86.9%
sqr-neg86.9%
distribute-rgt-out86.9%
Simplified86.9%
Taylor expanded in m around 0 46.5%
Taylor expanded in k around inf 47.9%
*-un-lft-identity47.9%
unpow247.9%
times-frac46.6%
Applied egg-rr46.6%
associate-*l/46.6%
*-un-lft-identity46.6%
Applied egg-rr46.6%
if 1.15000000000000008e-294 < k < 0.10000000000000001Initial 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 51.7%
Taylor expanded in k around 0 51.7%
*-commutative51.7%
Simplified51.7%
Final simplification48.1%
(FPCore (a k m) :precision binary64 (if (<= k 1.35e-294) (/ 1.0 (* k (/ k a))) (if (<= k 0.1) (* a (+ (* k -10.0) 1.0)) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.35e-294) {
tmp = 1.0 / (k * (k / a));
} else if (k <= 0.1) {
tmp = a * ((k * -10.0) + 1.0);
} else {
tmp = (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 <= 1.35d-294) then
tmp = 1.0d0 / (k * (k / a))
else if (k <= 0.1d0) then
tmp = a * ((k * (-10.0d0)) + 1.0d0)
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.35e-294) {
tmp = 1.0 / (k * (k / a));
} else if (k <= 0.1) {
tmp = a * ((k * -10.0) + 1.0);
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.35e-294: tmp = 1.0 / (k * (k / a)) elif k <= 0.1: tmp = a * ((k * -10.0) + 1.0) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.35e-294) tmp = Float64(1.0 / Float64(k * Float64(k / a))); elseif (k <= 0.1) tmp = Float64(a * Float64(Float64(k * -10.0) + 1.0)); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.35e-294) tmp = 1.0 / (k * (k / a)); elseif (k <= 0.1) tmp = a * ((k * -10.0) + 1.0); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.35e-294], N[(1.0 / N[(k * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(a * N[(N[(k * -10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.35 \cdot 10^{-294}:\\
\;\;\;\;\frac{1}{k \cdot \frac{k}{a}}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a \cdot \left(k \cdot -10 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.35000000000000005e-294Initial program 88.9%
associate-/l*88.9%
remove-double-neg88.9%
distribute-frac-neg288.9%
distribute-neg-frac288.9%
remove-double-neg88.9%
sqr-neg88.9%
associate-+l+88.9%
sqr-neg88.9%
distribute-rgt-out88.9%
Simplified88.9%
Taylor expanded in m around 0 28.4%
Taylor expanded in k around inf 34.0%
*-un-lft-identity34.0%
unpow234.0%
times-frac30.1%
Applied egg-rr30.1%
*-commutative30.1%
clear-num30.1%
frac-times30.9%
metadata-eval30.9%
Applied egg-rr30.9%
if 1.35000000000000005e-294 < k < 0.10000000000000001Initial 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 51.7%
Taylor expanded in k around 0 51.7%
*-commutative51.7%
Simplified51.7%
if 0.10000000000000001 < k Initial program 85.3%
associate-/l*85.3%
remove-double-neg85.3%
distribute-frac-neg285.3%
distribute-neg-frac285.3%
remove-double-neg85.3%
sqr-neg85.3%
associate-+l+85.3%
sqr-neg85.3%
distribute-rgt-out85.3%
Simplified85.3%
Taylor expanded in m around 0 61.7%
Taylor expanded in k around inf 59.4%
*-un-lft-identity59.4%
unpow259.4%
times-frac60.4%
Applied egg-rr60.4%
associate-*l/60.4%
*-un-lft-identity60.4%
Applied egg-rr60.4%
Final simplification48.4%
(FPCore (a k m) :precision binary64 (if (<= k 9e-295) (/ 1.0 (* k (/ k a))) (if (<= k 10.0) (/ a (+ (* k 10.0) 1.0)) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 9e-295) {
tmp = 1.0 / (k * (k / a));
} else if (k <= 10.0) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = (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 <= 9d-295) then
tmp = 1.0d0 / (k * (k / a))
else if (k <= 10.0d0) then
tmp = a / ((k * 10.0d0) + 1.0d0)
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 9e-295) {
tmp = 1.0 / (k * (k / a));
} else if (k <= 10.0) {
tmp = a / ((k * 10.0) + 1.0);
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 9e-295: tmp = 1.0 / (k * (k / a)) elif k <= 10.0: tmp = a / ((k * 10.0) + 1.0) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 9e-295) tmp = Float64(1.0 / Float64(k * Float64(k / a))); elseif (k <= 10.0) tmp = Float64(a / Float64(Float64(k * 10.0) + 1.0)); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 9e-295) tmp = 1.0 / (k * (k / a)); elseif (k <= 10.0) tmp = a / ((k * 10.0) + 1.0); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 9e-295], N[(1.0 / N[(k * N[(k / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 10.0], N[(a / N[(N[(k * 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 9 \cdot 10^{-295}:\\
\;\;\;\;\frac{1}{k \cdot \frac{k}{a}}\\
\mathbf{elif}\;k \leq 10:\\
\;\;\;\;\frac{a}{k \cdot 10 + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 9.0000000000000003e-295Initial program 88.9%
associate-/l*88.9%
remove-double-neg88.9%
distribute-frac-neg288.9%
distribute-neg-frac288.9%
remove-double-neg88.9%
sqr-neg88.9%
associate-+l+88.9%
sqr-neg88.9%
distribute-rgt-out88.9%
Simplified88.9%
Taylor expanded in m around 0 28.4%
Taylor expanded in k around inf 34.0%
*-un-lft-identity34.0%
unpow234.0%
times-frac30.1%
Applied egg-rr30.1%
*-commutative30.1%
clear-num30.1%
frac-times30.9%
metadata-eval30.9%
Applied egg-rr30.9%
if 9.0000000000000003e-295 < k < 10Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 51.8%
Taylor expanded in k around 0 49.9%
*-commutative49.9%
Simplified49.9%
if 10 < k Initial program 84.7%
associate-/l*84.6%
remove-double-neg84.6%
distribute-frac-neg284.6%
distribute-neg-frac284.6%
remove-double-neg84.6%
sqr-neg84.6%
associate-+l+84.6%
sqr-neg84.6%
distribute-rgt-out84.6%
Simplified84.6%
Taylor expanded in m around 0 62.1%
Taylor expanded in k around inf 61.5%
*-un-lft-identity61.5%
unpow261.5%
times-frac62.5%
Applied egg-rr62.5%
associate-*l/62.5%
*-un-lft-identity62.5%
Applied egg-rr62.5%
Final simplification48.5%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.35e-294) (not (<= k 1.75))) (/ (/ a k) k) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.35e-294) || !(k <= 1.75)) {
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.35d-294) .or. (.not. (k <= 1.75d0))) 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.35e-294) || !(k <= 1.75)) {
tmp = (a / k) / k;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.35e-294) or not (k <= 1.75): tmp = (a / k) / k else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.35e-294) || !(k <= 1.75)) tmp = Float64(Float64(a / k) / k); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 1.35e-294) || ~((k <= 1.75))) tmp = (a / k) / k; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.35e-294], N[Not[LessEqual[k, 1.75]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.35 \cdot 10^{-294} \lor \neg \left(k \leq 1.75\right):\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.35000000000000005e-294 or 1.75 < k Initial program 86.7%
associate-/l*86.7%
remove-double-neg86.7%
distribute-frac-neg286.7%
distribute-neg-frac286.7%
remove-double-neg86.7%
sqr-neg86.7%
associate-+l+86.7%
sqr-neg86.7%
distribute-rgt-out86.7%
Simplified86.7%
Taylor expanded in m around 0 46.7%
Taylor expanded in k around inf 48.5%
*-un-lft-identity48.5%
unpow248.5%
times-frac47.2%
Applied egg-rr47.2%
associate-*l/47.2%
*-un-lft-identity47.2%
Applied egg-rr47.2%
if 1.35000000000000005e-294 < k < 1.75Initial program 99.9%
associate-/l*99.9%
remove-double-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac299.9%
remove-double-neg99.9%
sqr-neg99.9%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 51.2%
Taylor expanded in k around 0 49.3%
Final simplification47.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.2e-20) (/ a (* k 10.0)) (if (<= m 2.3e+34) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.2e-20) {
tmp = a / (k * 10.0);
} else if (m <= 2.3e+34) {
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.2d-20)) then
tmp = a / (k * 10.0d0)
else if (m <= 2.3d+34) 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.2e-20) {
tmp = a / (k * 10.0);
} else if (m <= 2.3e+34) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.2e-20: tmp = a / (k * 10.0) elif m <= 2.3e+34: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.2e-20) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 2.3e+34) 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.2e-20) tmp = a / (k * 10.0); elseif (m <= 2.3e+34) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.2e-20], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+34], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.2 \cdot 10^{-20}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.19999999999999996e-20Initial program 98.4%
associate-/l*98.4%
remove-double-neg98.4%
distribute-frac-neg298.4%
distribute-neg-frac298.4%
remove-double-neg98.4%
sqr-neg98.4%
associate-+l+98.4%
sqr-neg98.4%
distribute-rgt-out98.4%
Simplified98.4%
distribute-rgt-in98.4%
associate-+l+98.4%
associate-*r/98.4%
clear-num98.4%
associate-/r*98.4%
associate-+l+98.4%
distribute-rgt-in98.4%
+-commutative98.4%
fma-define98.4%
+-commutative98.4%
Applied egg-rr98.4%
associate-/r/98.4%
associate-*l/98.4%
*-lft-identity98.4%
Simplified98.4%
Taylor expanded in k around inf 83.1%
+-commutative83.1%
unpow283.1%
distribute-rgt-in83.1%
Simplified83.1%
Taylor expanded in m around 0 44.4%
associate-/r*37.4%
+-commutative37.4%
associate-/r*44.4%
Simplified44.4%
Taylor expanded in k around 0 18.6%
*-commutative18.6%
Simplified18.6%
if -1.19999999999999996e-20 < m < 2.2999999999999998e34Initial program 94.1%
associate-/l*94.0%
remove-double-neg94.0%
distribute-frac-neg294.0%
distribute-neg-frac294.0%
remove-double-neg94.0%
sqr-neg94.0%
associate-+l+94.0%
sqr-neg94.0%
distribute-rgt-out94.0%
Simplified94.0%
Taylor expanded in m around 0 83.2%
Taylor expanded in k around 0 42.8%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification28.6%
(FPCore (a k m) :precision binary64 (if (<= m 2.3e+34) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.3e+34) {
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 <= 2.3d+34) 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 <= 2.3e+34) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.3e+34: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.3e+34) 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 <= 2.3e+34) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.3e+34], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.3 \cdot 10^{+34}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 2.2999999999999998e34Initial program 96.2%
associate-/l*96.2%
remove-double-neg96.2%
distribute-frac-neg296.2%
distribute-neg-frac296.2%
remove-double-neg96.2%
sqr-neg96.2%
associate-+l+96.2%
sqr-neg96.2%
distribute-rgt-out96.2%
Simplified96.2%
Taylor expanded in m around 0 62.8%
Taylor expanded in k around 0 23.6%
if 2.2999999999999998e34 < m Initial program 74.6%
associate-/l*74.6%
remove-double-neg74.6%
distribute-frac-neg274.6%
distribute-neg-frac274.6%
remove-double-neg74.6%
sqr-neg74.6%
associate-+l+74.6%
sqr-neg74.6%
distribute-rgt-out74.6%
Simplified74.6%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 11.3%
Taylor expanded in k around inf 22.5%
Final simplification23.4%
(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 90.9%
associate-/l*90.9%
remove-double-neg90.9%
distribute-frac-neg290.9%
distribute-neg-frac290.9%
remove-double-neg90.9%
sqr-neg90.9%
associate-+l+90.9%
sqr-neg90.9%
distribute-rgt-out90.9%
Simplified90.9%
Taylor expanded in m around 0 48.1%
Taylor expanded in k around 0 18.8%
Final simplification18.8%
herbie shell --seed 2024039
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))