
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+189) t_1 t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+189) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = a * (k ** m)
t_1 = t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))
if (t_1 <= 2d+189) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k));
double tmp;
if (t_1 <= 2e+189) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)) tmp = 0 if t_1 <= 2e+189: tmp = t_1 else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) t_1 = Float64(t_0 / Float64(Float64(1.0 + Float64(k * 10.0)) + Float64(k * k))) tmp = 0.0 if (t_1 <= 2e+189) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); t_1 = t_0 / ((1.0 + (k * 10.0)) + (k * k)); tmp = 0.0; if (t_1 <= 2e+189) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+189], t$95$1, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
t_1 := \frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+189}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) < 2e189Initial program 98.1%
if 2e189 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 72.5%
associate-*r/72.5%
associate-+l+72.5%
+-commutative72.5%
distribute-rgt-out72.5%
fma-def72.5%
+-commutative72.5%
Simplified72.5%
Taylor expanded in k around 0 68.6%
exp-to-pow100.0%
Simplified100.0%
Final simplification98.5%
(FPCore (a k m) :precision binary64 (if (<= m 2.45e-11) (/ (pow k m) (/ (+ 1.0 (* k (+ k 10.0))) a)) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 2.45e-11) {
tmp = pow(k, m) / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 2.45d-11) then
tmp = (k ** m) / ((1.0d0 + (k * (k + 10.0d0))) / a)
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 2.45e-11) {
tmp = Math.pow(k, m) / ((1.0 + (k * (k + 10.0))) / a);
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 2.45e-11: tmp = math.pow(k, m) / ((1.0 + (k * (k + 10.0))) / a) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 2.45e-11) tmp = Float64((k ^ m) / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / a)); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 2.45e-11) tmp = (k ^ m) / ((1.0 + (k * (k + 10.0))) / a); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 2.45e-11], N[(N[Power[k, m], $MachinePrecision] / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 2.45 \cdot 10^{-11}:\\
\;\;\;\;\frac{{k}^{m}}{\frac{1 + k \cdot \left(k + 10\right)}{a}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 2.4499999999999999e-11Initial program 97.8%
associate-*r/97.8%
associate-+l+97.8%
+-commutative97.8%
distribute-rgt-out97.8%
fma-def97.8%
+-commutative97.8%
Simplified97.8%
Taylor expanded in a around 0 78.4%
exp-to-pow97.8%
+-commutative97.8%
fma-udef97.8%
associate-/l*97.7%
Simplified97.7%
Taylor expanded in a around 0 97.7%
if 2.4499999999999999e-11 < m Initial program 82.7%
associate-*r/82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-out82.7%
fma-def82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in k around 0 53.1%
exp-to-pow100.0%
Simplified100.0%
Final simplification98.4%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.5e-13) (not (<= m 8.7e-17))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.5e-13) || !(m <= 8.7e-17)) {
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 <= (-3.5d-13)) .or. (.not. (m <= 8.7d-17))) 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 <= -3.5e-13) || !(m <= 8.7e-17)) {
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 <= -3.5e-13) or not (m <= 8.7e-17): 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 <= -3.5e-13) || !(m <= 8.7e-17)) 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 <= -3.5e-13) || ~((m <= 8.7e-17))) 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, -3.5e-13], N[Not[LessEqual[m, 8.7e-17]], $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 -3.5 \cdot 10^{-13} \lor \neg \left(m \leq 8.7 \cdot 10^{-17}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.5000000000000002e-13 or 8.69999999999999962e-17 < m Initial program 91.0%
associate-*r/91.0%
associate-+l+91.0%
+-commutative91.0%
distribute-rgt-out91.0%
fma-def91.0%
+-commutative91.0%
Simplified91.0%
Taylor expanded in k around 0 53.8%
exp-to-pow100.0%
Simplified100.0%
if -3.5000000000000002e-13 < m < 8.69999999999999962e-17Initial program 96.1%
associate-*r/96.1%
associate-+l+96.1%
+-commutative96.1%
distribute-rgt-out96.1%
fma-def96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 96.1%
Final simplification98.5%
(FPCore (a k m)
:precision binary64
(if (<= m -0.19)
(/ a (* k k))
(if (<= m 2.4e-11)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+
a
(/ (* (* a k) (- 100.0 (* (* k k) 10000.0))) (+ -10.0 (* k -100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.19) {
tmp = a / (k * k);
} else if (m <= 2.4e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (((a * k) * (100.0 - ((k * k) * 10000.0))) / (-10.0 + (k * -100.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.19d0)) then
tmp = a / (k * k)
else if (m <= 2.4d-11) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (((a * k) * (100.0d0 - ((k * k) * 10000.0d0))) / ((-10.0d0) + (k * (-100.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.19) {
tmp = a / (k * k);
} else if (m <= 2.4e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (((a * k) * (100.0 - ((k * k) * 10000.0))) / (-10.0 + (k * -100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.19: tmp = a / (k * k) elif m <= 2.4e-11: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (((a * k) * (100.0 - ((k * k) * 10000.0))) / (-10.0 + (k * -100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.19) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.4e-11) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(Float64(Float64(a * k) * Float64(100.0 - Float64(Float64(k * k) * 10000.0))) / Float64(-10.0 + Float64(k * -100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.19) tmp = a / (k * k); elseif (m <= 2.4e-11) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (((a * k) * (100.0 - ((k * k) * 10000.0))) / (-10.0 + (k * -100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.19], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.4e-11], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(N[(a * k), $MachinePrecision] * N[(100.0 - N[(N[(k * k), $MachinePrecision] * 10000.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-10.0 + N[(k * -100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.19:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.4 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + \frac{\left(a \cdot k\right) \cdot \left(100 - \left(k \cdot k\right) \cdot 10000\right)}{-10 + k \cdot -100}\\
\end{array}
\end{array}
if m < -0.19Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 55.3%
unpow255.3%
Simplified55.3%
if -0.19 < m < 2.4000000000000001e-11Initial program 96.2%
associate-*r/96.1%
associate-+l+96.1%
+-commutative96.1%
distribute-rgt-out96.1%
fma-def96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 95.8%
if 2.4000000000000001e-11 < m Initial program 82.7%
associate-*r/82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-out82.7%
fma-def82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in m around 0 4.0%
Taylor expanded in k around 0 3.8%
Taylor expanded in k around 0 27.1%
associate-*r*27.1%
unpow227.1%
associate-*r*27.1%
*-commutative27.1%
distribute-rgt-out30.8%
*-commutative30.8%
associate-*l*30.8%
distribute-lft-out30.8%
Simplified30.8%
associate-*r*26.2%
flip-+30.8%
associate-*r/31.9%
metadata-eval31.9%
swap-sqr31.9%
metadata-eval31.9%
*-commutative31.9%
cancel-sign-sub-inv31.9%
metadata-eval31.9%
Applied egg-rr31.9%
Final simplification63.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.182) (/ a (* k k)) (if (<= m 2.45e-11) (/ a (+ 1.0 (* k k))) (+ a (* 100.0 (* k (* a k)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.182) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (100.0 * (k * (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.182d0)) then
tmp = a / (k * k)
else if (m <= 2.45d-11) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (100.0d0 * (k * (a * k)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.182) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (100.0 * (k * (a * k)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.182: tmp = a / (k * k) elif m <= 2.45e-11: tmp = a / (1.0 + (k * k)) else: tmp = a + (100.0 * (k * (a * k))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.182) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.45e-11) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(100.0 * Float64(k * Float64(a * k)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.182) tmp = a / (k * k); elseif (m <= 2.45e-11) tmp = a / (1.0 + (k * k)); else tmp = a + (100.0 * (k * (a * k))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.182], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.45e-11], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(100.0 * N[(k * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.182:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.45 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + 100 \cdot \left(k \cdot \left(a \cdot k\right)\right)\\
\end{array}
\end{array}
if m < -0.182Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 55.3%
unpow255.3%
Simplified55.3%
if -0.182 < m < 2.4499999999999999e-11Initial program 96.2%
associate-*r/96.1%
associate-+l+96.1%
+-commutative96.1%
distribute-rgt-out96.1%
fma-def96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 95.8%
Taylor expanded in k around inf 92.8%
unpow292.8%
Simplified92.8%
if 2.4499999999999999e-11 < m Initial program 82.7%
associate-*r/82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-out82.7%
fma-def82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in m around 0 4.0%
Taylor expanded in k around 0 3.8%
Taylor expanded in k around 0 27.1%
associate-*r*27.1%
unpow227.1%
associate-*r*27.1%
*-commutative27.1%
distribute-rgt-out30.8%
*-commutative30.8%
associate-*l*30.8%
distribute-lft-out30.8%
Simplified30.8%
Taylor expanded in k around inf 30.8%
unpow230.8%
associate-*l*26.2%
*-commutative26.2%
Simplified26.2%
Final simplification60.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.175) (/ a (* k k)) (if (<= m 2.45e-11) (/ a (+ 1.0 (* k k))) (+ a (* a (* k (* k 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.175) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.175d0)) then
tmp = a / (k * k)
else if (m <= 2.45d-11) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (a * (k * (k * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.175) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.175: tmp = a / (k * k) elif m <= 2.45e-11: tmp = a / (1.0 + (k * k)) else: tmp = a + (a * (k * (k * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.175) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.45e-11) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.175) tmp = a / (k * k); elseif (m <= 2.45e-11) tmp = a / (1.0 + (k * k)); else tmp = a + (a * (k * (k * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.175], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.45e-11], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.175:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.45 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -0.17499999999999999Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 55.3%
unpow255.3%
Simplified55.3%
if -0.17499999999999999 < m < 2.4499999999999999e-11Initial program 96.2%
associate-*r/96.1%
associate-+l+96.1%
+-commutative96.1%
distribute-rgt-out96.1%
fma-def96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 95.8%
Taylor expanded in k around inf 92.8%
unpow292.8%
Simplified92.8%
if 2.4499999999999999e-11 < m Initial program 82.7%
associate-*r/82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-out82.7%
fma-def82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in m around 0 4.0%
Taylor expanded in k around 0 3.8%
Taylor expanded in k around 0 27.1%
associate-*r*27.1%
unpow227.1%
associate-*r*27.1%
*-commutative27.1%
distribute-rgt-out30.8%
*-commutative30.8%
associate-*l*30.8%
distribute-lft-out30.8%
Simplified30.8%
Taylor expanded in k around inf 30.8%
unpow230.8%
associate-*r*30.8%
*-commutative30.8%
associate-*r*30.8%
*-commutative30.8%
Simplified30.8%
Final simplification62.3%
(FPCore (a k m)
:precision binary64
(if (<= m -0.25)
(/ a (* k k))
(if (<= m 2.45e-11)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (* k (* k 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.25) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.25d0)) then
tmp = a / (k * k)
else if (m <= 2.45d-11) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * (k * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.25) {
tmp = a / (k * k);
} else if (m <= 2.45e-11) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * (k * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.25: tmp = a / (k * k) elif m <= 2.45e-11: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * (k * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.25) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.45e-11) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(k * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.25) tmp = a / (k * k); elseif (m <= 2.45e-11) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * (k * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.25], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.45e-11], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.25:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.45 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -0.25Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 55.3%
unpow255.3%
Simplified55.3%
if -0.25 < m < 2.4499999999999999e-11Initial program 96.2%
associate-*r/96.1%
associate-+l+96.1%
+-commutative96.1%
distribute-rgt-out96.1%
fma-def96.1%
+-commutative96.1%
Simplified96.1%
Taylor expanded in m around 0 95.8%
if 2.4499999999999999e-11 < m Initial program 82.7%
associate-*r/82.7%
associate-+l+82.7%
+-commutative82.7%
distribute-rgt-out82.7%
fma-def82.7%
+-commutative82.7%
Simplified82.7%
Taylor expanded in m around 0 4.0%
Taylor expanded in k around 0 3.8%
Taylor expanded in k around 0 27.1%
associate-*r*27.1%
unpow227.1%
associate-*r*27.1%
*-commutative27.1%
distribute-rgt-out30.8%
*-commutative30.8%
associate-*l*30.8%
distribute-lft-out30.8%
Simplified30.8%
Taylor expanded in k around inf 30.8%
unpow230.8%
associate-*r*30.8%
*-commutative30.8%
associate-*r*30.8%
*-commutative30.8%
Simplified30.8%
Final simplification63.5%
(FPCore (a k m) :precision binary64 (if (<= k -1.7e-284) (/ a (* k k)) (if (<= k 0.1) (* a (+ 1.0 (* k -10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= -1.7e-284) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a * (1.0 + (k * -10.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.7d-284)) then
tmp = a / (k * k)
else if (k <= 0.1d0) then
tmp = a * (1.0d0 + (k * (-10.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.7e-284) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -1.7e-284: tmp = a / (k * k) elif k <= 0.1: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= -1.7e-284) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.1) tmp = Float64(a * Float64(1.0 + Float64(k * -10.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.7e-284) tmp = a / (k * k); elseif (k <= 0.1) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -1.7e-284], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.7 \cdot 10^{-284}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -1.69999999999999996e-284Initial program 95.7%
associate-*r/95.7%
associate-+l+95.7%
+-commutative95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 20.4%
Taylor expanded in k around inf 28.1%
unpow228.1%
Simplified28.1%
if -1.69999999999999996e-284 < k < 0.10000000000000001Initial program 99.9%
associate-*r/99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 52.8%
Taylor expanded in k around 0 51.9%
*-commutative51.9%
Simplified51.9%
if 0.10000000000000001 < k Initial program 80.0%
associate-*r/79.9%
associate-+l+79.9%
+-commutative79.9%
distribute-rgt-out79.9%
fma-def79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in m around 0 67.3%
Taylor expanded in k around inf 66.2%
unpow266.2%
Simplified66.2%
associate-/r*66.3%
associate-*r/70.1%
div-inv70.1%
Applied egg-rr70.1%
Final simplification50.7%
(FPCore (a k m) :precision binary64 (if (<= k -1.7e-284) (/ a (* k k)) (if (<= k 10.2) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= -1.7e-284) {
tmp = a / (k * k);
} else if (k <= 10.2) {
tmp = a / (1.0 + (k * 10.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.7d-284)) then
tmp = a / (k * k)
else if (k <= 10.2d0) then
tmp = a / (1.0d0 + (k * 10.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.7e-284) {
tmp = a / (k * k);
} else if (k <= 10.2) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -1.7e-284: tmp = a / (k * k) elif k <= 10.2: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= -1.7e-284) tmp = Float64(a / Float64(k * k)); elseif (k <= 10.2) tmp = Float64(a / Float64(1.0 + Float64(k * 10.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.7e-284) tmp = a / (k * k); elseif (k <= 10.2) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -1.7e-284], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 10.2], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.7 \cdot 10^{-284}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 10.2:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -1.69999999999999996e-284Initial program 95.7%
associate-*r/95.7%
associate-+l+95.7%
+-commutative95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 20.4%
Taylor expanded in k around inf 28.1%
unpow228.1%
Simplified28.1%
if -1.69999999999999996e-284 < k < 10.199999999999999Initial program 99.9%
associate-*r/99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 52.8%
Taylor expanded in k around 0 52.1%
if 10.199999999999999 < k Initial program 80.0%
associate-*r/79.9%
associate-+l+79.9%
+-commutative79.9%
distribute-rgt-out79.9%
fma-def79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in m around 0 67.3%
Taylor expanded in k around inf 66.2%
unpow266.2%
Simplified66.2%
associate-/r*66.3%
associate-*r/70.1%
div-inv70.1%
Applied egg-rr70.1%
Final simplification50.7%
(FPCore (a k m) :precision binary64 (if (or (<= k -1.7e-284) (not (<= k 1.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -1.7e-284) || !(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.7d-284)) .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.7e-284) || !(k <= 1.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -1.7e-284) 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.7e-284) || !(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.7e-284) || ~((k <= 1.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -1.7e-284], 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.7 \cdot 10^{-284} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -1.69999999999999996e-284 or 1 < k Initial program 87.6%
associate-*r/87.6%
associate-+l+87.6%
+-commutative87.6%
distribute-rgt-out87.6%
fma-def87.6%
+-commutative87.6%
Simplified87.6%
Taylor expanded in m around 0 44.5%
Taylor expanded in k around inf 47.7%
unpow247.7%
Simplified47.7%
if -1.69999999999999996e-284 < k < 1Initial program 99.9%
associate-*r/99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 52.8%
Taylor expanded in k around 0 50.7%
Final simplification49.0%
(FPCore (a k m) :precision binary64 (if (<= k -1.7e-284) (/ a (* k k)) (if (<= k 1.0) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= -1.7e-284) {
tmp = a / (k * k);
} else if (k <= 1.0) {
tmp = a;
} 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.7d-284)) then
tmp = a / (k * k)
else if (k <= 1.0d0) then
tmp = a
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.7e-284) {
tmp = a / (k * k);
} else if (k <= 1.0) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -1.7e-284: tmp = a / (k * k) elif k <= 1.0: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= -1.7e-284) tmp = Float64(a / Float64(k * k)); elseif (k <= 1.0) tmp = a; else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -1.7e-284) tmp = a / (k * k); elseif (k <= 1.0) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -1.7e-284], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1.0], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -1.7 \cdot 10^{-284}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < -1.69999999999999996e-284Initial program 95.7%
associate-*r/95.7%
associate-+l+95.7%
+-commutative95.7%
distribute-rgt-out95.7%
fma-def95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in m around 0 20.4%
Taylor expanded in k around inf 28.1%
unpow228.1%
Simplified28.1%
if -1.69999999999999996e-284 < k < 1Initial program 99.9%
associate-*r/99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in m around 0 52.8%
Taylor expanded in k around 0 50.7%
if 1 < k Initial program 80.0%
associate-*r/79.9%
associate-+l+79.9%
+-commutative79.9%
distribute-rgt-out79.9%
fma-def79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in m around 0 67.3%
Taylor expanded in k around inf 66.2%
unpow266.2%
Simplified66.2%
associate-/r*66.3%
associate-*r/70.1%
div-inv70.1%
Applied egg-rr70.1%
Final simplification50.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.076) (/ a (* k k)) (/ a (+ 1.0 (* k k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.076) {
tmp = a / (k * k);
} else {
tmp = a / (1.0 + (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 (m <= (-0.076d0)) then
tmp = a / (k * k)
else
tmp = a / (1.0d0 + (k * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.076) {
tmp = a / (k * k);
} else {
tmp = a / (1.0 + (k * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.076: tmp = a / (k * k) else: tmp = a / (1.0 + (k * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.076) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a / Float64(1.0 + Float64(k * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.076) tmp = a / (k * k); else tmp = a / (1.0 + (k * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.076], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.076:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\end{array}
\end{array}
if m < -0.0759999999999999981Initial program 100.0%
associate-*r/100.0%
associate-+l+100.0%
+-commutative100.0%
distribute-rgt-out100.0%
fma-def100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in m around 0 31.2%
Taylor expanded in k around inf 55.3%
unpow255.3%
Simplified55.3%
if -0.0759999999999999981 < m Initial program 90.2%
associate-*r/90.2%
associate-+l+90.2%
+-commutative90.2%
distribute-rgt-out90.2%
fma-def90.2%
+-commutative90.2%
Simplified90.2%
Taylor expanded in m around 0 55.0%
Taylor expanded in k around inf 53.3%
unpow253.3%
Simplified53.3%
Final simplification53.9%
(FPCore (a k m) :precision binary64 (if (<= k 0.1) a (* (/ a k) 0.1)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 0.1d0) then
tmp = a
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.1) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.1: tmp = a else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.1) tmp = a; else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.1) tmp = a; else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.1], a, N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < 0.10000000000000001Initial program 98.3%
associate-*r/98.3%
associate-+l+98.3%
+-commutative98.3%
distribute-rgt-out98.3%
fma-def98.3%
+-commutative98.3%
Simplified98.3%
Taylor expanded in m around 0 40.3%
Taylor expanded in k around 0 32.8%
if 0.10000000000000001 < k Initial program 80.0%
associate-*r/79.9%
associate-+l+79.9%
+-commutative79.9%
distribute-rgt-out79.9%
fma-def79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in m around 0 67.3%
Taylor expanded in k around 0 26.9%
Taylor expanded in k around inf 26.9%
Final simplification31.1%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 93.0%
associate-*r/93.0%
associate-+l+93.0%
+-commutative93.0%
distribute-rgt-out93.0%
fma-def93.0%
+-commutative93.0%
Simplified93.0%
Taylor expanded in m around 0 48.1%
Taylor expanded in k around 0 24.6%
Final simplification24.6%
herbie shell --seed 2023187
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))