
(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))) (t_1 (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))))) (if (<= t_1 5e+66) 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+66) {
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+66) 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+66) {
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+66: 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+66) 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+66) 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+66], 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^{+66}:\\
\;\;\;\;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.99999999999999991e66Initial program 97.0%
if 4.99999999999999991e66 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 62.7%
Taylor expanded in k around 0 74.6%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.8%
(FPCore (a k m) :precision binary64 (if (or (<= m -3.7e-10) (not (<= m 0.00041))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -3.7e-10) || !(m <= 0.00041)) {
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.7d-10)) .or. (.not. (m <= 0.00041d0))) 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.7e-10) || !(m <= 0.00041)) {
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.7e-10) or not (m <= 0.00041): 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.7e-10) || !(m <= 0.00041)) 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.7e-10) || ~((m <= 0.00041))) 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.7e-10], N[Not[LessEqual[m, 0.00041]], $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.7 \cdot 10^{-10} \lor \neg \left(m \leq 0.00041\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -3.70000000000000015e-10 or 4.0999999999999999e-4 < m Initial program 84.9%
Taylor expanded in k around 0 60.2%
exp-to-pow100.0%
*-commutative100.0%
Simplified100.0%
if -3.70000000000000015e-10 < m < 4.0999999999999999e-4Initial program 93.6%
add-cube-cbrt93.4%
times-frac93.4%
pow293.4%
associate-+l+93.4%
+-commutative93.4%
distribute-rgt-out93.4%
fma-def93.4%
associate-+l+93.4%
+-commutative93.4%
distribute-rgt-out93.4%
fma-def93.4%
Applied egg-rr93.4%
Taylor expanded in m around 0 93.6%
Final simplification97.8%
(FPCore (a k m)
:precision binary64
(if (<= m -5.2e+14)
(/ a (* k k))
(if (<= m 1.95)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (* k (+ (* k 100.0) -10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) + -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+14)) then
tmp = a / (k * k)
else if (m <= 1.95d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 100.0d0) + (-10.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 1.95) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) + -10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+14: tmp = a / (k * k) elif m <= 1.95: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 100.0) + -10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+14) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.95) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) + -10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.2e+14) tmp = a / (k * k); elseif (m <= 1.95) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 100.0) + -10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+14], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.95], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] + -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.95:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 + -10\right)\right)\\
\end{array}
\end{array}
if m < -5.2e14Initial program 100.0%
Taylor expanded in m around 0 35.6%
Taylor expanded in k around inf 65.0%
unpow265.0%
Simplified65.0%
if -5.2e14 < m < 1.94999999999999996Initial program 93.8%
add-cube-cbrt93.5%
times-frac93.6%
pow293.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
Applied egg-rr93.6%
Taylor expanded in m around 0 91.7%
if 1.94999999999999996 < m Initial program 67.9%
Taylor expanded in k around 0 85.9%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
fma-udef2.9%
Simplified2.9%
Taylor expanded in k around 0 26.9%
+-commutative26.9%
unpow226.9%
associate-*r*26.9%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out38.5%
Simplified38.5%
associate-*r*38.5%
*-commutative38.5%
distribute-rgt-out38.5%
*-commutative38.5%
Applied egg-rr38.5%
Final simplification66.6%
(FPCore (a k m)
:precision binary64
(if (<= m -5.2e+14)
(/ a (* k k))
(if (<= m 2.2)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* a (* k (- (* k 100.0) -10.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - -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+14)) then
tmp = a / (k * k)
else if (m <= 2.2d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (a * (k * ((k * 100.0d0) - (-10.0d0))))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (a * (k * ((k * 100.0) - -10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+14: tmp = a / (k * k) elif m <= 2.2: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (a * (k * ((k * 100.0) - -10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+14) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(a * Float64(k * Float64(Float64(k * 100.0) - -10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.2e+14) tmp = a / (k * k); elseif (m <= 2.2) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (a * (k * ((k * 100.0) - -10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+14], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(a * N[(k * N[(N[(k * 100.0), $MachinePrecision] - -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + a \cdot \left(k \cdot \left(k \cdot 100 - -10\right)\right)\\
\end{array}
\end{array}
if m < -5.2e14Initial program 100.0%
Taylor expanded in m around 0 35.6%
Taylor expanded in k around inf 65.0%
unpow265.0%
Simplified65.0%
if -5.2e14 < m < 2.2000000000000002Initial program 93.8%
add-cube-cbrt93.5%
times-frac93.6%
pow293.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
Applied egg-rr93.6%
Taylor expanded in m around 0 91.7%
if 2.2000000000000002 < m Initial program 67.9%
Taylor expanded in k around 0 85.9%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
fma-udef2.9%
Simplified2.9%
Taylor expanded in k around 0 26.9%
+-commutative26.9%
unpow226.9%
associate-*r*26.9%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out38.5%
Simplified38.5%
add-sqr-sqrt6.5%
sqrt-unprod38.5%
swap-sqr38.5%
metadata-eval38.5%
sqrt-prod38.5%
sqrt-prod31.9%
add-sqr-sqrt38.5%
metadata-eval38.5%
*-commutative38.5%
metadata-eval38.5%
cancel-sign-sub-inv38.5%
associate-*r*38.5%
distribute-rgt-out--38.5%
*-commutative38.5%
Applied egg-rr38.5%
Final simplification66.6%
(FPCore (a k m) :precision binary64 (if (<= m -5.2e+14) (/ a (* k k)) (if (<= m 1.9) (/ a (+ 1.0 (* k k))) (+ a (* k (* k (* a 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 1.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (k * (a * 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 <= (-5.2d+14)) then
tmp = a / (k * k)
else if (m <= 1.9d0) then
tmp = a / (1.0d0 + (k * k))
else
tmp = a + (k * (k * (a * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 1.9) {
tmp = a / (1.0 + (k * k));
} else {
tmp = a + (k * (k * (a * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+14: tmp = a / (k * k) elif m <= 1.9: tmp = a / (1.0 + (k * k)) else: tmp = a + (k * (k * (a * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+14) tmp = Float64(a / Float64(k * k)); elseif (m <= 1.9) tmp = Float64(a / Float64(1.0 + Float64(k * k))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.2e+14) tmp = a / (k * k); elseif (m <= 1.9) tmp = a / (1.0 + (k * k)); else tmp = a + (k * (k * (a * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+14], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.9], N[(a / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 1.9:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -5.2e14Initial program 100.0%
Taylor expanded in m around 0 35.6%
Taylor expanded in k around inf 65.0%
unpow265.0%
Simplified65.0%
if -5.2e14 < m < 1.8999999999999999Initial program 93.8%
Taylor expanded in m around 0 91.7%
Taylor expanded in k around 0 90.0%
if 1.8999999999999999 < m Initial program 67.9%
Taylor expanded in k around 0 85.9%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
fma-udef2.9%
Simplified2.9%
Taylor expanded in k around 0 26.9%
+-commutative26.9%
unpow226.9%
associate-*r*26.9%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out38.5%
Simplified38.5%
Taylor expanded in k around inf 38.5%
unpow238.5%
associate-*r*38.5%
*-commutative38.5%
associate-*r*38.5%
associate-*l*30.1%
*-commutative30.1%
Simplified30.1%
Final simplification63.4%
(FPCore (a k m)
:precision binary64
(if (<= m -5.2e+14)
(/ a (* k k))
(if (<= m 2.2)
(/ a (+ 1.0 (* k (+ k 10.0))))
(+ a (* k (* k (* a 100.0)))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 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 <= (-5.2d+14)) then
tmp = a / (k * k)
else if (m <= 2.2d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = a + (k * (k * (a * 100.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
tmp = a / (k * k);
} else if (m <= 2.2) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = a + (k * (k * (a * 100.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+14: tmp = a / (k * k) elif m <= 2.2: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = a + (k * (k * (a * 100.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+14) tmp = Float64(a / Float64(k * k)); elseif (m <= 2.2) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(a + Float64(k * Float64(k * Float64(a * 100.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -5.2e+14) tmp = a / (k * k); elseif (m <= 2.2) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = a + (k * (k * (a * 100.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+14], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.2], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(k * N[(k * N[(a * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;m \leq 2.2:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a + k \cdot \left(k \cdot \left(a \cdot 100\right)\right)\\
\end{array}
\end{array}
if m < -5.2e14Initial program 100.0%
Taylor expanded in m around 0 35.6%
Taylor expanded in k around inf 65.0%
unpow265.0%
Simplified65.0%
if -5.2e14 < m < 2.2000000000000002Initial program 93.8%
add-cube-cbrt93.5%
times-frac93.6%
pow293.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
associate-+l+93.6%
+-commutative93.6%
distribute-rgt-out93.6%
fma-def93.6%
Applied egg-rr93.6%
Taylor expanded in m around 0 91.7%
if 2.2000000000000002 < m Initial program 67.9%
Taylor expanded in k around 0 85.9%
Taylor expanded in m around 0 2.9%
+-commutative2.9%
*-commutative2.9%
fma-udef2.9%
Simplified2.9%
Taylor expanded in k around 0 26.9%
+-commutative26.9%
unpow226.9%
associate-*r*26.9%
associate-*r*26.9%
*-commutative26.9%
distribute-rgt-out38.5%
Simplified38.5%
Taylor expanded in k around inf 38.5%
unpow238.5%
associate-*r*38.5%
*-commutative38.5%
associate-*r*38.5%
associate-*l*30.1%
*-commutative30.1%
Simplified30.1%
Final simplification64.1%
(FPCore (a k m) :precision binary64 (if (<= k 9.2e-300) (/ a (* k k)) (if (<= k 5e-9) (* a (+ 1.0 (* k -10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 9.2e-300) {
tmp = a / (k * k);
} else if (k <= 5e-9) {
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 <= 9.2d-300) then
tmp = a / (k * k)
else if (k <= 5d-9) 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 <= 9.2e-300) {
tmp = a / (k * k);
} else if (k <= 5e-9) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 9.2e-300: tmp = a / (k * k) elif k <= 5e-9: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 9.2e-300) tmp = Float64(a / Float64(k * k)); elseif (k <= 5e-9) 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 <= 9.2e-300) tmp = a / (k * k); elseif (k <= 5e-9) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 9.2e-300], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5e-9], 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 9.2 \cdot 10^{-300}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 5 \cdot 10^{-9}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 9.20000000000000003e-300Initial program 95.5%
Taylor expanded in m around 0 23.6%
Taylor expanded in k around inf 35.9%
unpow235.9%
Simplified35.9%
if 9.20000000000000003e-300 < k < 5.0000000000000001e-9Initial program 100.0%
Taylor expanded in k around 0 72.1%
exp-to-pow72.1%
exp-to-pow72.1%
exp-to-pow72.1%
*-commutative72.1%
associate-*r*72.1%
exp-to-pow72.1%
*-commutative72.1%
distribute-lft1-in100.0%
*-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in m around 0 53.7%
if 5.0000000000000001e-9 < k Initial program 73.1%
Taylor expanded in m around 0 54.2%
Taylor expanded in k around inf 52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in a around 0 52.9%
unpow252.9%
associate-/r*57.5%
Simplified57.5%
Final simplification50.6%
(FPCore (a k m) :precision binary64 (if (<= k 9.8e-300) (/ a (* k k)) (if (<= k 10.0) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 9.8e-300) {
tmp = a / (k * k);
} else if (k <= 10.0) {
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 <= 9.8d-300) then
tmp = a / (k * k)
else if (k <= 10.0d0) 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 <= 9.8e-300) {
tmp = a / (k * k);
} else if (k <= 10.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 9.8e-300: tmp = a / (k * k) elif k <= 10.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 9.8e-300) tmp = Float64(a / Float64(k * k)); elseif (k <= 10.0) 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 <= 9.8e-300) tmp = a / (k * k); elseif (k <= 10.0) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 9.8e-300], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 10.0], 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 9.8 \cdot 10^{-300}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 10:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 9.8e-300Initial program 95.5%
Taylor expanded in m around 0 23.6%
Taylor expanded in k around inf 35.9%
unpow235.9%
Simplified35.9%
if 9.8e-300 < k < 10Initial program 99.9%
Taylor expanded in k around 0 99.1%
Taylor expanded in m around 0 52.7%
if 10 < k Initial program 72.6%
Taylor expanded in m around 0 54.3%
Taylor expanded in k around inf 53.8%
unpow253.8%
Simplified53.8%
Taylor expanded in a around 0 53.8%
unpow253.8%
associate-/r*58.5%
Simplified58.5%
Final simplification50.6%
(FPCore (a k m) :precision binary64 (if (or (<= k -9e+94) (not (<= k 5e-9))) (* (/ a k) 0.1) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= -9e+94) || !(k <= 5e-9)) {
tmp = (a / k) * 0.1;
} 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 <= (-9d+94)) .or. (.not. (k <= 5d-9))) then
tmp = (a / k) * 0.1d0
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= -9e+94) || !(k <= 5e-9)) {
tmp = (a / k) * 0.1;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -9e+94) or not (k <= 5e-9): tmp = (a / k) * 0.1 else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= -9e+94) || !(k <= 5e-9)) tmp = Float64(Float64(a / k) * 0.1); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= -9e+94) || ~((k <= 5e-9))) tmp = (a / k) * 0.1; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -9e+94], N[Not[LessEqual[k, 5e-9]], $MachinePrecision]], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -9 \cdot 10^{+94} \lor \neg \left(k \leq 5 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < -8.99999999999999944e94 or 5.0000000000000001e-9 < k Initial program 75.4%
Taylor expanded in k around 0 70.1%
Taylor expanded in m around 0 23.9%
+-commutative23.9%
*-commutative23.9%
fma-udef23.9%
Simplified23.9%
Taylor expanded in k around inf 23.9%
if -8.99999999999999944e94 < k < 5.0000000000000001e-9Initial program 100.0%
Taylor expanded in m around 0 37.2%
Taylor expanded in k around 0 37.0%
Taylor expanded in k around 0 36.3%
Final simplification30.2%
(FPCore (a k m) :precision binary64 (if (or (<= k 1.16e-299) (not (<= k 5e-9))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 1.16e-299) || !(k <= 5e-9)) {
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.16d-299) .or. (.not. (k <= 5d-9))) 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.16e-299) || !(k <= 5e-9)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 1.16e-299) or not (k <= 5e-9): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 1.16e-299) || !(k <= 5e-9)) 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.16e-299) || ~((k <= 5e-9))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 1.16e-299], N[Not[LessEqual[k, 5e-9]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.16 \cdot 10^{-299} \lor \neg \left(k \leq 5 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 1.15999999999999997e-299 or 5.0000000000000001e-9 < k Initial program 81.9%
Taylor expanded in m around 0 42.1%
Taylor expanded in k around inf 46.2%
unpow246.2%
Simplified46.2%
if 1.15999999999999997e-299 < k < 5.0000000000000001e-9Initial program 100.0%
Taylor expanded in m around 0 53.7%
Taylor expanded in k around 0 53.3%
Taylor expanded in k around 0 53.3%
Final simplification48.6%
(FPCore (a k m) :precision binary64 (if (<= k 1.12e-299) (/ a (* k k)) (if (<= k 5e-9) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.12e-299) {
tmp = a / (k * k);
} else if (k <= 5e-9) {
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.12d-299) then
tmp = a / (k * k)
else if (k <= 5d-9) 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.12e-299) {
tmp = a / (k * k);
} else if (k <= 5e-9) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.12e-299: tmp = a / (k * k) elif k <= 5e-9: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.12e-299) tmp = Float64(a / Float64(k * k)); elseif (k <= 5e-9) 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.12e-299) tmp = a / (k * k); elseif (k <= 5e-9) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.12e-299], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 5e-9], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.12 \cdot 10^{-299}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 5 \cdot 10^{-9}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.11999999999999998e-299Initial program 95.5%
Taylor expanded in m around 0 23.6%
Taylor expanded in k around inf 35.9%
unpow235.9%
Simplified35.9%
if 1.11999999999999998e-299 < k < 5.0000000000000001e-9Initial program 100.0%
Taylor expanded in m around 0 53.7%
Taylor expanded in k around 0 53.3%
Taylor expanded in k around 0 53.3%
if 5.0000000000000001e-9 < k Initial program 73.1%
Taylor expanded in m around 0 54.2%
Taylor expanded in k around inf 52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in a around 0 52.9%
unpow252.9%
associate-/r*57.5%
Simplified57.5%
Final simplification50.4%
(FPCore (a k m) :precision binary64 (if (<= m -5.2e+14) (/ a (* k k)) (/ a (+ 1.0 (* k k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -5.2e+14) {
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 <= (-5.2d+14)) 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 <= -5.2e+14) {
tmp = a / (k * k);
} else {
tmp = a / (1.0 + (k * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -5.2e+14: tmp = a / (k * k) else: tmp = a / (1.0 + (k * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -5.2e+14) 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 <= -5.2e+14) tmp = a / (k * k); else tmp = a / (1.0 + (k * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -5.2e+14], 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 -5.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot k}\\
\end{array}
\end{array}
if m < -5.2e14Initial program 100.0%
Taylor expanded in m around 0 35.6%
Taylor expanded in k around inf 65.0%
unpow265.0%
Simplified65.0%
if -5.2e14 < m Initial program 82.0%
Taylor expanded in m around 0 51.2%
Taylor expanded in k around 0 50.2%
Final simplification55.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 88.0%
Taylor expanded in m around 0 46.0%
Taylor expanded in k around 0 45.4%
Taylor expanded in k around 0 20.7%
Final simplification20.7%
herbie shell --seed 2023222
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))