
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a k m) :precision binary64 (/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))
double code(double a, double k, double m) {
return (a * pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = (a * (k ** m)) / ((1.0d0 + (10.0d0 * k)) + (k * k))
end function
public static double code(double a, double k, double m) {
return (a * Math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k));
}
def code(a, k, m): return (a * math.pow(k, m)) / ((1.0 + (10.0 * k)) + (k * k))
function code(a, k, m) return Float64(Float64(a * (k ^ m)) / Float64(Float64(1.0 + Float64(10.0 * k)) + Float64(k * k))) end
function tmp = code(a, k, m) tmp = (a * (k ^ m)) / ((1.0 + (10.0 * k)) + (k * k)); end
code[a_, k_, m_] := N[(N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 + N[(10.0 * k), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{a \cdot {k}^{m}}{\left(1 + 10 \cdot k\right) + k \cdot k}
\end{array}
(FPCore (a k m) :precision binary64 (let* ((t_0 (* a (pow k m))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 2e+162) 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+162) {
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+162) 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+162) {
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+162: 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+162) 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+162) 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+162], 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^{+162}:\\
\;\;\;\;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))) < 1.9999999999999999e162Initial program 98.6%
if 1.9999999999999999e162 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 67.9%
Taylor expanded in k around 0 100.0%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (or (<= m -5.2e-17) (not (<= m 4.8e-13))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -5.2e-17) || !(m <= 4.8e-13)) {
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 <= (-5.2d-17)) .or. (.not. (m <= 4.8d-13))) 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 <= -5.2e-17) || !(m <= 4.8e-13)) {
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 <= -5.2e-17) or not (m <= 4.8e-13): 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 <= -5.2e-17) || !(m <= 4.8e-13)) 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 <= -5.2e-17) || ~((m <= 4.8e-13))) 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, -5.2e-17], N[Not[LessEqual[m, 4.8e-13]], $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 -5.2 \cdot 10^{-17} \lor \neg \left(m \leq 4.8 \cdot 10^{-13}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -5.20000000000000006e-17 or 4.7999999999999997e-13 < m Initial program 89.6%
Taylor expanded in k around 0 100.0%
if -5.20000000000000006e-17 < m < 4.7999999999999997e-13Initial program 96.6%
*-commutative96.6%
add-sqr-sqrt96.6%
times-frac96.6%
associate-+l+96.6%
+-commutative96.6%
distribute-rgt-out96.6%
fma-def96.6%
associate-+l+96.6%
+-commutative96.6%
distribute-rgt-out96.6%
fma-def96.6%
Applied egg-rr96.6%
Taylor expanded in m around 0 96.6%
Final simplification98.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.94) (/ a (* k k)) (if (<= m 66000000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 66000000.0) {
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.94d0)) then
tmp = a / (k * k)
else if (m <= 66000000.0d0) 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.94) {
tmp = a / (k * k);
} else if (m <= 66000000.0) {
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.94: tmp = a / (k * k) elif m <= 66000000.0: 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.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 66000000.0) 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.94) tmp = a / (k * k); elseif (m <= 66000000.0) 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.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], 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.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 66000000:\\
\;\;\;\;\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.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 6.6e7Initial program 96.8%
*-commutative96.8%
add-sqr-sqrt96.7%
times-frac96.8%
associate-+l+96.8%
+-commutative96.8%
distribute-rgt-out96.8%
fma-def96.8%
associate-+l+96.8%
+-commutative96.8%
distribute-rgt-out96.8%
fma-def96.8%
Applied egg-rr96.8%
Taylor expanded in m around 0 93.6%
if 6.6e7 < m Initial program 79.3%
Taylor expanded in k around 0 80.5%
Taylor expanded in m around 0 48.0%
associate-*r*48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in k around inf 18.0%
Final simplification56.9%
(FPCore (a k m) :precision binary64 (if (or (<= k 5.2e-295) (not (<= k 0.23))) (/ a (* k k)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= 5.2e-295) || !(k <= 0.23)) {
tmp = a / (k * k);
} else {
tmp = a + (-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 ((k <= 5.2d-295) .or. (.not. (k <= 0.23d0))) then
tmp = a / (k * k)
else
tmp = a + ((-10.0d0) * (a * k))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 5.2e-295) || !(k <= 0.23)) {
tmp = a / (k * k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 5.2e-295) or not (k <= 0.23): tmp = a / (k * k) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 5.2e-295) || !(k <= 0.23)) tmp = Float64(a / Float64(k * k)); else tmp = Float64(a + Float64(-10.0 * Float64(a * k))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 5.2e-295) || ~((k <= 0.23))) tmp = a / (k * k); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.2e-295], N[Not[LessEqual[k, 0.23]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.2 \cdot 10^{-295} \lor \neg \left(k \leq 0.23\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if k < 5.1999999999999997e-295 or 0.23000000000000001 < k Initial program 88.1%
Taylor expanded in m around 0 38.7%
Taylor expanded in k around inf 41.5%
unpow241.5%
Simplified41.5%
if 5.1999999999999997e-295 < k < 0.23000000000000001Initial program 99.9%
Taylor expanded in m around 0 56.0%
Taylor expanded in k around 0 55.5%
Final simplification45.9%
(FPCore (a k m) :precision binary64 (if (<= k 2.55e-294) (/ a (* k k)) (if (<= k 0.075) (+ a (* -10.0 (* a k))) (/ a (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.55e-294) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 2.55d-294) then
tmp = a / (k * k)
else if (k <= 0.075d0) then
tmp = a + ((-10.0d0) * (a * k))
else
tmp = a / (k * (k + 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.55e-294) {
tmp = a / (k * k);
} else if (k <= 0.075) {
tmp = a + (-10.0 * (a * k));
} else {
tmp = a / (k * (k + 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.55e-294: tmp = a / (k * k) elif k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.55e-294) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.075) tmp = Float64(a + Float64(-10.0 * Float64(a * k))); else tmp = Float64(a / Float64(k * Float64(k + 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.55e-294) tmp = a / (k * k); elseif (k <= 0.075) tmp = a + (-10.0 * (a * k)); else tmp = a / (k * (k + 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.55e-294], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.075], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.55 \cdot 10^{-294}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.075:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if k < 2.55000000000000003e-294Initial program 89.6%
Taylor expanded in m around 0 15.4%
Taylor expanded in k around inf 22.1%
unpow222.1%
Simplified22.1%
if 2.55000000000000003e-294 < k < 0.0749999999999999972Initial program 99.9%
Taylor expanded in m around 0 56.6%
Taylor expanded in k around 0 56.1%
if 0.0749999999999999972 < k Initial program 86.6%
Taylor expanded in m around 0 66.3%
Taylor expanded in k around inf 65.0%
unpow265.0%
distribute-rgt-in65.0%
+-commutative65.0%
Simplified65.0%
Final simplification46.2%
(FPCore (a k m) :precision binary64 (if (<= m -0.94) (/ a (* k k)) (if (<= m 66000000.0) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 66000000.0) {
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.94d0)) then
tmp = a / (k * k)
else if (m <= 66000000.0d0) 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.94) {
tmp = a / (k * k);
} else if (m <= 66000000.0) {
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.94: tmp = a / (k * k) elif m <= 66000000.0: 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.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 66000000.0) 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.94) tmp = a / (k * k); elseif (m <= 66000000.0) 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.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], 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.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 66000000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 6.6e7Initial program 96.8%
Taylor expanded in k around 0 70.2%
Taylor expanded in m around 0 67.1%
if 6.6e7 < m Initial program 79.3%
Taylor expanded in k around 0 80.5%
Taylor expanded in m around 0 48.0%
associate-*r*48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in k around inf 18.0%
Final simplification47.9%
(FPCore (a k m) :precision binary64 (if (<= m -0.94) (/ a (* k k)) (if (<= m 165000000000.0) (/ a (+ 1.0 (* k k))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -0.94) {
tmp = a / (k * k);
} else if (m <= 165000000000.0) {
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.94d0)) then
tmp = a / (k * k)
else if (m <= 165000000000.0d0) 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.94) {
tmp = a / (k * k);
} else if (m <= 165000000000.0) {
tmp = a / (1.0 + (k * k));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -0.94: tmp = a / (k * k) elif m <= 165000000000.0: 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.94) tmp = Float64(a / Float64(k * k)); elseif (m <= 165000000000.0) 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.94) tmp = a / (k * k); elseif (m <= 165000000000.0) 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.94], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 165000000000.0], 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.94:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 165000000000:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -0.93999999999999995Initial program 100.0%
Taylor expanded in m around 0 35.5%
Taylor expanded in k around inf 59.2%
unpow259.2%
Simplified59.2%
if -0.93999999999999995 < m < 1.65e11Initial program 96.8%
Taylor expanded in m around 0 93.6%
Taylor expanded in k around 0 90.7%
if 1.65e11 < m Initial program 79.3%
Taylor expanded in k around 0 80.5%
Taylor expanded in m around 0 48.0%
associate-*r*48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in k around inf 18.0%
Final simplification55.9%
(FPCore (a k m) :precision binary64 (if (or (<= k 4.3e-294) (not (<= k 1.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 4.3e-294) || !(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 <= 4.3d-294) .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 <= 4.3e-294) || !(k <= 1.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 4.3e-294) or not (k <= 1.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 4.3e-294) || !(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 <= 4.3e-294) || ~((k <= 1.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 4.3e-294], 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 4.3 \cdot 10^{-294} \lor \neg \left(k \leq 1\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 4.30000000000000019e-294 or 1 < k Initial program 88.1%
Taylor expanded in m around 0 38.7%
Taylor expanded in k around inf 41.5%
unpow241.5%
Simplified41.5%
if 4.30000000000000019e-294 < k < 1Initial program 99.9%
*-commutative99.9%
add-sqr-sqrt99.9%
times-frac99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
distribute-rgt-out99.9%
fma-def99.9%
Applied egg-rr99.9%
Taylor expanded in m around 0 56.0%
Taylor expanded in k around 0 54.8%
Final simplification45.7%
(FPCore (a k m) :precision binary64 (if (<= m -8.5e-61) (/ a (* k 10.0)) (if (<= m 66000000.0) a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -8.5e-61) {
tmp = a / (k * 10.0);
} else if (m <= 66000000.0) {
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-61)) then
tmp = a / (k * 10.0d0)
else if (m <= 66000000.0d0) 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-61) {
tmp = a / (k * 10.0);
} else if (m <= 66000000.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -8.5e-61: tmp = a / (k * 10.0) elif m <= 66000000.0: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -8.5e-61) tmp = Float64(a / Float64(k * 10.0)); elseif (m <= 66000000.0) 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-61) tmp = a / (k * 10.0); elseif (m <= 66000000.0) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -8.5e-61], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 66000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.5 \cdot 10^{-61}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{elif}\;m \leq 66000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -8.50000000000000016e-61Initial program 98.9%
Taylor expanded in m around 0 38.4%
Taylor expanded in k around inf 40.3%
unpow240.3%
distribute-rgt-in40.3%
+-commutative40.3%
Simplified40.3%
Taylor expanded in k around 0 19.9%
*-commutative19.9%
Simplified19.9%
if -8.50000000000000016e-61 < m < 6.6e7Initial program 97.7%
*-commutative97.7%
add-sqr-sqrt97.6%
times-frac97.7%
associate-+l+97.7%
+-commutative97.7%
distribute-rgt-out97.7%
fma-def97.7%
associate-+l+97.7%
+-commutative97.7%
distribute-rgt-out97.7%
fma-def97.7%
Applied egg-rr97.7%
Taylor expanded in m around 0 95.6%
Taylor expanded in k around 0 56.4%
if 6.6e7 < m Initial program 79.3%
Taylor expanded in k around 0 80.5%
Taylor expanded in m around 0 48.0%
associate-*r*48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in k around inf 18.0%
Final simplification30.6%
(FPCore (a k m) :precision binary64 (if (<= m 66000000.0) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 66000000.0) {
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 <= 66000000.0d0) 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 <= 66000000.0) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 66000000.0: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 66000000.0) 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 <= 66000000.0) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 66000000.0], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 66000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 6.6e7Initial program 98.3%
*-commutative98.3%
add-sqr-sqrt98.3%
times-frac98.3%
associate-+l+98.3%
+-commutative98.3%
distribute-rgt-out98.3%
fma-def98.3%
associate-+l+98.3%
+-commutative98.3%
distribute-rgt-out98.3%
fma-def98.3%
Applied egg-rr98.3%
Taylor expanded in m around 0 65.4%
Taylor expanded in k around 0 29.6%
if 6.6e7 < m Initial program 79.3%
Taylor expanded in k around 0 80.5%
Taylor expanded in m around 0 48.0%
associate-*r*48.0%
*-commutative48.0%
Simplified48.0%
Taylor expanded in k around inf 18.0%
Final simplification25.7%
(FPCore (a k m) :precision binary64 a)
double code(double a, double k, double m) {
return a;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
code = a
end function
public static double code(double a, double k, double m) {
return a;
}
def code(a, k, m): return a
function code(a, k, m) return a end
function tmp = code(a, k, m) tmp = a; end
code[a_, k_, m_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 91.9%
*-commutative91.9%
add-sqr-sqrt91.9%
times-frac91.5%
associate-+l+91.5%
+-commutative91.5%
distribute-rgt-out91.5%
fma-def91.5%
associate-+l+91.5%
+-commutative91.5%
distribute-rgt-out91.5%
fma-def91.5%
Applied egg-rr91.5%
Taylor expanded in m around 0 44.2%
Taylor expanded in k around 0 20.8%
Final simplification20.8%
herbie shell --seed 2023279
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))