
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b): return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b) return Float64(exp(a) / Float64(exp(a) + exp(b))) end
function tmp = code(a, b) tmp = exp(a) / (exp(a) + exp(b)); end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b): return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b) return Float64(exp(a) / Float64(exp(a) + exp(b))) end
function tmp = code(a, b) tmp = exp(a) / (exp(a) + exp(b)); end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}
(FPCore (a b)
:precision binary64
(if (<= (exp a) 0.0)
(* (exp a) 0.5)
(/
(fma a (fma a (fma 0.16666666666666666 a 0.5) 1.0) 1.0)
(fma a (fma a (fma a 0.16666666666666666 0.5) 1.0) (+ (exp b) 1.0)))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 0.0) {
tmp = exp(a) * 0.5;
} else {
tmp = fma(a, fma(a, fma(0.16666666666666666, a, 0.5), 1.0), 1.0) / fma(a, fma(a, fma(a, 0.16666666666666666, 0.5), 1.0), (exp(b) + 1.0));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (exp(a) <= 0.0) tmp = Float64(exp(a) * 0.5); else tmp = Float64(fma(a, fma(a, fma(0.16666666666666666, a, 0.5), 1.0), 1.0) / fma(a, fma(a, fma(a, 0.16666666666666666, 0.5), 1.0), Float64(exp(b) + 1.0))); end return tmp end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 0.0], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(a * N[(a * N[(0.16666666666666666 * a + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(a * N[(a * N[(a * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 0:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(0.16666666666666666, a, 0.5\right), 1\right), 1\right)}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.16666666666666666, 0.5\right), 1\right), e^{b} + 1\right)}\\
\end{array}
\end{array}
if (exp.f64 a) < 0.0Initial program 100.0%
Taylor expanded in b around 0
Simplified100.0%
Taylor expanded in a around 0
Simplified100.0%
div-invN/A
metadata-evalN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64100.0
Applied egg-rr100.0%
if 0.0 < (exp.f64 a) Initial program 98.5%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6497.5
Simplified97.5%
Taylor expanded in a around 0
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
unpow2N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-+r+N/A
accelerator-lowering-fma.f64N/A
Simplified99.4%
Final simplification99.5%
(FPCore (a b) :precision binary64 (if (<= (/ (exp a) (+ (exp a) (exp b))) 0.7075496127730688) (fma 0.25 a 0.5) 1.0))
double code(double a, double b) {
double tmp;
if ((exp(a) / (exp(a) + exp(b))) <= 0.7075496127730688) {
tmp = fma(0.25, a, 0.5);
} else {
tmp = 1.0;
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(exp(a) / Float64(exp(a) + exp(b))) <= 0.7075496127730688) tmp = fma(0.25, a, 0.5); else tmp = 1.0; end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.7075496127730688], N[(0.25 * a + 0.5), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{e^{a}}{e^{a} + e^{b}} \leq 0.7075496127730688:\\
\;\;\;\;\mathsf{fma}\left(0.25, a, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b))) < 0.707549612773068826Initial program 100.0%
Taylor expanded in b around 0
Simplified74.9%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f6450.3
Simplified50.3%
if 0.707549612773068826 < (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b))) Initial program 93.5%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.6
Simplified92.6%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified97.9%
(FPCore (a b) :precision binary64 (if (<= (/ (exp a) (+ (exp a) (exp b))) 0.7075496127730688) (fma -0.25 b 0.5) 1.0))
double code(double a, double b) {
double tmp;
if ((exp(a) / (exp(a) + exp(b))) <= 0.7075496127730688) {
tmp = fma(-0.25, b, 0.5);
} else {
tmp = 1.0;
}
return tmp;
}
function code(a, b) tmp = 0.0 if (Float64(exp(a) / Float64(exp(a) + exp(b))) <= 0.7075496127730688) tmp = fma(-0.25, b, 0.5); else tmp = 1.0; end return tmp end
code[a_, b_] := If[LessEqual[N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.7075496127730688], N[(-0.25 * b + 0.5), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{e^{a}}{e^{a} + e^{b}} \leq 0.7075496127730688:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b))) < 0.707549612773068826Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6480.4
Simplified80.4%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f6450.3
Simplified50.3%
if 0.707549612773068826 < (/.f64 (exp.f64 a) (+.f64 (exp.f64 a) (exp.f64 b))) Initial program 93.5%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.6
Simplified92.6%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified97.9%
(FPCore (a b) :precision binary64 (/ (exp a) (+ (exp a) (exp b))))
double code(double a, double b) {
return exp(a) / (exp(a) + exp(b));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = exp(a) / (exp(a) + exp(b))
end function
public static double code(double a, double b) {
return Math.exp(a) / (Math.exp(a) + Math.exp(b));
}
def code(a, b): return math.exp(a) / (math.exp(a) + math.exp(b))
function code(a, b) return Float64(exp(a) / Float64(exp(a) + exp(b))) end
function tmp = code(a, b) tmp = exp(a) / (exp(a) + exp(b)); end
code[a_, b_] := N[(N[Exp[a], $MachinePrecision] / N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{a}}{e^{a} + e^{b}}
\end{array}
Initial program 98.8%
(FPCore (a b) :precision binary64 (if (<= (exp a) 0.0) (* (exp a) 0.5) (/ (fma a (fma a 0.5 1.0) 1.0) (+ 1.0 (fma a (fma 0.5 a 1.0) (exp b))))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 0.0) {
tmp = exp(a) * 0.5;
} else {
tmp = fma(a, fma(a, 0.5, 1.0), 1.0) / (1.0 + fma(a, fma(0.5, a, 1.0), exp(b)));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (exp(a) <= 0.0) tmp = Float64(exp(a) * 0.5); else tmp = Float64(fma(a, fma(a, 0.5, 1.0), 1.0) / Float64(1.0 + fma(a, fma(0.5, a, 1.0), exp(b)))); end return tmp end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 0.0], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(a * N[(a * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(1.0 + N[(a * N[(0.5 * a + 1.0), $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 0:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, \mathsf{fma}\left(a, 0.5, 1\right), 1\right)}{1 + \mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, 1\right), e^{b}\right)}\\
\end{array}
\end{array}
if (exp.f64 a) < 0.0Initial program 100.0%
Taylor expanded in b around 0
Simplified100.0%
Taylor expanded in a around 0
Simplified100.0%
div-invN/A
metadata-evalN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64100.0
Applied egg-rr100.0%
if 0.0 < (exp.f64 a) Initial program 98.5%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6497.9
Simplified97.9%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6499.3
Simplified99.3%
(FPCore (a b) :precision binary64 (if (<= (exp a) 0.0) (* (exp a) 0.5) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 0.0) {
tmp = exp(a) * 0.5;
} else {
tmp = 1.0 / (exp(b) + 1.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (exp(a) <= 0.0d0) then
tmp = exp(a) * 0.5d0
else
tmp = 1.0d0 / (exp(b) + 1.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (Math.exp(a) <= 0.0) {
tmp = Math.exp(a) * 0.5;
} else {
tmp = 1.0 / (Math.exp(b) + 1.0);
}
return tmp;
}
def code(a, b): tmp = 0 if math.exp(a) <= 0.0: tmp = math.exp(a) * 0.5 else: tmp = 1.0 / (math.exp(b) + 1.0) return tmp
function code(a, b) tmp = 0.0 if (exp(a) <= 0.0) tmp = Float64(exp(a) * 0.5); else tmp = Float64(1.0 / Float64(exp(b) + 1.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (exp(a) <= 0.0) tmp = exp(a) * 0.5; else tmp = 1.0 / (exp(b) + 1.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 0.0], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(1.0 / N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 0:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\
\end{array}
\end{array}
if (exp.f64 a) < 0.0Initial program 100.0%
Taylor expanded in b around 0
Simplified100.0%
Taylor expanded in a around 0
Simplified100.0%
div-invN/A
metadata-evalN/A
*-lowering-*.f64N/A
exp-lowering-exp.f64100.0
Applied egg-rr100.0%
if 0.0 < (exp.f64 a) Initial program 98.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6498.4
Simplified98.4%
Final simplification98.7%
(FPCore (a b) :precision binary64 (if (<= (exp b) 0.999) 1.0 (/ 1.0 (fma b (fma b (fma b 0.16666666666666666 0.5) 1.0) 2.0))))
double code(double a, double b) {
double tmp;
if (exp(b) <= 0.999) {
tmp = 1.0;
} else {
tmp = 1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (exp(b) <= 0.999) tmp = 1.0; else tmp = Float64(1.0 / fma(b, fma(b, fma(b, 0.16666666666666666, 0.5), 1.0), 2.0)); end return tmp end
code[a_, b_] := If[LessEqual[N[Exp[b], $MachinePrecision], 0.999], 1.0, N[(1.0 / N[(b * N[(b * N[(b * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{b} \leq 0.999:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.16666666666666666, 0.5\right), 1\right), 2\right)}\\
\end{array}
\end{array}
if (exp.f64 b) < 0.998999999999999999Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if 0.998999999999999999 < (exp.f64 b) Initial program 99.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6480.5
Simplified80.5%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6472.2
Simplified72.2%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(if (<= b 2.3e+67)
(* (exp a) 0.5)
(/
1.0
(fma
b
(fma b (/ (fma (* b b) 0.027777777777777776 -0.25) -0.5) 1.0)
2.0)))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 2.3e+67) {
tmp = exp(a) * 0.5;
} else {
tmp = 1.0 / fma(b, fma(b, (fma((b * b), 0.027777777777777776, -0.25) / -0.5), 1.0), 2.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 2.3e+67) tmp = Float64(exp(a) * 0.5); else tmp = Float64(1.0 / fma(b, fma(b, Float64(fma(Float64(b * b), 0.027777777777777776, -0.25) / -0.5), 1.0), 2.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 2.3e+67], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(N[(N[(b * b), $MachinePrecision] * 0.027777777777777776 + -0.25), $MachinePrecision] / -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+67}:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{\mathsf{fma}\left(b \cdot b, 0.027777777777777776, -0.25\right)}{-0.5}, 1\right), 2\right)}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 2.2999999999999999e67Initial program 100.0%
Taylor expanded in b around 0
Simplified94.8%
Taylor expanded in a around 0
Simplified93.2%
div-invN/A
metadata-evalN/A
*-lowering-*.f64N/A
exp-lowering-exp.f6493.2
Applied egg-rr93.2%
if 2.2999999999999999e67 < b Initial program 98.1%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6488.1
Simplified88.1%
flip-+N/A
/-lowering-/.f64N/A
sub-negN/A
swap-sqrN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
accelerator-lowering-fma.f64N/A
metadata-eval88.1
Applied egg-rr88.1%
Taylor expanded in b around 0
Simplified98.3%
(FPCore (a b) :precision binary64 (if (<= (exp b) 0.999) 1.0 0.5))
double code(double a, double b) {
double tmp;
if (exp(b) <= 0.999) {
tmp = 1.0;
} else {
tmp = 0.5;
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (exp(b) <= 0.999d0) then
tmp = 1.0d0
else
tmp = 0.5d0
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (Math.exp(b) <= 0.999) {
tmp = 1.0;
} else {
tmp = 0.5;
}
return tmp;
}
def code(a, b): tmp = 0 if math.exp(b) <= 0.999: tmp = 1.0 else: tmp = 0.5 return tmp
function code(a, b) tmp = 0.0 if (exp(b) <= 0.999) tmp = 1.0; else tmp = 0.5; end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (exp(b) <= 0.999) tmp = 1.0; else tmp = 0.5; end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[Exp[b], $MachinePrecision], 0.999], 1.0, 0.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{b} \leq 0.999:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.5\\
\end{array}
\end{array}
if (exp.f64 b) < 0.998999999999999999Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if 0.998999999999999999 < (exp.f64 b) Initial program 99.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6480.5
Simplified80.5%
Taylor expanded in b around 0
Simplified49.5%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(/
1.0
(fma
b
(fma b (/ (fma (* b b) 0.027777777777777776 -0.25) -0.5) 1.0)
2.0))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else {
tmp = 1.0 / fma(b, fma(b, (fma((b * b), 0.027777777777777776, -0.25) / -0.5), 1.0), 2.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; else tmp = Float64(1.0 / fma(b, fma(b, Float64(fma(Float64(b * b), 0.027777777777777776, -0.25) / -0.5), 1.0), 2.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, N[(1.0 / N[(b * N[(b * N[(N[(N[(b * b), $MachinePrecision] * 0.027777777777777776 + -0.25), $MachinePrecision] / -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, \frac{\mathsf{fma}\left(b \cdot b, 0.027777777777777776, -0.25\right)}{-0.5}, 1\right), 2\right)}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b Initial program 99.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6480.5
Simplified80.5%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6472.2
Simplified72.2%
flip-+N/A
/-lowering-/.f64N/A
sub-negN/A
swap-sqrN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
accelerator-lowering-fma.f64N/A
metadata-eval72.2
Applied egg-rr72.2%
Taylor expanded in b around 0
Simplified74.7%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(if (<= b 2.5)
(fma
b
(fma
(* b b)
(fma (* b b) -0.0020833333333333333 0.020833333333333332)
-0.25)
0.5)
(if (<= b 5.6e+102)
(* a (* a (* a -0.020833333333333332)))
(/ 6.0 (* b (* b b)))))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 2.5) {
tmp = fma(b, fma((b * b), fma((b * b), -0.0020833333333333333, 0.020833333333333332), -0.25), 0.5);
} else if (b <= 5.6e+102) {
tmp = a * (a * (a * -0.020833333333333332));
} else {
tmp = 6.0 / (b * (b * b));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 2.5) tmp = fma(b, fma(Float64(b * b), fma(Float64(b * b), -0.0020833333333333333, 0.020833333333333332), -0.25), 0.5); elseif (b <= 5.6e+102) tmp = Float64(a * Float64(a * Float64(a * -0.020833333333333332))); else tmp = Float64(6.0 / Float64(b * Float64(b * b))); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 2.5], N[(b * N[(N[(b * b), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] * -0.0020833333333333333 + 0.020833333333333332), $MachinePrecision] + -0.25), $MachinePrecision] + 0.5), $MachinePrecision], If[LessEqual[b, 5.6e+102], N[(a * N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 2.5:\\
\;\;\;\;\mathsf{fma}\left(b, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b \cdot b, -0.0020833333333333333, 0.020833333333333332\right), -0.25\right), 0.5\right)\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 2.5Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6471.8
Simplified71.8%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6471.7
Simplified71.7%
if 2.5 < b < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in b around 0
Simplified35.4%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f642.7
Simplified2.7%
Taylor expanded in a around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6441.2
Simplified41.2%
if 5.60000000000000037e102 < b Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in b around inf
/-lowering-/.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(if (<= b 340.0)
(fma b (fma b (* b 0.020833333333333332) -0.25) 0.5)
(if (<= b 5.6e+102)
(* a (* a (* a -0.020833333333333332)))
(/ 6.0 (* b (* b b)))))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 340.0) {
tmp = fma(b, fma(b, (b * 0.020833333333333332), -0.25), 0.5);
} else if (b <= 5.6e+102) {
tmp = a * (a * (a * -0.020833333333333332));
} else {
tmp = 6.0 / (b * (b * b));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 340.0) tmp = fma(b, fma(b, Float64(b * 0.020833333333333332), -0.25), 0.5); elseif (b <= 5.6e+102) tmp = Float64(a * Float64(a * Float64(a * -0.020833333333333332))); else tmp = Float64(6.0 / Float64(b * Float64(b * b))); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 340.0], N[(b * N[(b * N[(b * 0.020833333333333332), $MachinePrecision] + -0.25), $MachinePrecision] + 0.5), $MachinePrecision], If[LessEqual[b, 5.6e+102], N[(a * N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 340:\\
\;\;\;\;\mathsf{fma}\left(b, \mathsf{fma}\left(b, b \cdot 0.020833333333333332, -0.25\right), 0.5\right)\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{b \cdot \left(b \cdot b\right)}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 340Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6471.8
Simplified71.8%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.5
Simplified71.5%
if 340 < b < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in b around 0
Simplified35.4%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f642.7
Simplified2.7%
Taylor expanded in a around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6441.2
Simplified41.2%
if 5.60000000000000037e102 < b Initial program 97.9%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in b around inf
/-lowering-/.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(if (<= b 340.0)
(fma b (fma b (* b 0.020833333333333332) -0.25) 0.5)
(if (<= b 9e+149)
(* a (* a (* a -0.020833333333333332)))
(/ 2.0 (* b b))))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 340.0) {
tmp = fma(b, fma(b, (b * 0.020833333333333332), -0.25), 0.5);
} else if (b <= 9e+149) {
tmp = a * (a * (a * -0.020833333333333332));
} else {
tmp = 2.0 / (b * b);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 340.0) tmp = fma(b, fma(b, Float64(b * 0.020833333333333332), -0.25), 0.5); elseif (b <= 9e+149) tmp = Float64(a * Float64(a * Float64(a * -0.020833333333333332))); else tmp = Float64(2.0 / Float64(b * b)); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 340.0], N[(b * N[(b * N[(b * 0.020833333333333332), $MachinePrecision] + -0.25), $MachinePrecision] + 0.5), $MachinePrecision], If[LessEqual[b, 9e+149], N[(a * N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 340:\\
\;\;\;\;\mathsf{fma}\left(b, \mathsf{fma}\left(b, b \cdot 0.020833333333333332, -0.25\right), 0.5\right)\\
\mathbf{elif}\;b \leq 9 \cdot 10^{+149}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{b \cdot b}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 340Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6471.8
Simplified71.8%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.5
Simplified71.5%
if 340 < b < 8.99999999999999965e149Initial program 97.1%
Taylor expanded in b around 0
Simplified25.2%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f642.8
Simplified2.8%
Taylor expanded in a around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6445.2
Simplified45.2%
if 8.99999999999999965e149 < b Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6491.2
Simplified91.2%
Taylor expanded in b around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6491.2
Simplified91.2%
(FPCore (a b)
:precision binary64
(if (<= b -0.0011)
1.0
(if (<= b 2.0)
(fma -0.25 b 0.5)
(if (<= b 9e+149)
(* a (* a (* a -0.020833333333333332)))
(/ 2.0 (* b b))))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 2.0) {
tmp = fma(-0.25, b, 0.5);
} else if (b <= 9e+149) {
tmp = a * (a * (a * -0.020833333333333332));
} else {
tmp = 2.0 / (b * b);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 2.0) tmp = fma(-0.25, b, 0.5); elseif (b <= 9e+149) tmp = Float64(a * Float64(a * Float64(a * -0.020833333333333332))); else tmp = Float64(2.0 / Float64(b * b)); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 2.0], N[(-0.25 * b + 0.5), $MachinePrecision], If[LessEqual[b, 9e+149], N[(a * N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 / N[(b * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 2:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b, 0.5\right)\\
\mathbf{elif}\;b \leq 9 \cdot 10^{+149}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{b \cdot b}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 2Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6471.8
Simplified71.8%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f6471.3
Simplified71.3%
if 2 < b < 8.99999999999999965e149Initial program 97.1%
Taylor expanded in b around 0
Simplified25.2%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f642.8
Simplified2.8%
Taylor expanded in a around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6445.2
Simplified45.2%
if 8.99999999999999965e149 < b Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6491.2
Simplified91.2%
Taylor expanded in b around inf
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6491.2
Simplified91.2%
(FPCore (a b) :precision binary64 (if (<= b -0.0011) 1.0 (if (<= b 2.0) (fma -0.25 b 0.5) (* a (* a (* a -0.020833333333333332))))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else if (b <= 2.0) {
tmp = fma(-0.25, b, 0.5);
} else {
tmp = a * (a * (a * -0.020833333333333332));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; elseif (b <= 2.0) tmp = fma(-0.25, b, 0.5); else tmp = Float64(a * Float64(a * Float64(a * -0.020833333333333332))); end return tmp end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, If[LessEqual[b, 2.0], N[(-0.25 * b + 0.5), $MachinePrecision], N[(a * N[(a * N[(a * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{elif}\;b \leq 2:\\
\;\;\;\;\mathsf{fma}\left(-0.25, b, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(a \cdot \left(a \cdot -0.020833333333333332\right)\right)\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b < 2Initial program 100.0%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6471.8
Simplified71.8%
Taylor expanded in b around 0
+-commutativeN/A
accelerator-lowering-fma.f6471.3
Simplified71.3%
if 2 < b Initial program 98.5%
Taylor expanded in b around 0
Simplified21.0%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f642.9
Simplified2.9%
Taylor expanded in a around inf
unpow3N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6451.5
Simplified51.5%
(FPCore (a b) :precision binary64 (if (<= b -0.0011) 1.0 (/ 1.0 (+ b 2.0))))
double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else {
tmp = 1.0 / (b + 2.0);
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-0.0011d0)) then
tmp = 1.0d0
else
tmp = 1.0d0 / (b + 2.0d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= -0.0011) {
tmp = 1.0;
} else {
tmp = 1.0 / (b + 2.0);
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -0.0011: tmp = 1.0 else: tmp = 1.0 / (b + 2.0) return tmp
function code(a, b) tmp = 0.0 if (b <= -0.0011) tmp = 1.0; else tmp = Float64(1.0 / Float64(b + 2.0)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -0.0011) tmp = 1.0; else tmp = 1.0 / (b + 2.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -0.0011], 1.0, N[(1.0 / N[(b + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.0011:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b + 2}\\
\end{array}
\end{array}
if b < -0.00110000000000000007Initial program 95.6%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.4
Simplified92.4%
Taylor expanded in a around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
exp-lowering-exp.f6498.7
Simplified98.7%
Taylor expanded in a around inf
Simplified100.0%
if -0.00110000000000000007 < b Initial program 99.5%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6480.5
Simplified80.5%
Taylor expanded in b around 0
+-commutativeN/A
+-lowering-+.f6450.8
Simplified50.8%
(FPCore (a b) :precision binary64 0.5)
double code(double a, double b) {
return 0.5;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 0.5d0
end function
public static double code(double a, double b) {
return 0.5;
}
def code(a, b): return 0.5
function code(a, b) return 0.5 end
function tmp = code(a, b) tmp = 0.5; end
code[a_, b_] := 0.5
\begin{array}{l}
\\
0.5
\end{array}
Initial program 98.8%
Taylor expanded in a around 0
/-lowering-/.f64N/A
+-lowering-+.f64N/A
exp-lowering-exp.f6483.6
Simplified83.6%
Taylor expanded in b around 0
Simplified44.1%
(FPCore (a b) :precision binary64 (/ 1.0 (+ 1.0 (exp (- b a)))))
double code(double a, double b) {
return 1.0 / (1.0 + exp((b - a)));
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 1.0d0 / (1.0d0 + exp((b - a)))
end function
public static double code(double a, double b) {
return 1.0 / (1.0 + Math.exp((b - a)));
}
def code(a, b): return 1.0 / (1.0 + math.exp((b - a)))
function code(a, b) return Float64(1.0 / Float64(1.0 + exp(Float64(b - a)))) end
function tmp = code(a, b) tmp = 1.0 / (1.0 + exp((b - a))); end
code[a_, b_] := N[(1.0 / N[(1.0 + N[Exp[N[(b - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{1 + e^{b - a}}
\end{array}
herbie shell --seed 2024205
(FPCore (a b)
:name "Quotient of sum of exps"
:precision binary64
:alt
(! :herbie-platform default (/ 1 (+ 1 (exp (- b a)))))
(/ (exp a) (+ (exp a) (exp b))))