
(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 9 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 (or (<= m -8.6e-18) (not (<= m 1.85e-6))) (* a (pow k m)) (/ 1.0 (fma (/ k a) (+ k 10.0) (/ 1.0 a)))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -8.6e-18) || !(m <= 1.85e-6)) {
tmp = a * pow(k, m);
} else {
tmp = 1.0 / fma((k / a), (k + 10.0), (1.0 / a));
}
return tmp;
}
function code(a, k, m) tmp = 0.0 if ((m <= -8.6e-18) || !(m <= 1.85e-6)) tmp = Float64(a * (k ^ m)); else tmp = Float64(1.0 / fma(Float64(k / a), Float64(k + 10.0), Float64(1.0 / a))); end return tmp end
code[a_, k_, m_] := If[Or[LessEqual[m, -8.6e-18], N[Not[LessEqual[m, 1.85e-6]], $MachinePrecision]], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(k / a), $MachinePrecision] * N[(k + 10.0), $MachinePrecision] + N[(1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -8.6 \cdot 10^{-18} \lor \neg \left(m \leq 1.85 \cdot 10^{-6}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{k}{a}, k + 10, \frac{1}{a}\right)}\\
\end{array}
\end{array}
if m < -8.6000000000000005e-18 or 1.8500000000000001e-6 < m Initial program 87.9%
associate-*l/81.2%
sqr-neg81.2%
associate-+l+81.2%
sqr-neg81.2%
distribute-rgt-out81.2%
Simplified81.2%
Taylor expanded in k around 0 99.4%
if -8.6000000000000005e-18 < m < 1.8500000000000001e-6Initial program 93.3%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
*-commutative93.3%
clear-num93.2%
un-div-inv93.2%
+-commutative93.2%
fma-def93.2%
+-commutative93.2%
Applied egg-rr93.2%
div-inv93.2%
Applied egg-rr93.2%
*-commutative93.2%
fma-udef93.2%
distribute-lft-in93.2%
associate-/r/93.2%
clear-num93.2%
Applied egg-rr93.2%
Taylor expanded in m around 0 92.8%
+-commutative92.8%
associate-/l*98.9%
+-commutative98.9%
associate-/r/98.9%
fma-udef98.9%
Simplified98.9%
Final simplification99.3%
(FPCore (a k m) :precision binary64 (if (or (<= m -8.6e-18) (not (<= m 1.8e-6))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -8.6e-18) || !(m <= 1.8e-6)) {
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 <= (-8.6d-18)) .or. (.not. (m <= 1.8d-6))) 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 <= -8.6e-18) || !(m <= 1.8e-6)) {
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 <= -8.6e-18) or not (m <= 1.8e-6): 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 <= -8.6e-18) || !(m <= 1.8e-6)) 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 <= -8.6e-18) || ~((m <= 1.8e-6))) 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, -8.6e-18], N[Not[LessEqual[m, 1.8e-6]], $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 -8.6 \cdot 10^{-18} \lor \neg \left(m \leq 1.8 \cdot 10^{-6}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -8.6000000000000005e-18 or 1.79999999999999992e-6 < m Initial program 87.9%
associate-*l/81.2%
sqr-neg81.2%
associate-+l+81.2%
sqr-neg81.2%
distribute-rgt-out81.2%
Simplified81.2%
Taylor expanded in k around 0 99.4%
if -8.6000000000000005e-18 < m < 1.79999999999999992e-6Initial program 93.3%
associate-*l/93.3%
sqr-neg93.3%
associate-+l+93.3%
sqr-neg93.3%
distribute-rgt-out93.3%
Simplified93.3%
Taylor expanded in m around 0 93.0%
Final simplification97.1%
(FPCore (a k m) :precision binary64 (if (<= m -2.3e+28) (* (/ 1.0 k) (/ a k)) (if (<= m 750000.0) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k)))))
double code(double a, double k, double m) {
double tmp;
if (m <= -2.3e+28) {
tmp = (1.0 / k) * (a / k);
} else if (m <= 750000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= (-2.3d+28)) then
tmp = (1.0d0 / k) * (a / k)
else if (m <= 750000.0d0) then
tmp = a / (1.0d0 + (k * (k + 10.0d0)))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -2.3e+28) {
tmp = (1.0 / k) * (a / k);
} else if (m <= 750000.0) {
tmp = a / (1.0 + (k * (k + 10.0)));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -2.3e+28: tmp = (1.0 / k) * (a / k) elif m <= 750000.0: tmp = a / (1.0 + (k * (k + 10.0))) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -2.3e+28) tmp = Float64(Float64(1.0 / k) * Float64(a / k)); elseif (m <= 750000.0) tmp = Float64(a / Float64(1.0 + Float64(k * Float64(k + 10.0)))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -2.3e+28) tmp = (1.0 / k) * (a / k); elseif (m <= 750000.0) tmp = a / (1.0 + (k * (k + 10.0))); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -2.3e+28], N[(N[(1.0 / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 750000.0], N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -2.3 \cdot 10^{+28}:\\
\;\;\;\;\frac{1}{k} \cdot \frac{a}{k}\\
\mathbf{elif}\;m \leq 750000:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < -2.29999999999999984e28Initial 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 38.6%
Taylor expanded in k around inf 59.1%
*-un-lft-identity59.1%
unpow259.1%
times-frac52.4%
Applied egg-rr52.4%
if -2.29999999999999984e28 < m < 7.5e5Initial program 93.1%
associate-*l/93.1%
sqr-neg93.1%
associate-+l+93.1%
sqr-neg93.1%
distribute-rgt-out93.1%
Simplified93.1%
Taylor expanded in m around 0 88.0%
if 7.5e5 < m Initial program 77.4%
associate-*l/64.3%
sqr-neg64.3%
associate-+l+64.3%
sqr-neg64.3%
distribute-rgt-out64.3%
Simplified64.3%
Taylor expanded in m around 0 2.8%
Taylor expanded in k around 0 7.8%
Taylor expanded in k around inf 18.6%
Final simplification55.5%
(FPCore (a k m) :precision binary64 (if (or (<= k -5.4e-261) (not (<= k 0.1))) (* (/ 1.0 k) (/ a k)) (* a (+ 1.0 (* k -10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -5.4e-261) || !(k <= 0.1)) {
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 ((k <= (-5.4d-261)) .or. (.not. (k <= 0.1d0))) 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 ((k <= -5.4e-261) || !(k <= 0.1)) {
tmp = (1.0 / k) * (a / k);
} else {
tmp = a * (1.0 + (k * -10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -5.4e-261) or not (k <= 0.1): 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 ((k <= -5.4e-261) || !(k <= 0.1)) tmp = Float64(Float64(1.0 / 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 ((k <= -5.4e-261) || ~((k <= 0.1))) tmp = (1.0 / k) * (a / k); else tmp = a * (1.0 + (k * -10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -5.4e-261], N[Not[LessEqual[k, 0.1]], $MachinePrecision]], N[(N[(1.0 / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -5.4 \cdot 10^{-261} \lor \neg \left(k \leq 0.1\right):\\
\;\;\;\;\frac{1}{k} \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\end{array}
\end{array}
if k < -5.3999999999999998e-261 or 0.10000000000000001 < k Initial program 84.4%
associate-*l/77.8%
sqr-neg77.8%
associate-+l+77.8%
sqr-neg77.8%
distribute-rgt-out77.8%
Simplified77.8%
Taylor expanded in m around 0 41.3%
Taylor expanded in k around inf 45.6%
*-un-lft-identity45.6%
unpow245.6%
times-frac46.8%
Applied egg-rr46.8%
if -5.3999999999999998e-261 < k < 0.10000000000000001Initial 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 56.4%
Taylor expanded in k around 0 56.4%
Taylor expanded in a around 0 56.4%
*-commutative56.4%
Simplified56.4%
Final simplification50.2%
(FPCore (a k m) :precision binary64 (if (or (<= k -5.4e-261) (not (<= k 0.205))) (* (/ 1.0 k) (/ a k)) (/ a (+ 1.0 (* k 10.0)))))
double code(double a, double k, double m) {
double tmp;
if ((k <= -5.4e-261) || !(k <= 0.205)) {
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 ((k <= (-5.4d-261)) .or. (.not. (k <= 0.205d0))) 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 ((k <= -5.4e-261) || !(k <= 0.205)) {
tmp = (1.0 / k) * (a / k);
} else {
tmp = a / (1.0 + (k * 10.0));
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= -5.4e-261) or not (k <= 0.205): 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 ((k <= -5.4e-261) || !(k <= 0.205)) tmp = Float64(Float64(1.0 / 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 ((k <= -5.4e-261) || ~((k <= 0.205))) tmp = (1.0 / k) * (a / k); else tmp = a / (1.0 + (k * 10.0)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, -5.4e-261], N[Not[LessEqual[k, 0.205]], $MachinePrecision]], N[(N[(1.0 / k), $MachinePrecision] * N[(a / k), $MachinePrecision]), $MachinePrecision], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -5.4 \cdot 10^{-261} \lor \neg \left(k \leq 0.205\right):\\
\;\;\;\;\frac{1}{k} \cdot \frac{a}{k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\end{array}
\end{array}
if k < -5.3999999999999998e-261 or 0.204999999999999988 < k Initial program 84.4%
associate-*l/77.8%
sqr-neg77.8%
associate-+l+77.8%
sqr-neg77.8%
distribute-rgt-out77.8%
Simplified77.8%
Taylor expanded in m around 0 41.3%
Taylor expanded in k around inf 45.6%
*-un-lft-identity45.6%
unpow245.6%
times-frac46.8%
Applied egg-rr46.8%
if -5.3999999999999998e-261 < k < 0.204999999999999988Initial 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 56.4%
Taylor expanded in k around 0 56.4%
*-commutative56.4%
Simplified56.4%
Final simplification50.2%
(FPCore (a k m) :precision binary64 (if (<= k -2e-311) (* -10.0 (* a k)) (if (<= k 0.21) a (* (/ a k) 0.1))))
double code(double a, double k, double m) {
double tmp;
if (k <= -2e-311) {
tmp = -10.0 * (a * k);
} else if (k <= 0.21) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
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 <= (-2d-311)) then
tmp = (-10.0d0) * (a * k)
else if (k <= 0.21d0) then
tmp = a
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= -2e-311) {
tmp = -10.0 * (a * k);
} else if (k <= 0.21) {
tmp = a;
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= -2e-311: tmp = -10.0 * (a * k) elif k <= 0.21: tmp = a else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= -2e-311) tmp = Float64(-10.0 * Float64(a * k)); elseif (k <= 0.21) tmp = a; else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= -2e-311) tmp = -10.0 * (a * k); elseif (k <= 0.21) tmp = a; else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, -2e-311], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.21], a, N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq -2 \cdot 10^{-311}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{elif}\;k \leq 0.21:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < -1.9999999999999e-311Initial program 85.5%
associate-*l/74.7%
sqr-neg74.7%
associate-+l+74.7%
sqr-neg74.7%
distribute-rgt-out74.7%
Simplified74.7%
Taylor expanded in m around 0 17.4%
Taylor expanded in k around 0 8.5%
Taylor expanded in k around inf 12.8%
if -1.9999999999999e-311 < k < 0.209999999999999992Initial 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 58.3%
Taylor expanded in k around 0 57.8%
if 0.209999999999999992 < k Initial program 83.8%
associate-*l/81.5%
sqr-neg81.5%
associate-+l+81.5%
sqr-neg81.5%
distribute-rgt-out81.5%
Simplified81.5%
Taylor expanded in m around 0 62.7%
Taylor expanded in k around 0 23.9%
*-commutative23.9%
Simplified23.9%
Taylor expanded in k around inf 23.9%
Final simplification31.7%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (* (/ a k) 0.1)))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) * 0.1;
}
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 <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = (a / k) * 0.1d0
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = (a / k) * 0.1;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = (a / k) * 0.1 return tmp
function code(a, k, m) tmp = 0.0 if (k <= 0.075) tmp = Float64(a * Float64(1.0 + Float64(k * -10.0))); else tmp = Float64(Float64(a / k) * 0.1); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 0.075) tmp = a * (1.0 + (k * -10.0)); else tmp = (a / k) * 0.1; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 0.075], N[(a * N[(1.0 + N[(k * -10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * 0.1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot 0.1\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 92.8%
associate-*l/87.5%
sqr-neg87.5%
associate-+l+87.5%
sqr-neg87.5%
distribute-rgt-out87.5%
Simplified87.5%
Taylor expanded in m around 0 38.4%
Taylor expanded in k around 0 34.0%
Taylor expanded in a around 0 34.0%
*-commutative34.0%
Simplified34.0%
if 0.0749999999999999972 < k Initial program 84.0%
associate-*l/81.8%
sqr-neg81.8%
associate-+l+81.8%
sqr-neg81.8%
distribute-rgt-out81.8%
Simplified81.8%
Taylor expanded in m around 0 62.1%
Taylor expanded in k around 0 23.7%
*-commutative23.7%
Simplified23.7%
Taylor expanded in k around inf 23.7%
Final simplification30.5%
(FPCore (a k m) :precision binary64 (if (<= m 7.1e+40) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 7.1e+40) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 7.1d+40) then
tmp = a
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 7.1e+40) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 7.1e+40: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 7.1e+40) tmp = a; else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 7.1e+40) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 7.1e+40], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 7.1 \cdot 10^{+40}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 7.10000000000000037e40Initial program 95.0%
associate-*l/94.5%
sqr-neg94.5%
associate-+l+94.5%
sqr-neg94.5%
distribute-rgt-out94.5%
Simplified94.5%
Taylor expanded in m around 0 64.3%
Taylor expanded in k around 0 29.7%
if 7.10000000000000037e40 < m Initial program 77.0%
associate-*l/63.5%
sqr-neg63.5%
associate-+l+63.5%
sqr-neg63.5%
distribute-rgt-out63.5%
Simplified63.5%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.6%
Taylor expanded in k around inf 20.7%
Final simplification27.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 89.8%
associate-*l/85.5%
sqr-neg85.5%
associate-+l+85.5%
sqr-neg85.5%
distribute-rgt-out85.5%
Simplified85.5%
Taylor expanded in m around 0 46.5%
Taylor expanded in k around 0 22.1%
Final simplification22.1%
herbie shell --seed 2024024
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))