
(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 10 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 (if (<= m 3.2) (* a (/ (pow k m) (+ 1.0 (* k (+ k 10.0))))) (* a (pow k m))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.2) {
tmp = a * (pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * pow(k, m);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 3.2d0) then
tmp = a * ((k ** m) / (1.0d0 + (k * (k + 10.0d0))))
else
tmp = a * (k ** m)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.2) {
tmp = a * (Math.pow(k, m) / (1.0 + (k * (k + 10.0))));
} else {
tmp = a * Math.pow(k, m);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.2: tmp = a * (math.pow(k, m) / (1.0 + (k * (k + 10.0)))) else: tmp = a * math.pow(k, m) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.2) tmp = Float64(a * Float64((k ^ m) / Float64(1.0 + Float64(k * Float64(k + 10.0))))); else tmp = Float64(a * (k ^ m)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.2) tmp = a * ((k ^ m) / (1.0 + (k * (k + 10.0)))); else tmp = a * (k ^ m); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.2], N[(a * N[(N[Power[k, m], $MachinePrecision] / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.2:\\
\;\;\;\;a \cdot \frac{{k}^{m}}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;a \cdot {k}^{m}\\
\end{array}
\end{array}
if m < 3.2000000000000002Initial program 96.0%
associate-/l*96.0%
remove-double-neg96.0%
distribute-frac-neg296.0%
distribute-neg-frac296.0%
remove-double-neg96.0%
sqr-neg96.0%
associate-+l+96.0%
sqr-neg96.0%
distribute-rgt-out96.6%
Simplified96.6%
if 3.2000000000000002 < m Initial program 73.8%
associate-/l*73.8%
remove-double-neg73.8%
distribute-frac-neg273.8%
distribute-neg-frac273.8%
remove-double-neg73.8%
sqr-neg73.8%
associate-+l+73.8%
sqr-neg73.8%
distribute-rgt-out73.8%
Simplified73.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -6.5e-8) (not (<= m 0.18))) (* 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 <= -6.5e-8) || !(m <= 0.18)) {
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 <= (-6.5d-8)) .or. (.not. (m <= 0.18d0))) 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 <= -6.5e-8) || !(m <= 0.18)) {
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 <= -6.5e-8) or not (m <= 0.18): 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 <= -6.5e-8) || !(m <= 0.18)) 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 <= -6.5e-8) || ~((m <= 0.18))) 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, -6.5e-8], N[Not[LessEqual[m, 0.18]], $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 -6.5 \cdot 10^{-8} \lor \neg \left(m \leq 0.18\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -6.49999999999999997e-8 or 0.17999999999999999 < m Initial program 87.2%
associate-/l*87.2%
remove-double-neg87.2%
distribute-frac-neg287.2%
distribute-neg-frac287.2%
remove-double-neg87.2%
sqr-neg87.2%
associate-+l+87.2%
sqr-neg87.2%
distribute-rgt-out87.8%
Simplified87.8%
Taylor expanded in k around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -6.49999999999999997e-8 < m < 0.17999999999999999Initial program 92.3%
associate-/l*92.3%
remove-double-neg92.3%
distribute-frac-neg292.3%
distribute-neg-frac292.3%
remove-double-neg92.3%
sqr-neg92.3%
associate-+l+92.3%
sqr-neg92.3%
distribute-rgt-out92.3%
Simplified92.3%
Taylor expanded in m around 0 91.8%
Final simplification97.6%
(FPCore (a k m)
:precision binary64
(if (<= m -3.9e+19)
(* k (/ a k))
(if (<= m 9.6e+17)
(/ a (+ 1.0 (* k 10.0)))
(if (<= m 4.6e+224) (* a (+ 1.0 (* k (* k 99.0)))) (* k (* a -10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.9e+19) {
tmp = k * (a / k);
} else if (m <= 9.6e+17) {
tmp = a / (1.0 + (k * 10.0));
} else if (m <= 4.6e+224) {
tmp = a * (1.0 + (k * (k * 99.0)));
} else {
tmp = k * (a * -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.9d+19)) then
tmp = k * (a / k)
else if (m <= 9.6d+17) then
tmp = a / (1.0d0 + (k * 10.0d0))
else if (m <= 4.6d+224) then
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.9e+19) {
tmp = k * (a / k);
} else if (m <= 9.6e+17) {
tmp = a / (1.0 + (k * 10.0));
} else if (m <= 4.6e+224) {
tmp = a * (1.0 + (k * (k * 99.0)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.9e+19: tmp = k * (a / k) elif m <= 9.6e+17: tmp = a / (1.0 + (k * 10.0)) elif m <= 4.6e+224: tmp = a * (1.0 + (k * (k * 99.0))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.9e+19) tmp = Float64(k * Float64(a / k)); elseif (m <= 9.6e+17) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); elseif (m <= 4.6e+224) tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.9e+19) tmp = k * (a / k); elseif (m <= 9.6e+17) tmp = a / (1.0 + (k * 10.0)); elseif (m <= 4.6e+224) tmp = a * (1.0 + (k * (k * 99.0))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.9e+19], N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 9.6e+17], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.6e+224], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.9 \cdot 10^{+19}:\\
\;\;\;\;k \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 9.6 \cdot 10^{+17}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{elif}\;m \leq 4.6 \cdot 10^{+224}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < -3.9e19Initial program 98.9%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 3.1%
*-commutative3.1%
Simplified3.1%
Taylor expanded in k around inf 14.5%
Taylor expanded in k around 0 30.9%
if -3.9e19 < m < 9.6e17Initial program 93.2%
associate-/l*93.2%
remove-double-neg93.2%
distribute-frac-neg293.2%
distribute-neg-frac293.2%
remove-double-neg93.2%
sqr-neg93.2%
associate-+l+93.2%
sqr-neg93.2%
distribute-rgt-out93.2%
Simplified93.2%
Taylor expanded in m around 0 83.0%
Taylor expanded in k around 0 51.6%
*-commutative51.6%
Simplified51.6%
if 9.6e17 < m < 4.60000000000000039e224Initial program 64.7%
associate-/l*64.7%
remove-double-neg64.7%
distribute-frac-neg264.7%
distribute-neg-frac264.7%
remove-double-neg64.7%
sqr-neg64.7%
associate-+l+64.7%
sqr-neg64.7%
distribute-rgt-out64.7%
Simplified64.7%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 43.3%
Taylor expanded in k around inf 43.3%
*-commutative43.3%
Simplified43.3%
if 4.60000000000000039e224 < m Initial program 86.2%
associate-/l*86.2%
remove-double-neg86.2%
distribute-frac-neg286.2%
distribute-neg-frac286.2%
remove-double-neg86.2%
sqr-neg86.2%
associate-+l+86.2%
sqr-neg86.2%
distribute-rgt-out86.2%
Simplified86.2%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 13.7%
*-commutative13.7%
Simplified13.7%
Taylor expanded in k around inf 13.7%
Taylor expanded in k around inf 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification40.9%
(FPCore (a k m)
:precision binary64
(if (<= m 1.1e+20)
(/ a (+ 1.0 (* k (+ k 10.0))))
(if (<= m 2.3e+224)
(* a (+ 1.0 (* k (- (* k 99.0) 10.0))))
(* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.3e+224) {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
} else {
tmp = k * (a * -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.1d+20) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else if (m <= 2.3d+224) then
tmp = a * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 2.3e+224) {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.1e+20: tmp = a / (1.0 + (k * (k + 10.0))) elif m <= 2.3e+224: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.1e+20) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); elseif (m <= 2.3e+224) tmp = Float64(a * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.1e+20) tmp = a / (1.0 + (k * (k + 10.0))); elseif (m <= 2.3e+224) tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.1e+20], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+224], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{+20}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+224}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 1.1e20Initial program 96.1%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in m around 0 60.3%
if 1.1e20 < m < 2.3000000000000002e224Initial program 64.0%
associate-/l*64.0%
remove-double-neg64.0%
distribute-frac-neg264.0%
distribute-neg-frac264.0%
remove-double-neg64.0%
sqr-neg64.0%
associate-+l+64.0%
sqr-neg64.0%
distribute-rgt-out64.0%
Simplified64.0%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 44.1%
if 2.3000000000000002e224 < m Initial program 86.2%
associate-/l*86.2%
remove-double-neg86.2%
distribute-frac-neg286.2%
distribute-neg-frac286.2%
remove-double-neg86.2%
sqr-neg86.2%
associate-+l+86.2%
sqr-neg86.2%
distribute-rgt-out86.2%
Simplified86.2%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 13.7%
*-commutative13.7%
Simplified13.7%
Taylor expanded in k around inf 13.7%
Taylor expanded in k around inf 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification54.4%
(FPCore (a k m)
:precision binary64
(if (<= m 1.1e+20)
(* a (/ 1.0 (+ 1.0 (* k (+ k 10.0)))))
(if (<= m 2.3e+223)
(* a (+ 1.0 (* k (- (* k 99.0) 10.0))))
(* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else if (m <= 2.3e+223) {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
} else {
tmp = k * (a * -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.1d+20) then
tmp = a * (1.0d0 / (1.0d0 + (k * (k + 10.0d0))))
else if (m <= 2.3d+223) then
tmp = a * (1.0d0 + (k * ((k * 99.0d0) - 10.0d0)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a * (1.0 / (1.0 + (k * (k + 10.0))));
} else if (m <= 2.3e+223) {
tmp = a * (1.0 + (k * ((k * 99.0) - 10.0)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.1e+20: tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))) elif m <= 2.3e+223: tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.1e+20) tmp = Float64(a * Float64(1.0 / Float64(1.0 + Float64(k * Float64(k + 10.0))))); elseif (m <= 2.3e+223) tmp = Float64(a * Float64(1.0 + Float64(k * Float64(Float64(k * 99.0) - 10.0)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.1e+20) tmp = a * (1.0 / (1.0 + (k * (k + 10.0)))); elseif (m <= 2.3e+223) tmp = a * (1.0 + (k * ((k * 99.0) - 10.0))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.1e+20], N[(a * N[(1.0 / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e+223], N[(a * N[(1.0 + N[(k * N[(N[(k * 99.0), $MachinePrecision] - 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{+20}:\\
\;\;\;\;a \cdot \frac{1}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{+223}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99 - 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 1.1e20Initial program 96.1%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in m around 0 60.3%
if 1.1e20 < m < 2.30000000000000004e223Initial program 64.0%
associate-/l*64.0%
remove-double-neg64.0%
distribute-frac-neg264.0%
distribute-neg-frac264.0%
remove-double-neg64.0%
sqr-neg64.0%
associate-+l+64.0%
sqr-neg64.0%
distribute-rgt-out64.0%
Simplified64.0%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 44.1%
if 2.30000000000000004e223 < m Initial program 86.2%
associate-/l*86.2%
remove-double-neg86.2%
distribute-frac-neg286.2%
distribute-neg-frac286.2%
remove-double-neg86.2%
sqr-neg86.2%
associate-+l+86.2%
sqr-neg86.2%
distribute-rgt-out86.2%
Simplified86.2%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 13.7%
*-commutative13.7%
Simplified13.7%
Taylor expanded in k around inf 13.7%
Taylor expanded in k around inf 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification54.4%
(FPCore (a k m)
:precision binary64
(let* ((t_0 (* k (/ a k))))
(if (<= m -1.95e+19)
t_0
(if (<= m 2.9e-13) a (if (<= m 1.16e+108) t_0 (* k (* a -10.0)))))))
double code(double a, double k, double m) {
double t_0 = k * (a / k);
double tmp;
if (m <= -1.95e+19) {
tmp = t_0;
} else if (m <= 2.9e-13) {
tmp = a;
} else if (m <= 1.16e+108) {
tmp = t_0;
} else {
tmp = k * (a * -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 = k * (a / k)
if (m <= (-1.95d+19)) then
tmp = t_0
else if (m <= 2.9d-13) then
tmp = a
else if (m <= 1.16d+108) then
tmp = t_0
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double t_0 = k * (a / k);
double tmp;
if (m <= -1.95e+19) {
tmp = t_0;
} else if (m <= 2.9e-13) {
tmp = a;
} else if (m <= 1.16e+108) {
tmp = t_0;
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): t_0 = k * (a / k) tmp = 0 if m <= -1.95e+19: tmp = t_0 elif m <= 2.9e-13: tmp = a elif m <= 1.16e+108: tmp = t_0 else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) t_0 = Float64(k * Float64(a / k)) tmp = 0.0 if (m <= -1.95e+19) tmp = t_0; elseif (m <= 2.9e-13) tmp = a; elseif (m <= 1.16e+108) tmp = t_0; else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) t_0 = k * (a / k); tmp = 0.0; if (m <= -1.95e+19) tmp = t_0; elseif (m <= 2.9e-13) tmp = a; elseif (m <= 1.16e+108) tmp = t_0; else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := Block[{t$95$0 = N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -1.95e+19], t$95$0, If[LessEqual[m, 2.9e-13], a, If[LessEqual[m, 1.16e+108], t$95$0, N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := k \cdot \frac{a}{k}\\
\mathbf{if}\;m \leq -1.95 \cdot 10^{+19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 2.9 \cdot 10^{-13}:\\
\;\;\;\;a\\
\mathbf{elif}\;m \leq 1.16 \cdot 10^{+108}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < -1.95e19 or 2.8999999999999998e-13 < m < 1.15999999999999995e108Initial program 91.5%
associate-/l*91.5%
remove-double-neg91.5%
distribute-frac-neg291.5%
distribute-neg-frac291.5%
remove-double-neg91.5%
sqr-neg91.5%
associate-+l+91.5%
sqr-neg91.5%
distribute-rgt-out92.3%
Simplified92.3%
Taylor expanded in m around 0 31.5%
Taylor expanded in k around 0 2.9%
*-commutative2.9%
Simplified2.9%
Taylor expanded in k around inf 11.6%
Taylor expanded in k around 0 25.3%
if -1.95e19 < m < 2.8999999999999998e-13Initial program 92.7%
associate-/l*92.8%
remove-double-neg92.8%
distribute-frac-neg292.8%
distribute-neg-frac292.8%
remove-double-neg92.8%
sqr-neg92.8%
associate-+l+92.8%
sqr-neg92.8%
distribute-rgt-out92.8%
Simplified92.8%
Taylor expanded in m around 0 86.7%
Taylor expanded in k around 0 44.5%
if 1.15999999999999995e108 < m Initial program 77.6%
associate-/l*77.6%
remove-double-neg77.6%
distribute-frac-neg277.6%
distribute-neg-frac277.6%
remove-double-neg77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 11.7%
*-commutative11.7%
Simplified11.7%
Taylor expanded in k around inf 11.6%
Taylor expanded in k around inf 28.1%
*-commutative28.1%
Simplified28.1%
Final simplification32.0%
(FPCore (a k m) :precision binary64 (if (<= m 1.1e+20) (/ a (+ 1.0 (* k (+ k 10.0)))) (if (<= m 4.4e+224) (* a (+ 1.0 (* k (* k 99.0)))) (* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 4.4e+224) {
tmp = a * (1.0 + (k * (k * 99.0)));
} else {
tmp = k * (a * -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.1d+20) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else if (m <= 4.4d+224) then
tmp = a * (1.0d0 + (k * (k * 99.0d0)))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 1.1e+20) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else if (m <= 4.4e+224) {
tmp = a * (1.0 + (k * (k * 99.0)));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 1.1e+20: tmp = a / (1.0 + (k * (k + 10.0))) elif m <= 4.4e+224: tmp = a * (1.0 + (k * (k * 99.0))) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 1.1e+20) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); elseif (m <= 4.4e+224) tmp = Float64(a * Float64(1.0 + Float64(k * Float64(k * 99.0)))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 1.1e+20) tmp = a / (1.0 + (k * (k + 10.0))); elseif (m <= 4.4e+224) tmp = a * (1.0 + (k * (k * 99.0))); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 1.1e+20], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4.4e+224], N[(a * N[(1.0 + N[(k * N[(k * 99.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 1.1 \cdot 10^{+20}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{elif}\;m \leq 4.4 \cdot 10^{+224}:\\
\;\;\;\;a \cdot \left(1 + k \cdot \left(k \cdot 99\right)\right)\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 1.1e20Initial program 96.1%
associate-/l*96.1%
remove-double-neg96.1%
distribute-frac-neg296.1%
distribute-neg-frac296.1%
remove-double-neg96.1%
sqr-neg96.1%
associate-+l+96.1%
sqr-neg96.1%
distribute-rgt-out96.7%
Simplified96.7%
Taylor expanded in m around 0 60.3%
if 1.1e20 < m < 4.3999999999999999e224Initial program 64.0%
associate-/l*64.0%
remove-double-neg64.0%
distribute-frac-neg264.0%
distribute-neg-frac264.0%
remove-double-neg64.0%
sqr-neg64.0%
associate-+l+64.0%
sqr-neg64.0%
distribute-rgt-out64.0%
Simplified64.0%
Taylor expanded in m around 0 2.6%
Taylor expanded in k around 0 44.1%
Taylor expanded in k around inf 44.1%
*-commutative44.1%
Simplified44.1%
if 4.3999999999999999e224 < m Initial program 86.2%
associate-/l*86.2%
remove-double-neg86.2%
distribute-frac-neg286.2%
distribute-neg-frac286.2%
remove-double-neg86.2%
sqr-neg86.2%
associate-+l+86.2%
sqr-neg86.2%
distribute-rgt-out86.2%
Simplified86.2%
Taylor expanded in m around 0 3.5%
Taylor expanded in k around 0 13.7%
*-commutative13.7%
Simplified13.7%
Taylor expanded in k around inf 13.7%
Taylor expanded in k around inf 36.1%
*-commutative36.1%
Simplified36.1%
Final simplification54.4%
(FPCore (a k m) :precision binary64 (if (<= m -3.5e+19) (* k (/ a k)) (if (<= m 1.25) (/ a (+ 1.0 (* k 10.0))) (* k (* a -10.0)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.5e+19) {
tmp = k * (a / k);
} else if (m <= 1.25) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-3.5d+19)) then
tmp = k * (a / k)
else if (m <= 1.25d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.5e+19) {
tmp = k * (a / k);
} else if (m <= 1.25) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.5e+19: tmp = k * (a / k) elif m <= 1.25: tmp = a / (1.0 + (k * 10.0)) else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.5e+19) tmp = Float64(k * Float64(a / k)); elseif (m <= 1.25) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.5e+19) tmp = k * (a / k); elseif (m <= 1.25) tmp = a / (1.0 + (k * 10.0)); else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.5e+19], N[(k * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.25], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.5 \cdot 10^{+19}:\\
\;\;\;\;k \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 1.25:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < -3.5e19Initial program 98.9%
associate-/l*98.9%
remove-double-neg98.9%
distribute-frac-neg298.9%
distribute-neg-frac298.9%
remove-double-neg98.9%
sqr-neg98.9%
associate-+l+98.9%
sqr-neg98.9%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in m around 0 39.2%
Taylor expanded in k around 0 3.1%
*-commutative3.1%
Simplified3.1%
Taylor expanded in k around inf 14.5%
Taylor expanded in k around 0 30.9%
if -3.5e19 < m < 1.25Initial program 92.8%
associate-/l*92.9%
remove-double-neg92.9%
distribute-frac-neg292.9%
distribute-neg-frac292.9%
remove-double-neg92.9%
sqr-neg92.9%
associate-+l+92.9%
sqr-neg92.9%
distribute-rgt-out92.9%
Simplified92.9%
Taylor expanded in m around 0 86.9%
Taylor expanded in k around 0 53.9%
*-commutative53.9%
Simplified53.9%
if 1.25 < m Initial program 73.8%
associate-/l*73.8%
remove-double-neg73.8%
distribute-frac-neg273.8%
distribute-neg-frac273.8%
remove-double-neg73.8%
sqr-neg73.8%
associate-+l+73.8%
sqr-neg73.8%
distribute-rgt-out73.8%
Simplified73.8%
Taylor expanded in m around 0 3.0%
Taylor expanded in k around 0 8.7%
*-commutative8.7%
Simplified8.7%
Taylor expanded in k around inf 8.7%
Taylor expanded in k around inf 20.3%
*-commutative20.3%
Simplified20.3%
Final simplification34.8%
(FPCore (a k m) :precision binary64 (if (<= m 3.8e+107) a (* k (* a -10.0))))
double code(double a, double k, double m) {
double tmp;
if (m <= 3.8e+107) {
tmp = a;
} else {
tmp = k * (a * -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.8d+107) then
tmp = a
else
tmp = k * (a * (-10.0d0))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 3.8e+107) {
tmp = a;
} else {
tmp = k * (a * -10.0);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 3.8e+107: tmp = a else: tmp = k * (a * -10.0) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 3.8e+107) tmp = a; else tmp = Float64(k * Float64(a * -10.0)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 3.8e+107) tmp = a; else tmp = k * (a * -10.0); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 3.8e+107], a, N[(k * N[(a * -10.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 3.8 \cdot 10^{+107}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;k \cdot \left(a \cdot -10\right)\\
\end{array}
\end{array}
if m < 3.7999999999999998e107Initial program 92.0%
associate-/l*92.0%
remove-double-neg92.0%
distribute-frac-neg292.0%
distribute-neg-frac292.0%
remove-double-neg92.0%
sqr-neg92.0%
associate-+l+92.0%
sqr-neg92.0%
distribute-rgt-out92.5%
Simplified92.5%
Taylor expanded in m around 0 54.1%
Taylor expanded in k around 0 20.4%
if 3.7999999999999998e107 < m Initial program 77.6%
associate-/l*77.6%
remove-double-neg77.6%
distribute-frac-neg277.6%
distribute-neg-frac277.6%
remove-double-neg77.6%
sqr-neg77.6%
associate-+l+77.6%
sqr-neg77.6%
distribute-rgt-out77.6%
Simplified77.6%
Taylor expanded in m around 0 3.2%
Taylor expanded in k around 0 11.7%
*-commutative11.7%
Simplified11.7%
Taylor expanded in k around inf 11.6%
Taylor expanded in k around inf 28.1%
*-commutative28.1%
Simplified28.1%
Final simplification22.2%
(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.7%
associate-/l*88.7%
remove-double-neg88.7%
distribute-frac-neg288.7%
distribute-neg-frac288.7%
remove-double-neg88.7%
sqr-neg88.7%
associate-+l+88.7%
sqr-neg88.7%
distribute-rgt-out89.1%
Simplified89.1%
Taylor expanded in m around 0 42.6%
Taylor expanded in k around 0 16.7%
Final simplification16.7%
herbie shell --seed 2024073
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))