
(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 (if (<= k 1.0) (* a (pow k m)) (/ (/ a k) (/ k (pow k m)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = (a / k) / (k / 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 (k <= 1.0d0) then
tmp = a * (k ** m)
else
tmp = (a / k) / (k / (k ** m))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a / k) / (k / Math.pow(k, m));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = (a / k) / (k / math.pow(k, m)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a / k) / Float64(k / (k ^ m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = (a / k) / (k / (k ^ m)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / N[(k / N[Power[k, m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{\frac{k}{{k}^{m}}}\\
\end{array}
\end{array}
if k < 1Initial program 95.8%
Taylor expanded in k around 0 98.7%
if 1 < k Initial program 83.7%
Taylor expanded in k around inf 83.1%
unpow283.1%
times-frac95.9%
*-commutative95.9%
associate-*r*95.9%
exp-prod95.9%
neg-mul-195.9%
log-rec95.9%
remove-double-neg95.9%
exp-prod95.9%
exp-to-pow95.9%
Simplified95.9%
clear-num95.9%
un-div-inv95.9%
Applied egg-rr95.9%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (* (/ a k) (/ (pow k m) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = (a / k) * (pow(k, m) / k);
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.0d0) then
tmp = a * (k ** m)
else
tmp = (a / k) * ((k ** m) / k)
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = (a / k) * (Math.pow(k, m) / k);
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = (a / k) * (math.pow(k, m) / k) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(Float64(a / k) * Float64((k ^ m) / k)); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = (a / k) * ((k ^ m) / k); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] * N[(N[Power[k, m], $MachinePrecision] / k), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{k} \cdot \frac{{k}^{m}}{k}\\
\end{array}
\end{array}
if k < 1Initial program 95.8%
Taylor expanded in k around 0 98.7%
if 1 < k Initial program 83.7%
Taylor expanded in k around inf 83.1%
unpow283.1%
times-frac95.9%
*-commutative95.9%
associate-*r*95.9%
exp-prod95.9%
neg-mul-195.9%
log-rec95.9%
remove-double-neg95.9%
exp-prod95.9%
exp-to-pow95.9%
Simplified95.9%
Final simplification97.7%
(FPCore (a k m) :precision binary64 (if (or (<= m -0.74) (not (<= m 7.5e-21))) (* a (pow k m)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if ((m <= -0.74) || !(m <= 7.5e-21)) {
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.74d0)) .or. (.not. (m <= 7.5d-21))) 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.74) || !(m <= 7.5e-21)) {
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.74) or not (m <= 7.5e-21): 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.74) || !(m <= 7.5e-21)) 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.74) || ~((m <= 7.5e-21))) 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.74], N[Not[LessEqual[m, 7.5e-21]], $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.74 \lor \neg \left(m \leq 7.5 \cdot 10^{-21}\right):\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -0.73999999999999999 or 7.50000000000000072e-21 < m Initial program 91.3%
Taylor expanded in k around 0 99.4%
if -0.73999999999999999 < m < 7.50000000000000072e-21Initial program 92.0%
Taylor expanded in m around 0 91.1%
+-commutative91.1%
unpow291.1%
distribute-rgt-in91.1%
fma-udef91.1%
+-commutative91.1%
Simplified91.1%
fma-udef91.1%
Applied egg-rr91.1%
Final simplification96.7%
(FPCore (a k m) :precision binary64 (if (<= k 1.0) (* a (pow k m)) (/ a (pow k (- 2.0 m)))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * pow(k, m);
} else {
tmp = a / pow(k, (2.0 - 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 (k <= 1.0d0) then
tmp = a * (k ** m)
else
tmp = a / (k ** (2.0d0 - m))
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.0) {
tmp = a * Math.pow(k, m);
} else {
tmp = a / Math.pow(k, (2.0 - m));
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.0: tmp = a * math.pow(k, m) else: tmp = a / math.pow(k, (2.0 - m)) return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.0) tmp = Float64(a * (k ^ m)); else tmp = Float64(a / (k ^ Float64(2.0 - m))); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.0) tmp = a * (k ^ m); else tmp = a / (k ^ (2.0 - m)); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.0], N[(a * N[Power[k, m], $MachinePrecision]), $MachinePrecision], N[(a / N[Power[k, N[(2.0 - m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1:\\
\;\;\;\;a \cdot {k}^{m}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{{k}^{\left(2 - m\right)}}\\
\end{array}
\end{array}
if k < 1Initial program 95.8%
Taylor expanded in k around 0 98.7%
if 1 < k Initial program 83.7%
Taylor expanded in k around inf 83.1%
unpow283.1%
times-frac95.9%
*-commutative95.9%
associate-*r*95.9%
exp-prod95.9%
neg-mul-195.9%
log-rec95.9%
remove-double-neg95.9%
exp-prod95.9%
exp-to-pow95.9%
Simplified95.9%
expm1-log1p-u79.3%
expm1-udef57.5%
frac-times55.3%
associate-/l*55.3%
pow255.3%
pow-div58.6%
Applied egg-rr58.6%
expm1-def73.1%
expm1-log1p91.9%
Simplified91.9%
Final simplification96.3%
(FPCore (a k m) :precision binary64 (if (<= k 1.7e-306) (/ a (* k k)) (if (<= k 0.1) (+ a (* -10.0 (* k a))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 1.7e-306) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = (a / k) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 1.7d-306) then
tmp = a / (k * k)
else if (k <= 0.1d0) then
tmp = a + ((-10.0d0) * (k * a))
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 1.7e-306) {
tmp = a / (k * k);
} else if (k <= 0.1) {
tmp = a + (-10.0 * (k * a));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 1.7e-306: tmp = a / (k * k) elif k <= 0.1: tmp = a + (-10.0 * (k * a)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 1.7e-306) tmp = Float64(a / Float64(k * k)); elseif (k <= 0.1) tmp = Float64(a + Float64(-10.0 * Float64(k * a))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 1.7e-306) tmp = a / (k * k); elseif (k <= 0.1) tmp = a + (-10.0 * (k * a)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 1.7e-306], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 0.1], N[(a + N[(-10.0 * N[(k * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 1.7 \cdot 10^{-306}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 0.1:\\
\;\;\;\;a + -10 \cdot \left(k \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 1.6999999999999999e-306Initial program 90.5%
Taylor expanded in m around 0 13.6%
+-commutative13.6%
unpow213.6%
distribute-rgt-in13.6%
fma-udef13.6%
+-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 23.6%
unpow223.6%
Simplified23.6%
if 1.6999999999999999e-306 < k < 0.10000000000000001Initial program 100.0%
Taylor expanded in m around 0 39.8%
+-commutative39.8%
unpow239.8%
distribute-rgt-in39.8%
fma-udef39.8%
+-commutative39.8%
Simplified39.8%
Taylor expanded in k around 0 39.2%
if 0.10000000000000001 < k Initial program 83.7%
Taylor expanded in k around inf 83.1%
unpow283.1%
times-frac95.9%
*-commutative95.9%
associate-*r*95.9%
exp-prod95.9%
neg-mul-195.9%
log-rec95.9%
remove-double-neg95.9%
exp-prod95.9%
exp-to-pow95.9%
Simplified95.9%
expm1-log1p-u79.3%
expm1-udef57.5%
frac-times55.3%
associate-/l*55.3%
pow255.3%
pow-div58.6%
Applied egg-rr58.6%
expm1-def73.1%
expm1-log1p91.9%
Simplified91.9%
Taylor expanded in m around 0 65.1%
unpow265.1%
associate-/r*71.3%
Simplified71.3%
Final simplification46.0%
(FPCore (a k m) :precision binary64 (if (<= k 3.2e-306) (/ a (* k k)) (if (<= k 1060000000.0) (/ a (+ 1.0 (* k 10.0))) (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 3.2e-306) {
tmp = a / (k * k);
} else if (k <= 1060000000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 3.2d-306) then
tmp = a / (k * k)
else if (k <= 1060000000.0d0) then
tmp = a / (1.0d0 + (k * 10.0d0))
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 3.2e-306) {
tmp = a / (k * k);
} else if (k <= 1060000000.0) {
tmp = a / (1.0 + (k * 10.0));
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 3.2e-306: tmp = a / (k * k) elif k <= 1060000000.0: tmp = a / (1.0 + (k * 10.0)) else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 3.2e-306) tmp = Float64(a / Float64(k * k)); elseif (k <= 1060000000.0) tmp = Float64(a / Float64(1.0 + Float64(k * 10.0))); else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 3.2e-306) tmp = a / (k * k); elseif (k <= 1060000000.0) tmp = a / (1.0 + (k * 10.0)); else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 3.2e-306], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1060000000.0], N[(a / N[(1.0 + N[(k * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.2 \cdot 10^{-306}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 1060000000:\\
\;\;\;\;\frac{a}{1 + k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 3.19999999999999971e-306Initial program 90.5%
Taylor expanded in m around 0 13.6%
+-commutative13.6%
unpow213.6%
distribute-rgt-in13.6%
fma-udef13.6%
+-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 23.6%
unpow223.6%
Simplified23.6%
if 3.19999999999999971e-306 < k < 1.06e9Initial program 100.0%
Taylor expanded in m around 0 39.4%
+-commutative39.4%
unpow239.4%
distribute-rgt-in39.4%
fma-udef39.4%
+-commutative39.4%
Simplified39.4%
Taylor expanded in k around 0 38.9%
if 1.06e9 < k Initial program 83.5%
Taylor expanded in k around inf 82.9%
unpow282.9%
times-frac95.8%
*-commutative95.8%
associate-*r*95.8%
exp-prod95.8%
neg-mul-195.8%
log-rec95.8%
remove-double-neg95.8%
exp-prod95.8%
exp-to-pow95.8%
Simplified95.8%
expm1-log1p-u80.2%
expm1-udef58.1%
frac-times55.9%
associate-/l*55.9%
pow255.9%
pow-div59.3%
Applied egg-rr59.3%
expm1-def73.9%
expm1-log1p91.9%
Simplified91.9%
Taylor expanded in m around 0 65.9%
unpow265.9%
associate-/r*72.1%
Simplified72.1%
Final simplification46.0%
(FPCore (a k m) :precision binary64 (if (<= m -1.02) (/ a (* k k)) (/ a (+ 1.0 (* k (+ k 10.0))))))
double code(double a, double k, double m) {
double tmp;
if (m <= -1.02) {
tmp = a / (k * 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.02d0)) then
tmp = a / (k * 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.02) {
tmp = a / (k * k);
} else {
tmp = a / (1.0 + (k * (k + 10.0)));
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -1.02: tmp = a / (k * k) else: tmp = a / (1.0 + (k * (k + 10.0))) return tmp
function code(a, k, m) tmp = 0.0 if (m <= -1.02) tmp = Float64(a / Float64(k * 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.02) tmp = a / (k * k); else tmp = a / (1.0 + (k * (k + 10.0))); end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -1.02], N[(a / N[(k * k), $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.02:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{1 + k \cdot \left(k + 10\right)}\\
\end{array}
\end{array}
if m < -1.02Initial program 100.0%
Taylor expanded in m around 0 28.4%
+-commutative28.4%
unpow228.4%
distribute-rgt-in28.4%
fma-udef28.4%
+-commutative28.4%
Simplified28.4%
Taylor expanded in k around inf 54.2%
unpow254.2%
Simplified54.2%
if -1.02 < m Initial program 87.2%
Taylor expanded in m around 0 47.9%
+-commutative47.9%
unpow247.9%
distribute-rgt-in47.9%
fma-udef47.9%
+-commutative47.9%
Simplified47.9%
fma-udef47.9%
Applied egg-rr47.9%
Final simplification50.0%
(FPCore (a k m) :precision binary64 (if (or (<= k 5.2e-306) (not (<= k 1060000000.0))) (/ a (* k k)) a))
double code(double a, double k, double m) {
double tmp;
if ((k <= 5.2e-306) || !(k <= 1060000000.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if ((k <= 5.2d-306) .or. (.not. (k <= 1060000000.0d0))) then
tmp = a / (k * k)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if ((k <= 5.2e-306) || !(k <= 1060000000.0)) {
tmp = a / (k * k);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if (k <= 5.2e-306) or not (k <= 1060000000.0): tmp = a / (k * k) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if ((k <= 5.2e-306) || !(k <= 1060000000.0)) tmp = Float64(a / Float64(k * k)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if ((k <= 5.2e-306) || ~((k <= 1060000000.0))) tmp = a / (k * k); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[Or[LessEqual[k, 5.2e-306], N[Not[LessEqual[k, 1060000000.0]], $MachinePrecision]], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 5.2 \cdot 10^{-306} \lor \neg \left(k \leq 1060000000\right):\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if k < 5.2000000000000001e-306 or 1.06e9 < k Initial program 86.7%
Taylor expanded in m around 0 42.5%
+-commutative42.5%
unpow242.5%
distribute-rgt-in42.5%
fma-udef42.5%
+-commutative42.5%
Simplified42.5%
Taylor expanded in k around inf 46.7%
unpow246.7%
Simplified46.7%
if 5.2000000000000001e-306 < k < 1.06e9Initial program 100.0%
Taylor expanded in m around 0 39.4%
+-commutative39.4%
unpow239.4%
distribute-rgt-in39.4%
fma-udef39.4%
+-commutative39.4%
Simplified39.4%
Taylor expanded in k around 0 38.2%
Final simplification43.6%
(FPCore (a k m) :precision binary64 (if (<= k 3.4e-305) (/ a (* k k)) (if (<= k 1060000000.0) a (/ (/ a k) k))))
double code(double a, double k, double m) {
double tmp;
if (k <= 3.4e-305) {
tmp = a / (k * k);
} else if (k <= 1060000000.0) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
real(8) function code(a, k, m)
real(8), intent (in) :: a
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8) :: tmp
if (k <= 3.4d-305) then
tmp = a / (k * k)
else if (k <= 1060000000.0d0) then
tmp = a
else
tmp = (a / k) / k
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (k <= 3.4e-305) {
tmp = a / (k * k);
} else if (k <= 1060000000.0) {
tmp = a;
} else {
tmp = (a / k) / k;
}
return tmp;
}
def code(a, k, m): tmp = 0 if k <= 3.4e-305: tmp = a / (k * k) elif k <= 1060000000.0: tmp = a else: tmp = (a / k) / k return tmp
function code(a, k, m) tmp = 0.0 if (k <= 3.4e-305) tmp = Float64(a / Float64(k * k)); elseif (k <= 1060000000.0) tmp = a; else tmp = Float64(Float64(a / k) / k); end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (k <= 3.4e-305) tmp = a / (k * k); elseif (k <= 1060000000.0) tmp = a; else tmp = (a / k) / k; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[k, 3.4e-305], N[(a / N[(k * k), $MachinePrecision]), $MachinePrecision], If[LessEqual[k, 1060000000.0], a, N[(N[(a / k), $MachinePrecision] / k), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;k \leq 3.4 \cdot 10^{-305}:\\
\;\;\;\;\frac{a}{k \cdot k}\\
\mathbf{elif}\;k \leq 1060000000:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{a}{k}}{k}\\
\end{array}
\end{array}
if k < 3.4000000000000001e-305Initial program 90.5%
Taylor expanded in m around 0 13.6%
+-commutative13.6%
unpow213.6%
distribute-rgt-in13.6%
fma-udef13.6%
+-commutative13.6%
Simplified13.6%
Taylor expanded in k around inf 23.6%
unpow223.6%
Simplified23.6%
if 3.4000000000000001e-305 < k < 1.06e9Initial program 100.0%
Taylor expanded in m around 0 39.4%
+-commutative39.4%
unpow239.4%
distribute-rgt-in39.4%
fma-udef39.4%
+-commutative39.4%
Simplified39.4%
Taylor expanded in k around 0 38.2%
if 1.06e9 < k Initial program 83.5%
Taylor expanded in k around inf 82.9%
unpow282.9%
times-frac95.8%
*-commutative95.8%
associate-*r*95.8%
exp-prod95.8%
neg-mul-195.8%
log-rec95.8%
remove-double-neg95.8%
exp-prod95.8%
exp-to-pow95.8%
Simplified95.8%
expm1-log1p-u80.2%
expm1-udef58.1%
frac-times55.9%
associate-/l*55.9%
pow255.9%
pow-div59.3%
Applied egg-rr59.3%
expm1-def73.9%
expm1-log1p91.9%
Simplified91.9%
Taylor expanded in m around 0 65.9%
unpow265.9%
associate-/r*72.1%
Simplified72.1%
Final simplification45.8%
(FPCore (a k m) :precision binary64 (if (<= m -3.1e-23) (/ a (* k 10.0)) a))
double code(double a, double k, double m) {
double tmp;
if (m <= -3.1e-23) {
tmp = a / (k * 10.0);
} 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 <= (-3.1d-23)) then
tmp = a / (k * 10.0d0)
else
tmp = a
end if
code = tmp
end function
public static double code(double a, double k, double m) {
double tmp;
if (m <= -3.1e-23) {
tmp = a / (k * 10.0);
} else {
tmp = a;
}
return tmp;
}
def code(a, k, m): tmp = 0 if m <= -3.1e-23: tmp = a / (k * 10.0) else: tmp = a return tmp
function code(a, k, m) tmp = 0.0 if (m <= -3.1e-23) tmp = Float64(a / Float64(k * 10.0)); else tmp = a; end return tmp end
function tmp_2 = code(a, k, m) tmp = 0.0; if (m <= -3.1e-23) tmp = a / (k * 10.0); else tmp = a; end tmp_2 = tmp; end
code[a_, k_, m_] := If[LessEqual[m, -3.1e-23], N[(a / N[(k * 10.0), $MachinePrecision]), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -3.1 \cdot 10^{-23}:\\
\;\;\;\;\frac{a}{k \cdot 10}\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if m < -3.0999999999999999e-23Initial program 99.0%
Taylor expanded in m around 0 29.7%
+-commutative29.7%
unpow229.7%
distribute-rgt-in29.7%
fma-udef29.7%
+-commutative29.7%
Simplified29.7%
Taylor expanded in k around 0 10.5%
Taylor expanded in k around inf 19.7%
*-commutative19.7%
Simplified19.7%
if -3.0999999999999999e-23 < m Initial program 87.5%
Taylor expanded in m around 0 47.7%
+-commutative47.7%
unpow247.7%
distribute-rgt-in47.7%
fma-udef47.7%
+-commutative47.7%
Simplified47.7%
Taylor expanded in k around 0 23.3%
Final simplification22.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 91.5%
Taylor expanded in m around 0 41.4%
+-commutative41.4%
unpow241.4%
distribute-rgt-in41.4%
fma-udef41.4%
+-commutative41.4%
Simplified41.4%
Taylor expanded in k around 0 16.4%
Final simplification16.4%
herbie shell --seed 2023283
(FPCore (a k m)
:name "Falkner and Boettcher, Appendix A"
:precision binary64
(/ (* a (pow k m)) (+ (+ 1.0 (* 10.0 k)) (* k k))))