
(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
(let* ((t_0 (* a (pow k m))))
(if (<= (/ t_0 (+ (+ 1.0 (* k 10.0)) (* k k))) 4e+236)
(* (pow k m) (/ a (+ 1.0 (* k (+ k 10.0)))))
t_0)))
double code(double a, double k, double m) {
double t_0 = a * pow(k, m);
double tmp;
if ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+236) {
tmp = pow(k, m) * (a / (1.0 + (k * (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 ((t_0 / ((1.0d0 + (k * 10.0d0)) + (k * k))) <= 4d+236) then
tmp = (k ** m) * (a / (1.0d0 + (k * (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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+236) {
tmp = Math.pow(k, m) * (a / (1.0 + (k * (k + 10.0))));
} else {
tmp = t_0;
}
return tmp;
}
def code(a, k, m): t_0 = a * math.pow(k, m) tmp = 0 if (t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+236: tmp = math.pow(k, m) * (a / (1.0 + (k * (k + 10.0)))) 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(1.0 + Float64(k * 10.0)) + Float64(k * k))) <= 4e+236) tmp = Float64((k ^ m) * Float64(a / Float64(1.0 + Float64(k * 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 ((t_0 / ((1.0 + (k * 10.0)) + (k * k))) <= 4e+236) tmp = (k ^ m) * (a / (1.0 + (k * (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[N[(t$95$0 / N[(N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision] + N[(k * k), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4e+236], N[(N[Power[k, m], $MachinePrecision] * N[(a / N[(1.0 + N[(k * N[(k + 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot {k}^{m}\\
\mathbf{if}\;\frac{t_0}{\left(1 + k \cdot 10\right) + k \cdot k} \leq 4 \cdot 10^{+236}:\\
\;\;\;\;{k}^{m} \cdot \frac{a}{1 + k \cdot \left(k + 10\right)}\\
\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.00000000000000021e236Initial program 96.7%
associate-*l/96.7%
sqr-neg96.7%
associate-+l+96.7%
sqr-neg96.7%
distribute-rgt-out96.7%
Simplified96.7%
if 4.00000000000000021e236 < (/.f64 (*.f64 a (pow.f64 k m)) (+.f64 (+.f64 1 (*.f64 10 k)) (*.f64 k k))) Initial program 59.2%
associate-*l/53.1%
sqr-neg53.1%
associate-+l+53.1%
sqr-neg53.1%
distribute-rgt-out53.1%
Simplified53.1%
Taylor expanded in k around 0 100.0%
Final simplification97.3%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.00065) (not (<= m 1.62e-9))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.00065) || !(m <= 1.62e-9)) {
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 <= (-0.00065d0)) .or. (.not. (m <= 1.62d-9))) 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 <= -0.00065) || !(m <= 1.62e-9)) {
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 <= -0.00065) or not (m <= 1.62e-9): 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 <= -0.00065) || !(m <= 1.62e-9)) 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 <= -0.00065) || ~((m <= 1.62e-9))) 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, -0.00065], N[Not[LessEqual[m, 1.62e-9]], $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 -0.00065 \lor \neg \left(m \leq 1.62 \cdot 10^{-9}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -6.4999999999999997e-4 or 1.61999999999999999e-9 < m Initial program 87.2%
associate-*l/85.3%
sqr-neg85.3%
associate-+l+85.3%
sqr-neg85.3%
distribute-rgt-out85.3%
Simplified85.3%
Taylor expanded in k around 0 98.2%
if -6.4999999999999997e-4 < m < 1.61999999999999999e-9Initial program 93.0%
associate-*l/93.0%
sqr-neg93.0%
associate-+l+93.0%
sqr-neg93.0%
distribute-rgt-out93.0%
Simplified93.0%
Taylor expanded in m around 0 93.0%
Final simplification96.2%
(FPCore (a k m) :precision binary64 (if (<= k 2.6e-306) (* -10.0 (* a k)) (if (<= k 0.1) a (* 0.1 (/ a k)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.6e-306) {
tmp = -10.0 * (a * k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 2.6d-306) then
tmp = (-10.0d0) * (a * k)
else if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 * (a / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.6e-306) {
tmp = -10.0 * (a * k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 * (a / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.6e-306: tmp = -10.0 * (a * k) elif k <= 0.1: tmp = a else: tmp = 0.1 * (a / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.6e-306) tmp = Float64(-10.0 * Float64(a * k)); elseif (k <= 0.1) tmp = a; else tmp = Float64(0.1 * Float64(a / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.6e-306) tmp = -10.0 * (a * k); elseif (k <= 0.1) tmp = a; else tmp = 0.1 * (a / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.6e-306], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], a, N[(0.1 * N[(a / k), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.6 \cdot 10^{-306}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;0.1 \cdot \frac{a}{k}\\
\end{array}
\end{array}
if k < 2.6e-306Initial program 85.3%
associate-*l/82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 14.6%
Taylor expanded in k around 0 8.6%
Taylor expanded in k around inf 11.2%
if 2.6e-306 < 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 59.7%
Taylor expanded in k around 0 59.7%
if 0.10000000000000001 < k Initial program 85.7%
associate-*l/84.8%
sqr-neg84.8%
associate-+l+84.8%
sqr-neg84.8%
distribute-rgt-out84.8%
Simplified84.8%
Taylor expanded in m around 0 62.6%
Taylor expanded in k around 0 27.8%
*-commutative27.8%
Simplified27.8%
Taylor expanded in k around inf 27.8%
Final simplification31.7%
(FPCore (a k m) :precision binary64 (if (<= k 2.6e-306) (* -10.0 (* a k)) (if (<= k 0.1) a (/ 0.1 (/ k a)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 2.6e-306) {
tmp = -10.0 * (a * k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / 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 <= 2.6d-306) then
tmp = (-10.0d0) * (a * k)
else if (k <= 0.1d0) then
tmp = a
else
tmp = 0.1d0 / (k / a)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 2.6e-306) {
tmp = -10.0 * (a * k);
} else if (k <= 0.1) {
tmp = a;
} else {
tmp = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 2.6e-306: tmp = -10.0 * (a * k) elif k <= 0.1: tmp = a else: tmp = 0.1 / (k / a) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 2.6e-306) tmp = Float64(-10.0 * Float64(a * k)); elseif (k <= 0.1) tmp = a; else tmp = Float64(0.1 / Float64(k / a)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 2.6e-306) tmp = -10.0 * (a * k); elseif (k <= 0.1) tmp = a; else tmp = 0.1 / (k / a); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 2.6e-306], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], a, N[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 2.6 \cdot 10^{-306}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 2.6e-306Initial program 85.3%
associate-*l/82.7%
sqr-neg82.7%
associate-+l+82.7%
sqr-neg82.7%
distribute-rgt-out82.7%
Simplified82.7%
Taylor expanded in m around 0 14.6%
Taylor expanded in k around 0 8.6%
Taylor expanded in k around inf 11.2%
if 2.6e-306 < 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 59.7%
Taylor expanded in k around 0 59.7%
if 0.10000000000000001 < k Initial program 85.7%
associate-*l/84.8%
sqr-neg84.8%
associate-+l+84.8%
sqr-neg84.8%
distribute-rgt-out84.8%
Simplified84.8%
Taylor expanded in m around 0 62.6%
Taylor expanded in k around 0 27.8%
*-commutative27.8%
Simplified27.8%
Taylor expanded in k around inf 27.8%
associate-*r/27.8%
associate-/l*28.2%
Simplified28.2%
Final simplification31.8%
(FPCore (a k m) :precision binary64 (if (<= m 4.8e+31) (/ a (+ 1.0 (* k (+ k 10.0)))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.8e+31) {
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 <= 4.8d+31) 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 <= 4.8e+31) {
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 <= 4.8e+31: 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 <= 4.8e+31) 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 <= 4.8e+31) 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, 4.8e+31], 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 4.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 4.79999999999999965e31Initial program 95.2%
associate-*l/95.2%
sqr-neg95.2%
associate-+l+95.2%
sqr-neg95.2%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around 0 65.3%
if 4.79999999999999965e31 < m Initial program 75.0%
associate-*l/70.8%
sqr-neg70.8%
associate-+l+70.8%
sqr-neg70.8%
distribute-rgt-out70.8%
Simplified70.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.3%
Taylor expanded in k around inf 16.6%
Final simplification51.6%
(FPCore (a k m) :precision binary64 (if (<= k 0.075) (* a (+ 1.0 (* k -10.0))) (/ 0.1 (/ k a))))
double code(double a, double k, double m) {
double tmp;
if (k <= 0.075) {
tmp = a * (1.0 + (k * -10.0));
} else {
tmp = 0.1 / (k / 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 <= 0.075d0) then
tmp = a * (1.0d0 + (k * (-10.0d0)))
else
tmp = 0.1d0 / (k / a)
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 = 0.1 / (k / a);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 0.075: tmp = a * (1.0 + (k * -10.0)) else: tmp = 0.1 / (k / a) 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(0.1 / Float64(k / a)); 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 = 0.1 / (k / a); 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[(0.1 / N[(k / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 0.075:\\
\;\;\;\;a \cdot \left(1 + k \cdot -10\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.1}{\frac{k}{a}}\\
\end{array}
\end{array}
if k < 0.0749999999999999972Initial program 92.4%
associate-*l/91.0%
sqr-neg91.0%
associate-+l+91.0%
sqr-neg91.0%
distribute-rgt-out91.0%
Simplified91.0%
Taylor expanded in m around 0 36.4%
Taylor expanded in k around 0 33.3%
Taylor expanded in a around 0 33.9%
*-commutative33.9%
Simplified33.9%
if 0.0749999999999999972 < k Initial program 85.7%
associate-*l/84.8%
sqr-neg84.8%
associate-+l+84.8%
sqr-neg84.8%
distribute-rgt-out84.8%
Simplified84.8%
Taylor expanded in m around 0 62.6%
Taylor expanded in k around 0 27.8%
*-commutative27.8%
Simplified27.8%
Taylor expanded in k around inf 27.8%
associate-*r/27.8%
associate-/l*28.2%
Simplified28.2%
Final simplification31.4%
(FPCore (a k m) :precision binary64 (if (<= m 4.8e+31) (/ a (+ 1.0 (* k 10.0))) (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.8e+31) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (m <= 4.8d+31) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (-10.0d0) * (a * k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= 4.8e+31) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 4.8e+31: tmp = a / (1.0 + (k * 10.0)) else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 4.8e+31) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(-10.0 * Float64(a * k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= 4.8e+31) tmp = a / (1.0 + (k * 10.0)); else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 4.8e+31], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.8 \cdot 10^{+31}:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 4.79999999999999965e31Initial program 95.2%
associate-*l/95.2%
sqr-neg95.2%
associate-+l+95.2%
sqr-neg95.2%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around 0 65.3%
Taylor expanded in k around 0 42.3%
*-commutative42.3%
Simplified42.3%
if 4.79999999999999965e31 < m Initial program 75.0%
associate-*l/70.8%
sqr-neg70.8%
associate-+l+70.8%
sqr-neg70.8%
distribute-rgt-out70.8%
Simplified70.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.3%
Taylor expanded in k around inf 16.6%
Final simplification35.0%
(FPCore (a k m) :precision binary64 (if (<= m 4.8e+31) a (* -10.0 (* a k))))
double code(double a, double k, double m) {
double tmp;
if (m <= 4.8e+31) {
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 <= 4.8d+31) 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 <= 4.8e+31) {
tmp = a;
} else {
tmp = -10.0 * (a * k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= 4.8e+31: tmp = a else: tmp = -10.0 * (a * k) return tmp
function code(a, k, m) tmp = 0.0 if (m <= 4.8e+31) 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 <= 4.8e+31) tmp = a; else tmp = -10.0 * (a * k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, 4.8e+31], a, N[(-10.0 * N[(a * k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 4.8 \cdot 10^{+31}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;-10 \cdot \left(a \cdot k\right)\\
\end{array}
\end{array}
if m < 4.79999999999999965e31Initial program 95.2%
associate-*l/95.2%
sqr-neg95.2%
associate-+l+95.2%
sqr-neg95.2%
distribute-rgt-out95.2%
Simplified95.2%
Taylor expanded in m around 0 65.3%
Taylor expanded in k around 0 25.6%
if 4.79999999999999965e31 < m Initial program 75.0%
associate-*l/70.8%
sqr-neg70.8%
associate-+l+70.8%
sqr-neg70.8%
distribute-rgt-out70.8%
Simplified70.8%
Taylor expanded in m around 0 2.9%
Taylor expanded in k around 0 8.3%
Taylor expanded in k around inf 16.6%
Final simplification23.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.5%
associate-*l/88.3%
sqr-neg88.3%
associate-+l+88.3%
sqr-neg88.3%
distribute-rgt-out88.3%
Simplified88.3%
Taylor expanded in m around 0 47.7%
Taylor expanded in k around 0 19.4%
Final simplification19.4%
herbie shell --seed 2024017
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))