
(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 13 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))) 5e+44)
(* a (/ (pow k m) (fma 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 / ((1.0 + (k * 10.0)) + (k * k))) <= 5e+44) {
tmp = a * (pow(k, m) / fma(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(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 5e+44) tmp = Float64(a * Float64((k ^ m) / fma(k, Float64(k + 10.0), 1.0))); else tmp = t_0; end return 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], 5e+44], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(k * N[(k + 10.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 5 \cdot 10^{+44}:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{\mathsf{fma}\left(k, k + 10, 1\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))) < 4.9999999999999996e44Initial program 97.1%
associate-*r/97.1%
associate-+l+97.1%
+-commutative97.1%
distribute-rgt-out97.1%
fma-def97.1%
+-commutative97.1%
Simplified97.1%
if 4.9999999999999996e44 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 71.0%
associate-*r/71.0%
associate-+l+71.0%
+-commutative71.0%
distribute-rgt-out71.0%
fma-def71.0%
+-commutative71.0%
Simplified71.0%
Taylor expanded in k around 0 69.4%
exp-to-pow100.0%
Simplified100.0%
Final simplification97.8%
(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 5e+44) 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 <= 5e+44) {
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 <= 5d+44) 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 <= 5e+44) {
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 <= 5e+44: 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 <= 5e+44) 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 <= 5e+44) 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, 5e+44], 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 5 \cdot 10^{+44}:\\
\;\;\;\;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))) < 4.9999999999999996e44Initial program 97.1%
if 4.9999999999999996e44 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 71.0%
associate-*r/71.0%
associate-+l+71.0%
+-commutative71.0%
distribute-rgt-out71.0%
fma-def71.0%
+-commutative71.0%
Simplified71.0%
Taylor expanded in k around 0 69.4%
exp-to-pow100.0%
Simplified100.0%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -8.6e-17) (not (<= m 1.6e-23))) (* 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 <= -8.6e-17) || !(m <= 1.6e-23)) {
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 <= (-8.6d-17)) .or. (.not. (m <= 1.6d-23))) 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 <= -8.6e-17) || !(m <= 1.6e-23)) {
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 <= -8.6e-17) or not (m <= 1.6e-23): 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 <= -8.6e-17) || !(m <= 1.6e-23)) 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 <= -8.6e-17) || ~((m <= 1.6e-23))) 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, -8.6e-17], N[Not[LessEqual[m, 1.6e-23]], $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 -8.6 \cdot 10^{-17} \lor \neg \left(m \leq 1.6 \cdot 10^{-23}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -8.60000000000000046e-17 or 1.59999999999999988e-23 < m Initial program 89.4%
associate-*r/89.4%
associate-+l+89.4%
+-commutative89.4%
distribute-rgt-out89.4%
fma-def89.4%
+-commutative89.4%
Simplified89.4%
Taylor expanded in k around 0 61.2%
exp-to-pow100.0%
Simplified100.0%
if -8.60000000000000046e-17 < m < 1.59999999999999988e-23Initial program 93.4%
associate-*r/93.4%
associate-+l+93.4%
+-commutative93.4%
distribute-rgt-out93.4%
fma-def93.4%
+-commutative93.4%
Simplified93.4%
Taylor expanded in m around 0 93.4%
Final simplification97.8%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= k -9.2e-231)
t_0
(if (<= k 9.8e-262)
(/ 1.0 (/ 1.0 a))
(if (<= k 9.5e-249) t_0 (if (<= k 3.75e-6) a (* a (/ 1.0 (* k k)))))))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= -9.2e-231) {
tmp = t_0;
} else if (k <= 9.8e-262) {
tmp = 1.0 / (1.0 / a);
} else if (k <= 9.5e-249) {
tmp = t_0;
} else if (k <= 3.75e-6) {
tmp = a;
} 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) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (k <= (-9.2d-231)) then
tmp = t_0
else if (k <= 9.8d-262) then
tmp = 1.0d0 / (1.0d0 / a)
else if (k <= 9.5d-249) then
tmp = t_0
else if (k <= 3.75d-6) then
tmp = a
else
tmp = a * (1.0d0 / (k * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= -9.2e-231) {
tmp = t_0;
} else if (k <= 9.8e-262) {
tmp = 1.0 / (1.0 / a);
} else if (k <= 9.5e-249) {
tmp = t_0;
} else if (k <= 3.75e-6) {
tmp = a;
} else {
tmp = a * (1.0 / (k * k));
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= -9.2e-231: tmp = t_0 elif k <= 9.8e-262: tmp = 1.0 / (1.0 / a) elif k <= 9.5e-249: tmp = t_0 elif k <= 3.75e-6: tmp = a else: tmp = a * (1.0 / (k * k)) return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= -9.2e-231) tmp = t_0; elseif (k <= 9.8e-262) tmp = Float64(1.0 / Float64(1.0 / a)); elseif (k <= 9.5e-249) tmp = t_0; elseif (k <= 3.75e-6) tmp = a; else tmp = Float64(a * Float64(1.0 / Float64(k * k))); end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (k <= -9.2e-231) tmp = t_0; elseif (k <= 9.8e-262) tmp = 1.0 / (1.0 / a); elseif (k <= 9.5e-249) tmp = t_0; elseif (k <= 3.75e-6) tmp = a; else tmp = a * (1.0 / (k * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -9.2e-231], t$95$0, If[LessEqual[k, 9.8e-262], N[(1.0 / N[(1.0 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 9.5e-249], t$95$0, If[LessEqual[k, 3.75e-6], a, N[(a * N[(1.0 / N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq -9.2 \cdot 10^{-231}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 9.8 \cdot 10^{-262}:\\
\;\;\;\;\frac{1}{\frac{1}{a}}\\
\mathbf{elif}\;k \leq 9.5 \cdot 10^{-249}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 3.75 \cdot 10^{-6}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{k \cdot k}\\
\end{array}
\end{array}
if k < -9.2e-231 or 9.8000000000000005e-262 < k < 9.4999999999999997e-249Initial 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 m around 0 23.6%
Taylor expanded in k around inf 33.4%
unpow233.4%
Simplified33.4%
if -9.2e-231 < k < 9.8000000000000005e-262Initial 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 36.4%
div-inv36.4%
clear-num40.0%
+-commutative40.0%
fma-udef40.0%
div-inv40.0%
fma-udef40.0%
+-commutative40.0%
associate-/r*40.0%
+-commutative40.0%
fma-udef40.0%
Applied egg-rr40.0%
Taylor expanded in k around 0 40.0%
if 9.4999999999999997e-249 < k < 3.7500000000000001e-6Initial 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 58.4%
Taylor expanded in k around 0 58.4%
if 3.7500000000000001e-6 < k Initial program 81.6%
associate-*r/81.6%
associate-+l+81.6%
+-commutative81.6%
distribute-rgt-out81.6%
fma-def81.6%
+-commutative81.6%
Simplified81.6%
Taylor expanded in m around 0 58.5%
Taylor expanded in k around inf 56.7%
unpow256.7%
Simplified56.7%
Final simplification49.7%
(FPCore (a k m) :precision binary64 (if (<= m -0.26) (/ a (* k k)) (if (<= m 1.2) (* a (/ 1.0 (+ 1.0 (* k (+ k 10.0))))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.26) {
tmp = a / (k * k);
} else if (m <= 1.2) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.26d0)) then
tmp = a / (k * k)
else if (m <= 1.2d0) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.26) {
tmp = a / (k * k);
} else if (m <= 1.2) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.26: tmp = a / (k * k) elif m <= 1.2: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.26) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.2) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.26) tmp = a / (k * k); elseif (m <= 1.2) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.26], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.2], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.26:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.2:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.26000000000000001Initial 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 40.1%
Taylor expanded in k around inf 63.4%
unpow263.4%
Simplified63.4%
if -0.26000000000000001 < m < 1.19999999999999996Initial program 93.9%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in m around 0 93.0%
if 1.19999999999999996 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification60.1%
(FPCore (a k m)
:precision binary64
(if (<= m -0.58)
(/ a (* k k))
(if (<= m 1.6e-23)
(* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))
(+ a (* a (* k (+ -10.0 (* k 100.0))))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.58) {
tmp = a / (k * k);
} else if (m <= 1.6e-23) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (-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.58d0)) then
tmp = a / (k * k)
else if (m <= 1.6d-23) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a + (a * (k * ((-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.58) {
tmp = a / (k * k);
} else if (m <= 1.6e-23) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else {
tmp = a + (a * (k * (-10.0 + (k * 100.0))));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.58: tmp = a / (k * k) elif m <= 1.6e-23: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) else: tmp = a + (a * (k * (-10.0 + (k * 100.0)))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.58) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.6e-23) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a + Float64(a * Float64(k * Float64(-10.0 + Float64(k * 100.0))))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.58) tmp = a / (k * k); elseif (m <= 1.6e-23) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); else tmp = a + (a * (k * (-10.0 + (k * 100.0)))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.58], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.6e-23], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(-10.0 + N[(k * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.58:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.6 \cdot 10^{-23}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(-10 + k \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -0.57999999999999996Initial 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 40.1%
Taylor expanded in k around inf 63.4%
unpow263.4%
Simplified63.4%
if -0.57999999999999996 < m < 1.59999999999999988e-23Initial program 93.5%
associate-*r/93.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
+-commutative93.6%
Simplified93.6%
Taylor expanded in m around 0 93.5%
if 1.59999999999999988e-23 < m Initial program 79.8%
associate-*r/79.8%
associate-+l+79.8%
+-commutative79.8%
distribute-rgt-out79.8%
fma-def79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in m around 0 8.8%
Taylor expanded in k around 0 8.5%
*-commutative8.5%
Simplified8.5%
Taylor expanded in k around 0 25.8%
associate-*r*25.8%
unpow225.8%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out32.5%
*-commutative32.5%
associate-*l*32.5%
distribute-lft-out32.5%
Simplified32.5%
Final simplification63.0%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (/ a (* k k))))
(if (<= k -9.2e-231)
t_0
(if (<= k 3.9e-261)
(/ 1.0 (/ 1.0 a))
(if (or (<= k 1.1e-248) (not (<= k 3.75e-6))) t_0 a)))))
double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= -9.2e-231) {
tmp = t_0;
} else if (k <= 3.9e-261) {
tmp = 1.0 / (1.0 / a);
} else if ((k <= 1.1e-248) || !(k <= 3.75e-6)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = a / (k * k)
if (k <= (-9.2d-231)) then
tmp = t_0
else if (k <= 3.9d-261) then
tmp = 1.0d0 / (1.0d0 / a)
else if ((k <= 1.1d-248) .or. (.not. (k <= 3.75d-6))) then
tmp = t_0
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a / (k * k);
double tmp;
if (k <= -9.2e-231) {
tmp = t_0;
} else if (k <= 3.9e-261) {
tmp = 1.0 / (1.0 / a);
} else if ((k <= 1.1e-248) || !(k <= 3.75e-6)) {
tmp = t_0;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): t_0 = a / (k * k) tmp = 0 if k <= -9.2e-231: tmp = t_0 elif k <= 3.9e-261: tmp = 1.0 / (1.0 / a) elif (k <= 1.1e-248) or not (k <= 3.75e-6): tmp = t_0 else: tmp = a return tmp
function code(a, k, m) t_0 = Float64(a / Float64(k * k)) tmp = 0.0 if (k <= -9.2e-231) tmp = t_0; elseif (k <= 3.9e-261) tmp = Float64(1.0 / Float64(1.0 / a)); elseif ((k <= 1.1e-248) || !(k <= 3.75e-6)) tmp = t_0; else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a / (k * k); tmp = 0.0; if (k <= -9.2e-231) tmp = t_0; elseif (k <= 3.9e-261) tmp = 1.0 / (1.0 / a); elseif ((k <= 1.1e-248) || ~((k <= 3.75e-6))) tmp = t_0; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -9.2e-231], t$95$0, If[LessEqual[k, 3.9e-261], N[(1.0 / N[(1.0 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[k, 1.1e-248], N[Not[LessEqual[k, 3.75e-6]], $MachinePrecision]], t$95$0, a]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{a}{k \cdot k}\\
\mathbf{if}\;k \leq -9.2 \cdot 10^{-231}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 3.9 \cdot 10^{-261}:\\
\;\;\;\;\frac{1}{\frac{1}{a}}\\
\mathbf{elif}\;k \leq 1.1 \cdot 10^{-248} \lor \neg \left(k \leq 3.75 \cdot 10^{-6}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -9.2e-231 or 3.90000000000000017e-261 < k < 1.1e-248 or 3.7500000000000001e-6 < k Initial program 85.5%
associate-*r/85.5%
associate-+l+85.5%
+-commutative85.5%
distribute-rgt-out85.5%
fma-def85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in m around 0 44.2%
Taylor expanded in k around inf 47.1%
unpow247.1%
Simplified47.1%
if -9.2e-231 < k < 3.90000000000000017e-261Initial 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 36.4%
div-inv36.4%
clear-num40.0%
+-commutative40.0%
fma-udef40.0%
div-inv40.0%
fma-udef40.0%
+-commutative40.0%
associate-/r*40.0%
+-commutative40.0%
fma-udef40.0%
Applied egg-rr40.0%
Taylor expanded in k around 0 40.0%
if 1.1e-248 < k < 3.7500000000000001e-6Initial 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 58.4%
Taylor expanded in k around 0 58.4%
Final simplification49.7%
(FPCore (a k m) :precision binary64 (if (<= m -0.24) (/ a (* k k)) (if (<= m 0.31) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.24) {
tmp = a / (k * k);
} else if (m <= 0.31) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.24d0)) then
tmp = a / (k * k)
else if (m <= 0.31d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.24) {
tmp = a / (k * k);
} else if (m <= 0.31) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.24: tmp = a / (k * k) elif m <= 0.31: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.24) tmp = Float64(a / Float64(k * k)); elseif (m <= 0.31) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.24) tmp = a / (k * k); elseif (m <= 0.31) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.24], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.31], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.24:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 0.31:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.23999999999999999Initial 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 40.1%
Taylor expanded in k around inf 63.4%
unpow263.4%
Simplified63.4%
if -0.23999999999999999 < m < 0.309999999999999998Initial program 93.9%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in m around 0 93.0%
if 0.309999999999999998 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification60.1%
(FPCore (a k m) :precision binary64 (if (<= m -0.116) (/ a (* k k)) (if (<= m 1.65) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.116) {
tmp = a / (k * k);
} else if (m <= 1.65) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-0.116d0)) then
tmp = a / (k * k)
else if (m <= 1.65d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -0.116) {
tmp = a / (k * k);
} else if (m <= 1.65) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.116: tmp = a / (k * k) elif m <= 1.65: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.116) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.65) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -0.116) tmp = a / (k * k); elseif (m <= 1.65) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.116], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.65], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.116:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.65:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.116000000000000006Initial 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 40.1%
Taylor expanded in k around inf 63.4%
unpow263.4%
Simplified63.4%
if -0.116000000000000006 < m < 1.6499999999999999Initial program 93.9%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in m around 0 93.0%
Taylor expanded in k around 0 68.8%
*-commutative68.8%
Simplified68.8%
if 1.6499999999999999 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification51.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.21) (/ a (* k k)) (if (<= m 1.3) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.21) {
tmp = a / (k * k);
} else if (m <= 1.3) {
tmp = a / (1.0 + (k * k));
} 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.21d0)) then
tmp = a / (k * k)
else if (m <= 1.3d0) then
tmp = a / (1.0d0 + (k * k))
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.21) {
tmp = a / (k * k);
} else if (m <= 1.3) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.21: tmp = a / (k * k) elif m <= 1.3: tmp = a / (1.0 + (k * k)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -0.21) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.3) tmp = Float64(a / Float64(1.0 + Float64(k * k))); 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.21) tmp = a / (k * k); elseif (m <= 1.3) tmp = a / (1.0 + (k * k)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -0.21], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.3], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.21:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.3:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.209999999999999992Initial 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 40.1%
Taylor expanded in k around inf 63.4%
unpow263.4%
Simplified63.4%
if -0.209999999999999992 < m < 1.30000000000000004Initial program 93.9%
associate-*r/94.0%
associate-+l+94.0%
+-commutative94.0%
distribute-rgt-out94.0%
fma-def94.0%
+-commutative94.0%
Simplified94.0%
Taylor expanded in m around 0 93.0%
Taylor expanded in k around inf 91.1%
unpow291.1%
Simplified91.1%
if 1.30000000000000004 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification59.4%
(FPCore (a k m) :precision binary64 (if (<= m -8.5e-21) (* 0.1 (/ a k)) (if (<= m 0.27) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -8.5e-21) {
tmp = 0.1 * (a / k);
} else if (m <= 0.27) {
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 <= (-8.5d-21)) then
tmp = 0.1d0 * (a / k)
else if (m <= 0.27d0) 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 <= -8.5e-21) {
tmp = 0.1 * (a / k);
} else if (m <= 0.27) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -8.5e-21: tmp = 0.1 * (a / k) elif m <= 0.27: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -8.5e-21) tmp = Float64(0.1 * Float64(a / k)); elseif (m <= 0.27) 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 <= -8.5e-21) tmp = 0.1 * (a / k); elseif (m <= 0.27) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -8.5e-21], N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.27], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.5 \cdot 10^{-21}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 0.27:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -8.4999999999999993e-21Initial 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 42.2%
Taylor expanded in k around 0 20.7%
*-commutative20.7%
Simplified20.7%
Taylor expanded in k around inf 24.3%
if -8.4999999999999993e-21 < m < 0.27000000000000002Initial program 93.7%
associate-*r/93.8%
associate-+l+93.8%
+-commutative93.8%
distribute-rgt-out93.8%
fma-def93.8%
+-commutative93.8%
Simplified93.8%
Taylor expanded in m around 0 92.8%
Taylor expanded in k around 0 55.4%
if 0.27000000000000002 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification33.9%
(FPCore (a k m) :precision binary64 (if (<= m 0.44) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 0.44) {
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 <= 0.44d0) 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 <= 0.44) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 0.44: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 0.44) 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 <= 0.44) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 0.44], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 0.44:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 0.440000000000000002Initial program 96.7%
associate-*r/96.7%
associate-+l+96.7%
+-commutative96.7%
distribute-rgt-out96.7%
fma-def96.7%
+-commutative96.7%
Simplified96.7%
Taylor expanded in m around 0 68.8%
Taylor expanded in k around 0 31.3%
if 0.440000000000000002 < m Initial program 78.3%
associate-*r/78.3%
associate-+l+78.3%
+-commutative78.3%
distribute-rgt-out78.3%
fma-def78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 5.4%
*-commutative5.4%
Simplified5.4%
Taylor expanded in k around inf 19.8%
Final simplification27.6%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 90.7%
associate-*r/90.8%
associate-+l+90.8%
+-commutative90.8%
distribute-rgt-out90.8%
fma-def90.8%
+-commutative90.8%
Simplified90.8%
Taylor expanded in m around 0 47.5%
Taylor expanded in k around 0 22.4%
Final simplification22.4%
herbie shell --seed 2023257
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))