
(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))))
(if (<= (/ t_0 (+ (* k k) (+ 1.0 (* k 10.0)))) 2e+296)
(/ a (/ (+ 1.0 (* k (+ k 10.0))) (pow k m)))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+296) {
tmp = a / ((1.0 + (k * (k + 10.0))) / pow(k, m));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if ((t_0 / ((k * k) + (1.0d0 + (k * 10.0d0)))) <= 2d+296) then
tmp = a / ((1.0d0 + (k * (k + 10.0d0))) / (k ** m))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+296) {
tmp = a / ((1.0 + (k * (k + 10.0))) / Math.pow(k, m));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+296: tmp = a / ((1.0 + (k * (k + 10.0))) / math.pow(k, m)) 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(k * k) + Float64(1.0 + Float64(k * 10.0)))) <= 2e+296) tmp = Float64(a / Float64(Float64(1.0 + Float64(k * Float64(k + 10.0))) / (k ^ m))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if ((t_0 / ((k * k) + (1.0 + (k * 10.0)))) <= 2e+296) tmp = a / ((1.0 + (k * (k + 10.0))) / (k ^ m)); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+296], N[(a / N[(N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t_0}{k \cdot k + \left(1 + k \cdot 10\right)} \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\frac{a}{\frac{1 + k \cdot \left(k + 10\right)}{{k}^{m}}}\\
\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.99999999999999996e296Initial program 99.5%
associate-/l*99.5%
sqr-neg99.5%
associate-+l+99.5%
sqr-neg99.5%
distribute-rgt-out99.5%
Simplified99.5%
if 1.99999999999999996e296 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 64.0%
associate-/l*64.0%
sqr-neg64.0%
associate-+l+64.0%
sqr-neg64.0%
distribute-rgt-out64.0%
Simplified64.0%
Taylor expanded in k around 0 100.0%
Final simplification99.6%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* a (pow k m))))
(if (<= m -2.5e-19)
(/ t_0 (+ 1.0 (* k k)))
(if (<= m 4.5e-31) (/ a (+ (* k k) (+ 1.0 (* k 10.0)))) t_0))))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if (m <= -2.5e-19) {
tmp = t_0 / (1.0 + (k * k));
} else if (m <= 4.5e-31) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: t_0
real(8) :: tmp
t_0 = a * (k ** m)
if (m <= (-2.5d-19)) then
tmp = t_0 / (1.0d0 + (k * k))
else if (m <= 4.5d-31) then
tmp = a / ((k * k) + (1.0d0 + (k * 10.0d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = a * Math.pow(k, m);
double tmp;
if (m <= -2.5e-19) {
tmp = t_0 / (1.0 + (k * k));
} else if (m <= 4.5e-31) {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if m <= -2.5e-19: tmp = t_0 / (1.0 + (k * k)) elif m <= 4.5e-31: tmp = a / ((k * k) + (1.0 + (k * 10.0))) else: tmp = t_0 return tmp
function code(a, k, m) t_0 = Float64(a * (k ^ m)) tmp = 0.0 if (m <= -2.5e-19) tmp = Float64(t_0 / Float64(1.0 + Float64(k * k))); elseif (m <= 4.5e-31) tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))); else tmp = t_0; end return tmp end
function tmp_2 = code(a, k, m) t_0 = a * (k ^ m); tmp = 0.0; if (m <= -2.5e-19) tmp = t_0 / (1.0 + (k * k)); elseif (m <= 4.5e-31) tmp = a / ((k * k) + (1.0 + (k * 10.0))); else tmp = t_0; end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -2.5e-19], N[(t$95$0 / N[(1.0 + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.5e-31], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;m \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;\frac{t_0}{1 + k \cdot k}\\
\mathbf{elif}\;m \leq 4.5 \cdot 10^{-31}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if m < -2.5000000000000002e-19Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
if -2.5000000000000002e-19 < m < 4.5000000000000004e-31Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 98.7%
if 4.5000000000000004e-31 < m Initial program 77.2%
associate-/l*77.2%
sqr-neg77.2%
associate-+l+77.2%
sqr-neg77.2%
distribute-rgt-out77.2%
Simplified77.2%
Taylor expanded in k around 0 100.0%
Final simplification99.6%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.00125) (not (<= m 4.5e-31))) (* a (pow k m)) (/ a (+ (* k k) (+ 1.0 (* k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00125) || !(m <= 4.5e-31)) {
tmp = a * pow(k, m);
} else {
tmp = a / ((k * k) + (1.0 + (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 <= (-0.00125d0)) .or. (.not. (m <= 4.5d-31))) then
tmp = a * (k ** m)
else
tmp = a / ((k * k) + (1.0d0 + (k * 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00125) || !(m <= 4.5e-31)) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (m <= -0.00125) or not (m <= 4.5e-31): tmp = a * math.pow(k, m) else: tmp = a / ((k * k) + (1.0 + (k * 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if ((m <= -0.00125) || !(m <= 4.5e-31)) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((m <= -0.00125) || ~((m <= 4.5e-31))) tmp = a * (k ^ m); else tmp = a / ((k * k) + (1.0 + (k * 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[m, -0.00125], N[Not[LessEqual[m, 4.5e-31]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00125 \lor \neg \left(m \leq 4.5 \cdot 10^{-31}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\end{array}
\end{array}
if m < -0.00125000000000000003 or 4.5000000000000004e-31 < m Initial program 89.7%
associate-/l*89.7%
sqr-neg89.7%
associate-+l+89.7%
sqr-neg89.7%
distribute-rgt-out89.7%
Simplified89.7%
Taylor expanded in k around 0 100.0%
if -0.00125000000000000003 < m < 4.5000000000000004e-31Initial program 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in m around 0 97.6%
Final simplification99.2%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* (/ a k) (/ 1.0 k))))
(if (<= k -2.8e-299)
(/ 1.0 (/ k (/ a k)))
(if (<= k 4.05e-283)
a
(if (<= k 9.2e-272)
t_0
(if (<= k 2.8e-177)
a
(if (<= k 2.7e-102)
t_0
(if (<= k 0.075)
(+ a (* -10.0 (* a k)))
(/ a (* k (+ k 10.0)))))))))))
double code(double a, double k, double m) {
double t_0 = (a / k) * (1.0 / k);
double tmp;
if (k <= -2.8e-299) {
tmp = 1.0 / (k / (a / k));
} else if (k <= 4.05e-283) {
tmp = a;
} else if (k <= 9.2e-272) {
tmp = t_0;
} else if (k <= 2.8e-177) {
tmp = a;
} else if (k <= 2.7e-102) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = (a / k) * (1.0d0 / k)
if (k <= (-2.8d-299)) then
tmp = 1.0d0 / (k / (a / k))
else if (k <= 4.05d-283) then
tmp = a
else if (k <= 9.2d-272) then
tmp = t_0
else if (k <= 2.8d-177) then
tmp = a
else if (k <= 2.7d-102) then
tmp = t_0
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 t_0 = (a / k) * (1.0 / k);
double tmp;
if (k <= -2.8e-299) {
tmp = 1.0 / (k / (a / k));
} else if (k <= 4.05e-283) {
tmp = a;
} else if (k <= 9.2e-272) {
tmp = t_0;
} else if (k <= 2.8e-177) {
tmp = a;
} else if (k <= 2.7e-102) {
tmp = t_0;
} 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): t_0 = (a / k) * (1.0 / k) tmp = 0 if k <= -2.8e-299: tmp = 1.0 / (k / (a / k)) elif k <= 4.05e-283: tmp = a elif k <= 9.2e-272: tmp = t_0 elif k <= 2.8e-177: tmp = a elif k <= 2.7e-102: tmp = t_0 elif k <= 0.075: tmp = a + (-10.0 * (a * k)) else: tmp = a / (k * (k + 10.0)) return tmp
function code(a, k, m) t_0 = Float64(Float64(a / k) * Float64(1.0 / k)) tmp = 0.0 if (k <= -2.8e-299) tmp = Float64(1.0 / Float64(k / Float64(a / k))); elseif (k <= 4.05e-283) tmp = a; elseif (k <= 9.2e-272) tmp = t_0; elseif (k <= 2.8e-177) tmp = a; elseif (k <= 2.7e-102) tmp = t_0; 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) t_0 = (a / k) * (1.0 / k); tmp = 0.0; if (k <= -2.8e-299) tmp = 1.0 / (k / (a / k)); elseif (k <= 4.05e-283) tmp = a; elseif (k <= 9.2e-272) tmp = t_0; elseif (k <= 2.8e-177) tmp = a; elseif (k <= 2.7e-102) tmp = t_0; 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_] := Block[{t$95$0 = N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[k, -2.8e-299], N[(1.0 / N[(k / N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 4.05e-283], a, If[LessEqual[k, 9.2e-272], t$95$0, If[LessEqual[k, 2.8e-177], a, If[LessEqual[k, 2.7e-102], t$95$0, 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}
t_0 := \frac{a}{k} \cdot \frac{1}{k}\\
\mathbf{if}\;k \leq -2.8 \cdot 10^{-299}:\\
\;\;\;\;\frac{1}{\frac{k}{\frac{a}{k}}}\\
\mathbf{elif}\;k \leq 4.05 \cdot 10^{-283}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 9.2 \cdot 10^{-272}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;k \leq 2.8 \cdot 10^{-177}:\\
\;\;\;\;a\\
\mathbf{elif}\;k \leq 2.7 \cdot 10^{-102}:\\
\;\;\;\;t_0\\
\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.8000000000000001e-299Initial program 83.1%
*-commutative83.1%
associate-/l*81.5%
sqr-neg81.5%
associate-+l+81.5%
+-commutative81.5%
sqr-neg81.5%
distribute-rgt-out81.5%
fma-def81.5%
+-commutative81.5%
Simplified81.5%
Taylor expanded in k around inf 52.3%
Taylor expanded in m around 0 15.2%
unpow215.2%
associate-*r/9.4%
distribute-rgt-out9.6%
+-commutative9.6%
Simplified9.6%
inv-pow9.6%
*-commutative9.6%
Applied egg-rr9.6%
unpow-19.6%
*-commutative9.6%
associate-/r/9.6%
Simplified9.6%
Taylor expanded in k around inf 19.3%
if -2.8000000000000001e-299 < k < 4.04999999999999983e-283 or 9.19999999999999955e-272 < k < 2.79999999999999987e-177Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in k around 0 100.0%
Taylor expanded in m around 0 47.1%
if 4.04999999999999983e-283 < k < 9.19999999999999955e-272 or 2.79999999999999987e-177 < k < 2.7e-102Initial program 100.0%
*-commutative100.0%
associate-/l*99.9%
sqr-neg99.9%
associate-+l+99.9%
+-commutative99.9%
sqr-neg99.9%
distribute-rgt-out99.9%
fma-def99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in k around inf 82.2%
Taylor expanded in m around 0 25.9%
unpow225.9%
associate-*r/25.9%
distribute-rgt-out25.9%
+-commutative25.9%
Simplified25.9%
associate-*l/25.9%
associate-/l*25.9%
times-frac25.9%
Applied egg-rr25.9%
Taylor expanded in k around inf 56.9%
if 2.7e-102 < k < 0.0749999999999999972Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 59.7%
Taylor expanded in k around 0 59.8%
*-commutative59.8%
Simplified59.8%
if 0.0749999999999999972 < k Initial program 90.8%
*-commutative90.8%
associate-/l*87.2%
sqr-neg87.2%
associate-+l+87.2%
+-commutative87.2%
sqr-neg87.2%
distribute-rgt-out87.2%
fma-def87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in k around inf 84.7%
Taylor expanded in a around 0 84.7%
+-commutative84.7%
unpow284.7%
distribute-rgt-in84.7%
Simplified84.7%
Taylor expanded in m around 0 62.3%
associate-/r*56.8%
+-commutative56.8%
associate-/l/62.3%
*-commutative62.3%
Simplified62.3%
Final simplification48.1%
(FPCore (a k m) :precision binary64 (if (<= m -1.45e-19) (/ 1.0 (/ k (/ a k))) (/ a (+ (* k k) (+ 1.0 (* k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-19) {
tmp = 1.0 / (k / (a / k));
} else {
tmp = a / ((k * k) + (1.0 + (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 <= (-1.45d-19)) then
tmp = 1.0d0 / (k / (a / k))
else
tmp = a / ((k * k) + (1.0d0 + (k * 10.0d0)))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-19) {
tmp = 1.0 / (k / (a / k));
} else {
tmp = a / ((k * k) + (1.0 + (k * 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.45e-19: tmp = 1.0 / (k / (a / k)) else: tmp = a / ((k * k) + (1.0 + (k * 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.45e-19) tmp = Float64(1.0 / Float64(k / Float64(a / k))); else tmp = Float64(a / Float64(Float64(k * k) + Float64(1.0 + Float64(k * 10.0)))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.45e-19) tmp = 1.0 / (k / (a / k)); else tmp = a / ((k * k) + (1.0 + (k * 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.45e-19], N[(1.0 / N[(k / N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(N[(k * k), $MachinePrecision] + N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.45 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\frac{k}{\frac{a}{k}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k \cdot k + \left(1 + k \cdot 10\right)}\\
\end{array}
\end{array}
if m < -1.45e-19Initial program 99.1%
*-commutative99.1%
associate-/l*99.1%
sqr-neg99.1%
associate-+l+99.1%
+-commutative99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
fma-def99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in k around inf 84.1%
Taylor expanded in m around 0 40.6%
unpow240.6%
associate-*r/32.2%
distribute-rgt-out32.2%
+-commutative32.2%
Simplified32.2%
inv-pow32.2%
*-commutative32.2%
Applied egg-rr32.2%
unpow-132.2%
*-commutative32.2%
associate-/r/32.2%
Simplified32.2%
Taylor expanded in k around inf 50.8%
if -1.45e-19 < m Initial program 88.4%
*-commutative88.4%
Simplified88.4%
Taylor expanded in m around 0 52.5%
Final simplification51.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.45e-19) (/ 1.0 (/ k (/ a k))) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-19) {
tmp = 1.0 / (k / (a / k));
} 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 <= (-1.45d-19)) then
tmp = 1.0d0 / (k / (a / k))
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 <= -1.45e-19) {
tmp = 1.0 / (k / (a / k));
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.45e-19: tmp = 1.0 / (k / (a / k)) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.45e-19) tmp = Float64(1.0 / Float64(k / Float64(a / k))); 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 <= -1.45e-19) tmp = 1.0 / (k / (a / k)); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.45e-19], N[(1.0 / N[(k / N[(a / k), $MachinePrecision]), $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 -1.45 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\frac{k}{\frac{a}{k}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.45e-19Initial program 99.1%
*-commutative99.1%
associate-/l*99.1%
sqr-neg99.1%
associate-+l+99.1%
+-commutative99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
fma-def99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in k around inf 84.1%
Taylor expanded in m around 0 40.6%
unpow240.6%
associate-*r/32.2%
distribute-rgt-out32.2%
+-commutative32.2%
Simplified32.2%
inv-pow32.2%
*-commutative32.2%
Applied egg-rr32.2%
unpow-132.2%
*-commutative32.2%
associate-/r/32.2%
Simplified32.2%
Taylor expanded in k around inf 50.8%
if -1.45e-19 < m Initial program 88.4%
associate-/l*88.4%
sqr-neg88.4%
associate-+l+88.4%
sqr-neg88.4%
distribute-rgt-out88.4%
Simplified88.4%
Taylor expanded in m around 0 52.5%
Final simplification51.8%
(FPCore (a k m) :precision binary64 (if (<= m -1.45e-148) (* (/ a k) (/ 1.0 k)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-148) {
tmp = (a / k) * (1.0 / 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 (m <= (-1.45d-148)) then
tmp = (a / k) * (1.0d0 / k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.45e-148) {
tmp = (a / k) * (1.0 / k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.45e-148: tmp = (a / k) * (1.0 / k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.45e-148) tmp = Float64(Float64(a / k) * Float64(1.0 / k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.45e-148) tmp = (a / k) * (1.0 / k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.45e-148], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.45 \cdot 10^{-148}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -1.4499999999999999e-148Initial program 99.2%
*-commutative99.2%
associate-/l*98.6%
sqr-neg98.6%
associate-+l+98.6%
+-commutative98.6%
sqr-neg98.6%
distribute-rgt-out98.6%
fma-def98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in k around inf 80.4%
Taylor expanded in m around 0 43.2%
unpow243.2%
associate-*r/36.0%
distribute-rgt-out36.0%
+-commutative36.0%
Simplified36.0%
associate-*l/43.2%
associate-/l*43.7%
times-frac36.1%
Applied egg-rr36.1%
Taylor expanded in k around inf 51.5%
if -1.4499999999999999e-148 < m Initial program 87.0%
associate-/l*87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.0%
Simplified87.0%
Taylor expanded in k around 0 82.0%
Taylor expanded in m around 0 29.2%
Final simplification39.4%
(FPCore (a k m) :precision binary64 (if (<= m -1.65e-150) (* (/ a k) (/ 1.0 k)) (+ a (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.65e-150) {
tmp = (a / k) * (1.0 / 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 (m <= (-1.65d-150)) then
tmp = (a / k) * (1.0d0 / 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 (m <= -1.65e-150) {
tmp = (a / k) * (1.0 / k);
} else {
tmp = a + (-10.0 * (a * k));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.65e-150: tmp = (a / k) * (1.0 / k) else: tmp = a + (-10.0 * (a * k)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.65e-150) tmp = Float64(Float64(a / k) * Float64(1.0 / 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 (m <= -1.65e-150) tmp = (a / k) * (1.0 / k); else tmp = a + (-10.0 * (a * k)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.65e-150], N[(N[(a / k), $MachinePrecision] * N[(1.0 / k), $MachinePrecision]), $MachinePrecision], N[(a + N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.65 \cdot 10^{-150}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{1}{k}\\
\mathbf{else}:\\
\;\;\;\;a + -10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -1.6500000000000001e-150Initial program 99.2%
*-commutative99.2%
associate-/l*98.6%
sqr-neg98.6%
associate-+l+98.6%
+-commutative98.6%
sqr-neg98.6%
distribute-rgt-out98.6%
fma-def98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in k around inf 80.4%
Taylor expanded in m around 0 43.2%
unpow243.2%
associate-*r/36.0%
distribute-rgt-out36.0%
+-commutative36.0%
Simplified36.0%
associate-*l/43.2%
associate-/l*43.7%
times-frac36.1%
Applied egg-rr36.1%
Taylor expanded in k around inf 51.5%
if -1.6500000000000001e-150 < m Initial program 87.0%
associate-/l*87.0%
sqr-neg87.0%
associate-+l+87.0%
sqr-neg87.0%
distribute-rgt-out87.0%
Simplified87.0%
Taylor expanded in m around 0 46.7%
Taylor expanded in k around 0 30.1%
*-commutative30.1%
Simplified30.1%
Final simplification39.9%
(FPCore (a k m) :precision binary64 (if (<= m -1.4e-19) (/ 1.0 (/ k (/ a k))) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.4e-19) {
tmp = 1.0 / (k / (a / k));
} else {
tmp = a / (1.0 + (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 <= (-1.4d-19)) then
tmp = 1.0d0 / (k / (a / k))
else
tmp = a / (1.0d0 + (k * 10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -1.4e-19) {
tmp = 1.0 / (k / (a / k));
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.4e-19: tmp = 1.0 / (k / (a / k)) else: tmp = a / (1.0 + (k * 10.0)) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.4e-19) tmp = Float64(1.0 / Float64(k / Float64(a / k))); else tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -1.4e-19) tmp = 1.0 / (k / (a / k)); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.4e-19], N[(1.0 / N[(k / N[(a / k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.4 \cdot 10^{-19}:\\
\;\;\;\;\frac{1}{\frac{k}{\frac{a}{k}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if m < -1.40000000000000001e-19Initial program 99.1%
*-commutative99.1%
associate-/l*99.1%
sqr-neg99.1%
associate-+l+99.1%
+-commutative99.1%
sqr-neg99.1%
distribute-rgt-out99.1%
fma-def99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in k around inf 84.1%
Taylor expanded in m around 0 40.6%
unpow240.6%
associate-*r/32.2%
distribute-rgt-out32.2%
+-commutative32.2%
Simplified32.2%
inv-pow32.2%
*-commutative32.2%
Applied egg-rr32.2%
unpow-132.2%
*-commutative32.2%
associate-/r/32.2%
Simplified32.2%
Taylor expanded in k around inf 50.8%
if -1.40000000000000001e-19 < m Initial program 88.4%
associate-/l*88.4%
sqr-neg88.4%
associate-+l+88.4%
sqr-neg88.4%
distribute-rgt-out88.4%
Simplified88.4%
Taylor expanded in m around 0 52.5%
Taylor expanded in k around 0 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification41.8%
(FPCore (a k m) :precision binary64 (if (<= m -1.6e-11) (* (/ a k) 0.1) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.6e-11) {
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 (m <= (-1.6d-11)) 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 (m <= -1.6e-11) {
tmp = (a / k) * 0.1;
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.6e-11: tmp = (a / k) * 0.1 else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.6e-11) 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 (m <= -1.6e-11) tmp = (a / k) * 0.1; else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.6e-11], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.6 \cdot 10^{-11}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -1.59999999999999997e-11Initial program 100.0%
associate-/l*100.0%
sqr-neg100.0%
associate-+l+100.0%
sqr-neg100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 30.2%
Taylor expanded in k around 0 11.8%
*-commutative11.8%
Simplified11.8%
Taylor expanded in k around inf 22.4%
if -1.59999999999999997e-11 < m Initial program 88.0%
associate-/l*88.0%
sqr-neg88.0%
associate-+l+88.0%
sqr-neg88.0%
distribute-rgt-out88.0%
Simplified88.0%
Taylor expanded in k around 0 76.6%
Taylor expanded in m around 0 30.3%
Final simplification27.3%
(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 92.6%
associate-/l*92.6%
sqr-neg92.6%
associate-+l+92.6%
sqr-neg92.6%
distribute-rgt-out92.6%
Simplified92.6%
Taylor expanded in k around 0 84.7%
Taylor expanded in m around 0 20.1%
Final simplification20.1%
herbie shell --seed 2024010
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))