
(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.998) (/ 1.0 (+ (exp (- a)) 1.0)) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 0.998) {
tmp = 1.0 / (exp(-a) + 1.0);
} 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.998d0) then
tmp = 1.0d0 / (exp(-a) + 1.0d0)
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.998) {
tmp = 1.0 / (Math.exp(-a) + 1.0);
} else {
tmp = 1.0 / (Math.exp(b) + 1.0);
}
return tmp;
}
def code(a, b): tmp = 0 if math.exp(a) <= 0.998: tmp = 1.0 / (math.exp(-a) + 1.0) else: tmp = 1.0 / (math.exp(b) + 1.0) return tmp
function code(a, b) tmp = 0.0 if (exp(a) <= 0.998) tmp = Float64(1.0 / Float64(exp(Float64(-a)) + 1.0)); 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.998) tmp = 1.0 / (exp(-a) + 1.0); else tmp = 1.0 / (exp(b) + 1.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 0.998], N[(1.0 / N[(N[Exp[(-a)], $MachinePrecision] + 1.0), $MachinePrecision]), $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.998:\\
\;\;\;\;\frac{1}{e^{-a} + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\
\end{array}
\end{array}
if (exp.f64 a) < 0.998Initial program 96.8%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6496.9
Applied egg-rr96.9%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6498.4
Simplified98.4%
if 0.998 < (exp.f64 a) Initial program 98.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f6499.4
Simplified99.4%
Final simplification99.2%
(FPCore (a b) :precision binary64 (exp (fma (log (+ (exp a) (exp b))) -1.0 a)))
double code(double a, double b) {
return exp(fma(log((exp(a) + exp(b))), -1.0, a));
}
function code(a, b) return exp(fma(log(Float64(exp(a) + exp(b))), -1.0, a)) end
code[a_, b_] := N[Exp[N[(N[Log[N[(N[Exp[a], $MachinePrecision] + N[Exp[b], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -1.0 + a), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(\log \left(e^{a} + e^{b}\right), -1, a\right)}
\end{array}
Initial program 98.0%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.8
Applied egg-rr98.8%
(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.0%
(FPCore (a b) :precision binary64 (if (<= a -4.2e+24) (* (exp a) 0.5) (/ 1.0 (+ (exp b) 1.0))))
double code(double a, double b) {
double tmp;
if (a <= -4.2e+24) {
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 (a <= (-4.2d+24)) 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 (a <= -4.2e+24) {
tmp = Math.exp(a) * 0.5;
} else {
tmp = 1.0 / (Math.exp(b) + 1.0);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -4.2e+24: 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 (a <= -4.2e+24) 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 (a <= -4.2e+24) tmp = exp(a) * 0.5; else tmp = 1.0 / (exp(b) + 1.0); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -4.2e+24], 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}\;a \leq -4.2 \cdot 10^{+24}:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{b} + 1}\\
\end{array}
\end{array}
if a < -4.2000000000000003e24Initial program 98.3%
Taylor expanded in b around 0
Simplified100.0%
Taylor expanded in a around 0
Simplified100.0%
lift-exp.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f64100.0
Applied egg-rr100.0%
if -4.2000000000000003e24 < a Initial program 97.9%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f6498.7
Simplified98.7%
Final simplification99.0%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* b (* b b))))
(if (<= b -7400.0)
(+ (exp b) 1.0)
(if (<= b 1.3e+32)
(* (exp a) 0.5)
(/ 1.0 (* b (* b (* b (* t_0 t_0)))))))))
double code(double a, double b) {
double t_0 = b * (b * b);
double tmp;
if (b <= -7400.0) {
tmp = exp(b) + 1.0;
} else if (b <= 1.3e+32) {
tmp = exp(a) * 0.5;
} else {
tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_0
real(8) :: tmp
t_0 = b * (b * b)
if (b <= (-7400.0d0)) then
tmp = exp(b) + 1.0d0
else if (b <= 1.3d+32) then
tmp = exp(a) * 0.5d0
else
tmp = 1.0d0 / (b * (b * (b * (t_0 * t_0))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = b * (b * b);
double tmp;
if (b <= -7400.0) {
tmp = Math.exp(b) + 1.0;
} else if (b <= 1.3e+32) {
tmp = Math.exp(a) * 0.5;
} else {
tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
}
return tmp;
}
def code(a, b): t_0 = b * (b * b) tmp = 0 if b <= -7400.0: tmp = math.exp(b) + 1.0 elif b <= 1.3e+32: tmp = math.exp(a) * 0.5 else: tmp = 1.0 / (b * (b * (b * (t_0 * t_0)))) return tmp
function code(a, b) t_0 = Float64(b * Float64(b * b)) tmp = 0.0 if (b <= -7400.0) tmp = Float64(exp(b) + 1.0); elseif (b <= 1.3e+32) tmp = Float64(exp(a) * 0.5); else tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0))))); end return tmp end
function tmp_2 = code(a, b) t_0 = b * (b * b); tmp = 0.0; if (b <= -7400.0) tmp = exp(b) + 1.0; elseif (b <= 1.3e+32) tmp = exp(a) * 0.5; else tmp = 1.0 / (b * (b * (b * (t_0 * t_0)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -7400.0], N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[b, 1.3e+32], N[(N[Exp[a], $MachinePrecision] * 0.5), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;b \leq -7400:\\
\;\;\;\;e^{b} + 1\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{+32}:\\
\;\;\;\;e^{a} \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
\end{array}
\end{array}
if b < -7400Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Applied egg-rr100.0%
if -7400 < b < 1.3000000000000001e32Initial program 98.5%
Taylor expanded in b around 0
Simplified95.1%
Taylor expanded in a around 0
Simplified93.9%
lift-exp.f64N/A
div-invN/A
metadata-evalN/A
lower-*.f6493.9
Applied egg-rr93.9%
if 1.3000000000000001e32 < b Initial program 97.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f645.6
Simplified5.6%
flip3-+N/A
associate-/r/N/A
lift-*.f64N/A
flip-+N/A
frac-timesN/A
lower-/.f64N/A
Applied egg-rr7.6%
Taylor expanded in b around -inf
lower-/.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.7
Simplified98.7%
Final simplification96.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* b (* b b))))
(if (<= b -7400.0)
(+ (exp b) 1.0)
(if (<= b 6.5e+18)
(/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
(/ 1.0 (* b (* b (* b (* t_0 t_0)))))))))
double code(double a, double b) {
double t_0 = b * (b * b);
double tmp;
if (b <= -7400.0) {
tmp = exp(b) + 1.0;
} else if (b <= 6.5e+18) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
} else {
tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
}
return tmp;
}
function code(a, b) t_0 = Float64(b * Float64(b * b)) tmp = 0.0 if (b <= -7400.0) tmp = Float64(exp(b) + 1.0); elseif (b <= 6.5e+18) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0)); else tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0))))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -7400.0], N[(N[Exp[b], $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;b \leq -7400:\\
\;\;\;\;e^{b} + 1\\
\mathbf{elif}\;b \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
\end{array}
\end{array}
if b < -7400Initial program 98.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Applied egg-rr100.0%
if -7400 < b < 6.5e18Initial program 98.5%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.5
Applied egg-rr98.5%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6496.5
Simplified96.5%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.3
Simplified86.3%
if 6.5e18 < b Initial program 97.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f645.5
Simplified5.5%
flip3-+N/A
associate-/r/N/A
lift-*.f64N/A
flip-+N/A
frac-timesN/A
lower-/.f64N/A
Applied egg-rr7.5%
Taylor expanded in b around -inf
lower-/.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.0
Simplified96.0%
Final simplification91.6%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* b (* b b))))
(if (<= b 6.5e+18)
(/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
(/ 1.0 (* b (* b (* b (* t_0 t_0))))))))
double code(double a, double b) {
double t_0 = b * (b * b);
double tmp;
if (b <= 6.5e+18) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
} else {
tmp = 1.0 / (b * (b * (b * (t_0 * t_0))));
}
return tmp;
}
function code(a, b) t_0 = Float64(b * Float64(b * b)) tmp = 0.0 if (b <= 6.5e+18) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0)); else tmp = Float64(1.0 / Float64(b * Float64(b * Float64(b * Float64(t_0 * t_0))))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)\right)}\\
\end{array}
\end{array}
if b < 6.5e18Initial program 98.4%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.4
Applied egg-rr98.4%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6475.5
Simplified75.5%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.1
Simplified68.1%
if 6.5e18 < b Initial program 97.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f645.5
Simplified5.5%
flip3-+N/A
associate-/r/N/A
lift-*.f64N/A
flip-+N/A
frac-timesN/A
lower-/.f64N/A
Applied egg-rr7.5%
Taylor expanded in b around -inf
lower-/.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.0
Simplified96.0%
Final simplification75.7%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* b (* b b))))
(if (<= b 6.5e+18)
(/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0))
(/ 1.0 (* b (* b (* t_0 t_0)))))))
double code(double a, double b) {
double t_0 = b * (b * b);
double tmp;
if (b <= 6.5e+18) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
} else {
tmp = 1.0 / (b * (b * (t_0 * t_0)));
}
return tmp;
}
function code(a, b) t_0 = Float64(b * Float64(b * b)) tmp = 0.0 if (b <= 6.5e+18) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0)); else tmp = Float64(1.0 / Float64(b * Float64(b * Float64(t_0 * t_0)))); end return tmp end
code[a_, b_] := Block[{t$95$0 = N[(b * N[(b * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, 6.5e+18], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := b \cdot \left(b \cdot b\right)\\
\mathbf{if}\;b \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(b \cdot \left(t\_0 \cdot t\_0\right)\right)}\\
\end{array}
\end{array}
if b < 6.5e18Initial program 98.4%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.4
Applied egg-rr98.4%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6475.5
Simplified75.5%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.1
Simplified68.1%
if 6.5e18 < b Initial program 97.1%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f645.5
Simplified5.5%
flip3-+N/A
associate-/r/N/A
lift-*.f64N/A
flip-+N/A
frac-timesN/A
lower-/.f64N/A
Applied egg-rr7.5%
Taylor expanded in b around inf
lower-/.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.0
Simplified96.0%
Final simplification75.7%
(FPCore (a b) :precision binary64 (if (<= b 7.6e+59) (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0)) (/ -16.0 (* (fma b (* b b) 8.0) (+ (* b b) (- (* b 2.0) 4.0))))))
double code(double a, double b) {
double tmp;
if (b <= 7.6e+59) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
} else {
tmp = -16.0 / (fma(b, (b * b), 8.0) * ((b * b) + ((b * 2.0) - 4.0)));
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= 7.6e+59) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0)); else tmp = Float64(-16.0 / Float64(fma(b, Float64(b * b), 8.0) * Float64(Float64(b * b) + Float64(Float64(b * 2.0) - 4.0)))); end return tmp end
code[a_, b_] := If[LessEqual[b, 7.6e+59], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(-16.0 / N[(N[(b * N[(b * b), $MachinePrecision] + 8.0), $MachinePrecision] * N[(N[(b * b), $MachinePrecision] + N[(N[(b * 2.0), $MachinePrecision] - 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.6 \cdot 10^{+59}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-16}{\mathsf{fma}\left(b, b \cdot b, 8\right) \cdot \left(b \cdot b + \left(b \cdot 2 - 4\right)\right)}\\
\end{array}
\end{array}
if b < 7.6000000000000002e59Initial program 97.9%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.5
Applied egg-rr98.5%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6474.3
Simplified74.3%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6466.6
Simplified66.6%
if 7.6000000000000002e59 < b Initial program 98.4%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f645.7
Simplified5.7%
flip3-+N/A
associate-/r/N/A
lift-*.f64N/A
flip-+N/A
frac-timesN/A
lower-/.f64N/A
Applied egg-rr7.9%
Taylor expanded in b around 0
Simplified98.6%
Final simplification74.6%
(FPCore (a b) :precision binary64 (if (<= b 1.08e+80) (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.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 (b <= 1.08e+80) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.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 (b <= 1.08e+80) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.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[b, 1.08e+80], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], 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}\;b \leq 1.08 \cdot 10^{+80}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\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 b < 1.08e80Initial program 98.0%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.5
Applied egg-rr98.5%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6473.2
Simplified73.2%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6465.8
Simplified65.8%
if 1.08e80 < b Initial program 98.2%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6495.1
Simplified95.1%
(FPCore (a b) :precision binary64 (if (<= b 2.45e+148) (/ 1.0 (fma a (fma a (fma a -0.16666666666666666 0.5) -1.0) 2.0)) (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
double code(double a, double b) {
double tmp;
if (b <= 2.45e+148) {
tmp = 1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0);
} else {
tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= 2.45e+148) tmp = Float64(1.0 / fma(a, fma(a, fma(a, -0.16666666666666666, 0.5), -1.0), 2.0)); else tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, 2.45e+148], N[(1.0 / N[(a * N[(a * N[(a * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * 0.5 + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(a, \mathsf{fma}\left(a, -0.16666666666666666, 0.5\right), -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\
\end{array}
\end{array}
if b < 2.45e148Initial program 98.1%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.6
Applied egg-rr98.6%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6469.2
Simplified69.2%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6461.9
Simplified61.9%
if 2.45e148 < b Initial program 97.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6495.8
Simplified95.8%
(FPCore (a b) :precision binary64 (if (<= b 2.45e+148) (/ 1.0 (fma a (fma 0.5 a -1.0) 2.0)) (/ 1.0 (fma b (fma b 0.5 1.0) 2.0))))
double code(double a, double b) {
double tmp;
if (b <= 2.45e+148) {
tmp = 1.0 / fma(a, fma(0.5, a, -1.0), 2.0);
} else {
tmp = 1.0 / fma(b, fma(b, 0.5, 1.0), 2.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= 2.45e+148) tmp = Float64(1.0 / fma(a, fma(0.5, a, -1.0), 2.0)); else tmp = Float64(1.0 / fma(b, fma(b, 0.5, 1.0), 2.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, 2.45e+148], N[(1.0 / N[(a * N[(0.5 * a + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(b * 0.5 + 1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.45 \cdot 10^{+148}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(b, \mathsf{fma}\left(b, 0.5, 1\right), 2\right)}\\
\end{array}
\end{array}
if b < 2.45e148Initial program 98.1%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.6
Applied egg-rr98.6%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6469.2
Simplified69.2%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6458.7
Simplified58.7%
if 2.45e148 < b Initial program 97.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6495.8
Simplified95.8%
(FPCore (a b) :precision binary64 (if (<= b 2.5e+148) (/ 1.0 (fma a (fma 0.5 a -1.0) 2.0)) (/ (+ b -2.0) (fma b b -4.0))))
double code(double a, double b) {
double tmp;
if (b <= 2.5e+148) {
tmp = 1.0 / fma(a, fma(0.5, a, -1.0), 2.0);
} else {
tmp = (b + -2.0) / fma(b, b, -4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= 2.5e+148) tmp = Float64(1.0 / fma(a, fma(0.5, a, -1.0), 2.0)); else tmp = Float64(Float64(b + -2.0) / fma(b, b, -4.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, 2.5e+148], N[(1.0 / N[(a * N[(0.5 * a + -1.0), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(b + -2.0), $MachinePrecision] / N[(b * b + -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.5 \cdot 10^{+148}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(a, \mathsf{fma}\left(0.5, a, -1\right), 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\
\end{array}
\end{array}
if b < 2.50000000000000012e148Initial program 98.1%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.6
Applied egg-rr98.6%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6469.2
Simplified69.2%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6458.7
Simplified58.7%
if 2.50000000000000012e148 < b Initial program 97.6%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f646.5
Simplified6.5%
flip-+N/A
clear-numN/A
lower-/.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval95.5
Applied egg-rr95.5%
(FPCore (a b) :precision binary64 (if (<= b 4e-64) (/ 1.0 (- 2.0 a)) (/ (+ b -2.0) (fma b b -4.0))))
double code(double a, double b) {
double tmp;
if (b <= 4e-64) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = (b + -2.0) / fma(b, b, -4.0);
}
return tmp;
}
function code(a, b) tmp = 0.0 if (b <= 4e-64) tmp = Float64(1.0 / Float64(2.0 - a)); else tmp = Float64(Float64(b + -2.0) / fma(b, b, -4.0)); end return tmp end
code[a_, b_] := If[LessEqual[b, 4e-64], N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision], N[(N[(b + -2.0), $MachinePrecision] / N[(b * b + -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{-64}:\\
\;\;\;\;\frac{1}{2 - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{b + -2}{\mathsf{fma}\left(b, b, -4\right)}\\
\end{array}
\end{array}
if b < 3.99999999999999986e-64Initial program 98.8%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.8
Applied egg-rr98.8%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6474.5
Simplified74.5%
Taylor expanded in a around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6452.1
Simplified52.1%
if 3.99999999999999986e-64 < b Initial program 96.5%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f6499.0
Simplified99.0%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6417.7
Simplified17.7%
flip-+N/A
clear-numN/A
lower-/.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-evalN/A
lift-*.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
metadata-evalN/A
metadata-eval61.1
Applied egg-rr61.1%
(FPCore (a b) :precision binary64 (/ 1.0 (- 2.0 a)))
double code(double a, double b) {
return 1.0 / (2.0 - a);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 1.0d0 / (2.0d0 - a)
end function
public static double code(double a, double b) {
return 1.0 / (2.0 - a);
}
def code(a, b): return 1.0 / (2.0 - a)
function code(a, b) return Float64(1.0 / Float64(2.0 - a)) end
function tmp = code(a, b) tmp = 1.0 / (2.0 - a); end
code[a_, b_] := N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{2 - a}
\end{array}
Initial program 98.0%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.8
Applied egg-rr98.8%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6462.9
Simplified62.9%
Taylor expanded in a around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6439.9
Simplified39.9%
(FPCore (a b) :precision binary64 (fma 0.25 a 0.5))
double code(double a, double b) {
return fma(0.25, a, 0.5);
}
function code(a, b) return fma(0.25, a, 0.5) end
code[a_, b_] := N[(0.25 * a + 0.5), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.25, a, 0.5\right)
\end{array}
Initial program 98.0%
lift-exp.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
clear-numN/A
associate-/r/N/A
inv-powN/A
pow-to-expN/A
lift-exp.f64N/A
prod-expN/A
lower-exp.f64N/A
lower-fma.f64N/A
lower-log.f6498.8
Applied egg-rr98.8%
Taylor expanded in b around 0
mul-1-negN/A
unsub-negN/A
exp-diffN/A
remove-double-divN/A
exp-negN/A
rem-exp-logN/A
associate-/r*N/A
lower-/.f64N/A
+-commutativeN/A
distribute-lft-inN/A
exp-negN/A
lft-mult-inverseN/A
*-rgt-identityN/A
lower-+.f64N/A
neg-mul-1N/A
lower-exp.f64N/A
neg-mul-1N/A
lower-neg.f6462.9
Simplified62.9%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f6439.3
Simplified39.3%
(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.0%
Taylor expanded in a around 0
lower-/.f64N/A
lower-+.f64N/A
lower-exp.f6484.2
Simplified84.2%
Taylor expanded in b around 0
Simplified39.3%
(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 2024214
(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))))