
(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 18 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 (/ 1.0 (+ 1.0 (pow E (- b a)))))
double code(double a, double b) {
return 1.0 / (1.0 + pow(((double) M_E), (b - a)));
}
public static double code(double a, double b) {
return 1.0 / (1.0 + Math.pow(Math.E, (b - a)));
}
def code(a, b): return 1.0 / (1.0 + math.pow(math.e, (b - a)))
function code(a, b) return Float64(1.0 / Float64(1.0 + (exp(1) ^ Float64(b - a)))) end
function tmp = code(a, b) tmp = 1.0 / (1.0 + (2.71828182845904523536 ^ (b - a))); end
code[a_, b_] := N[(1.0 / N[(1.0 + N[Power[E, N[(b - a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{1 + {e}^{\left(b - a\right)}}
\end{array}
Initial program 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub74.6%
*-lft-identity74.6%
associate-*l/74.6%
lft-mult-inverse99.6%
sub-neg99.6%
distribute-frac-neg99.6%
remove-double-neg99.6%
div-exp99.9%
Simplified99.9%
*-un-lft-identity99.9%
exp-prod100.0%
Applied egg-rr100.0%
exp-1-e100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (a b) :precision binary64 (if (<= (exp a) 1e-245) (/ 1.0 (+ 1.0 (exp (- a)))) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 1e-245) {
tmp = 1.0 / (1.0 + exp(-a));
} else {
tmp = 1.0 / (1.0 + exp(b));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (exp(a) <= 1d-245) then
tmp = 1.0d0 / (1.0d0 + exp(-a))
else
tmp = 1.0d0 / (1.0d0 + exp(b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (Math.exp(a) <= 1e-245) {
tmp = 1.0 / (1.0 + Math.exp(-a));
} else {
tmp = 1.0 / (1.0 + Math.exp(b));
}
return tmp;
}
def code(a, b): tmp = 0 if math.exp(a) <= 1e-245: tmp = 1.0 / (1.0 + math.exp(-a)) else: tmp = 1.0 / (1.0 + math.exp(b)) return tmp
function code(a, b) tmp = 0.0 if (exp(a) <= 1e-245) tmp = Float64(1.0 / Float64(1.0 + exp(Float64(-a)))); else tmp = Float64(1.0 / Float64(1.0 + exp(b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (exp(a) <= 1e-245) tmp = 1.0 / (1.0 + exp(-a)); else tmp = 1.0 / (1.0 + exp(b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 1e-245], N[(1.0 / N[(1.0 + N[Exp[(-a)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(1.0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 10^{-245}:\\
\;\;\;\;\frac{1}{1 + e^{-a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\
\end{array}
\end{array}
if (exp.f64 a) < 9.9999999999999993e-246Initial program 98.5%
*-lft-identity98.5%
associate-*l/98.5%
associate-/r/98.5%
remove-double-neg98.5%
unsub-neg98.5%
div-sub1.5%
*-lft-identity1.5%
associate-*l/1.5%
lft-mult-inverse98.5%
sub-neg98.5%
distribute-frac-neg98.5%
remove-double-neg98.5%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 99.5%
+-commutative99.5%
Simplified99.5%
if 9.9999999999999993e-246 < (exp.f64 a) Initial program 99.5%
*-lft-identity99.5%
associate-*l/99.5%
associate-/r/99.5%
remove-double-neg99.5%
unsub-neg99.5%
div-sub99.5%
*-lft-identity99.5%
associate-*l/99.5%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in a around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification98.0%
(FPCore (a b) :precision binary64 (if (<= (exp a) 1e-245) (/ (exp a) 2.0) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 1e-245) {
tmp = exp(a) / 2.0;
} else {
tmp = 1.0 / (1.0 + exp(b));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (exp(a) <= 1d-245) then
tmp = exp(a) / 2.0d0
else
tmp = 1.0d0 / (1.0d0 + exp(b))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (Math.exp(a) <= 1e-245) {
tmp = Math.exp(a) / 2.0;
} else {
tmp = 1.0 / (1.0 + Math.exp(b));
}
return tmp;
}
def code(a, b): tmp = 0 if math.exp(a) <= 1e-245: tmp = math.exp(a) / 2.0 else: tmp = 1.0 / (1.0 + math.exp(b)) return tmp
function code(a, b) tmp = 0.0 if (exp(a) <= 1e-245) tmp = Float64(exp(a) / 2.0); else tmp = Float64(1.0 / Float64(1.0 + exp(b))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (exp(a) <= 1e-245) tmp = exp(a) / 2.0; else tmp = 1.0 / (1.0 + exp(b)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[N[Exp[a], $MachinePrecision], 1e-245], N[(N[Exp[a], $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 / N[(1.0 + N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{a} \leq 10^{-245}:\\
\;\;\;\;\frac{e^{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\
\end{array}
\end{array}
if (exp.f64 a) < 9.9999999999999993e-246Initial program 98.5%
Taylor expanded in b around 0 99.5%
Taylor expanded in a around 0 98.8%
if 9.9999999999999993e-246 < (exp.f64 a) Initial program 99.5%
*-lft-identity99.5%
associate-*l/99.5%
associate-/r/99.5%
remove-double-neg99.5%
unsub-neg99.5%
div-sub99.5%
*-lft-identity99.5%
associate-*l/99.5%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in a around 0 97.5%
+-commutative97.5%
Simplified97.5%
Final simplification97.8%
(FPCore (a b) :precision binary64 (if (<= b 1.26e+168) (/ (exp a) 2.0) (/ 1.0 (* a (+ -1.0 (- (/ (+ b 2.0) a) b))))))
double code(double a, double b) {
double tmp;
if (b <= 1.26e+168) {
tmp = exp(a) / 2.0;
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 1.26d+168) then
tmp = exp(a) / 2.0d0
else
tmp = 1.0d0 / (a * ((-1.0d0) + (((b + 2.0d0) / a) - b)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1.26e+168) {
tmp = Math.exp(a) / 2.0;
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.26e+168: tmp = math.exp(a) / 2.0 else: tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.26e+168) tmp = Float64(exp(a) / 2.0); else tmp = Float64(1.0 / Float64(a * Float64(-1.0 + Float64(Float64(Float64(b + 2.0) / a) - b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.26e+168) tmp = exp(a) / 2.0; else tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.26e+168], N[(N[Exp[a], $MachinePrecision] / 2.0), $MachinePrecision], N[(1.0 / N[(a * N[(-1.0 + N[(N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.26 \cdot 10^{+168}:\\
\;\;\;\;\frac{e^{a}}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 + \left(\frac{b + 2}{a} - b\right)\right)}\\
\end{array}
\end{array}
if b < 1.26000000000000006e168Initial program 99.1%
Taylor expanded in b around 0 72.6%
Taylor expanded in a around 0 70.6%
if 1.26000000000000006e168 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 26.2%
+-commutative26.2%
distribute-rgt1-in26.2%
Simplified26.2%
Taylor expanded in a around 0 26.2%
associate-+r+26.2%
+-commutative26.2%
mul-1-neg26.2%
distribute-rgt-neg-in26.2%
mul-1-neg26.2%
distribute-lft-in26.2%
metadata-eval26.2%
mul-1-neg26.2%
unsub-neg26.2%
Simplified26.2%
Taylor expanded in a around -inf 81.1%
associate-*r*81.1%
neg-mul-181.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification72.0%
(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}
Initial program 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub74.6%
*-lft-identity74.6%
associate-*l/74.6%
lft-mult-inverse99.6%
sub-neg99.6%
distribute-frac-neg99.6%
remove-double-neg99.6%
div-exp99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (a b)
:precision binary64
(if (<= b -5.2e-192)
(/ 1.0 (+ 2.0 (* a (+ -1.0 (* a (+ 0.5 (* a -0.16666666666666666)))))))
(if (<= b 5e-239)
(/ 1.0 (- (+ b 2.0) (* b (+ a (/ a b)))))
(if (<= b 1.26e+168)
(/
1.0
(+
2.0
(+
b
(*
a
(+
(- -1.0 b)
(*
a
(+
(* 0.5 (+ 1.0 b))
(* -0.16666666666666666 (* a (+ 1.0 b))))))))))
(/ -1.0 (* a (+ 1.0 (- b (/ (+ b 2.0) a)))))))))
double code(double a, double b) {
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))))));
} else if (b <= 5e-239) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((0.5 * (1.0 + b)) + (-0.16666666666666666 * (a * (1.0 + b)))))))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-5.2d-192)) then
tmp = 1.0d0 / (2.0d0 + (a * ((-1.0d0) + (a * (0.5d0 + (a * (-0.16666666666666666d0)))))))
else if (b <= 5d-239) then
tmp = 1.0d0 / ((b + 2.0d0) - (b * (a + (a / b))))
else if (b <= 1.26d+168) then
tmp = 1.0d0 / (2.0d0 + (b + (a * (((-1.0d0) - b) + (a * ((0.5d0 * (1.0d0 + b)) + ((-0.16666666666666666d0) * (a * (1.0d0 + b)))))))))
else
tmp = (-1.0d0) / (a * (1.0d0 + (b - ((b + 2.0d0) / a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))))));
} else if (b <= 5e-239) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((0.5 * (1.0 + b)) + (-0.16666666666666666 * (a * (1.0 + b)))))))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -5.2e-192: tmp = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))))) elif b <= 5e-239: tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))) elif b <= 1.26e+168: tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((0.5 * (1.0 + b)) + (-0.16666666666666666 * (a * (1.0 + b))))))))) else: tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))) return tmp
function code(a, b) tmp = 0.0 if (b <= -5.2e-192) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(-1.0 + Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))))))); elseif (b <= 5e-239) tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * Float64(a + Float64(a / b))))); elseif (b <= 1.26e+168) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(-1.0 - b) + Float64(a * Float64(Float64(0.5 * Float64(1.0 + b)) + Float64(-0.16666666666666666 * Float64(a * Float64(1.0 + b)))))))))); else tmp = Float64(-1.0 / Float64(a * Float64(1.0 + Float64(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -5.2e-192) tmp = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))))); elseif (b <= 5e-239) tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))); elseif (b <= 1.26e+168) tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((0.5 * (1.0 + b)) + (-0.16666666666666666 * (a * (1.0 + b))))))))); else tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -5.2e-192], N[(1.0 / N[(2.0 + N[(a * N[(-1.0 + N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e-239], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e+168], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(-1.0 - b), $MachinePrecision] + N[(a * N[(N[(0.5 * N[(1.0 + b), $MachinePrecision]), $MachinePrecision] + N[(-0.16666666666666666 * N[(a * N[(1.0 + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(a * N[(1.0 + N[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.2 \cdot 10^{-192}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(-1 + a \cdot \left(0.5 + a \cdot -0.16666666666666666\right)\right)}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-239}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot \left(a + \frac{a}{b}\right)}\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(\left(-1 - b\right) + a \cdot \left(0.5 \cdot \left(1 + b\right) + -0.16666666666666666 \cdot \left(a \cdot \left(1 + b\right)\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -5.2000000000000003e-192Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub82.1%
*-lft-identity82.1%
associate-*l/82.1%
lft-mult-inverse98.7%
sub-neg98.7%
distribute-frac-neg98.7%
remove-double-neg98.7%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in a around 0 47.6%
if -5.2000000000000003e-192 < b < 5e-239Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub59.2%
*-lft-identity59.2%
associate-*l/59.2%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 77.6%
+-commutative77.6%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in a around 0 59.8%
associate-+r+59.8%
+-commutative59.8%
mul-1-neg59.8%
distribute-rgt-neg-in59.8%
mul-1-neg59.8%
distribute-lft-in59.8%
metadata-eval59.8%
mul-1-neg59.8%
unsub-neg59.8%
Simplified59.8%
Taylor expanded in b around inf 96.4%
mul-1-neg96.4%
unsub-neg96.4%
neg-mul-196.4%
Simplified96.4%
if 5e-239 < b < 1.26000000000000006e168Initial program 98.9%
*-lft-identity98.9%
associate-*l/98.9%
associate-/r/98.9%
remove-double-neg98.9%
unsub-neg98.9%
div-sub74.5%
*-lft-identity74.5%
associate-*l/74.5%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 75.1%
+-commutative75.1%
distribute-rgt1-in75.1%
Simplified75.1%
Taylor expanded in a around 0 66.3%
if 1.26000000000000006e168 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 26.2%
+-commutative26.2%
distribute-rgt1-in26.2%
Simplified26.2%
Taylor expanded in a around 0 26.2%
associate-+r+26.2%
+-commutative26.2%
mul-1-neg26.2%
distribute-rgt-neg-in26.2%
mul-1-neg26.2%
distribute-lft-in26.2%
metadata-eval26.2%
mul-1-neg26.2%
unsub-neg26.2%
Simplified26.2%
Taylor expanded in a around -inf 81.1%
associate-*r*81.1%
neg-mul-181.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification68.4%
(FPCore (a b)
:precision binary64
(if (<= b -1.15)
(/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0))))
(if (<= b 1.26e+168)
(/
1.0
(+
2.0
(+
b
(*
a
(+
(- -1.0 b)
(*
a
(+
(* b (* -0.16666666666666666 (+ a (/ a b))))
(* 0.5 (+ 1.0 b)))))))))
(/ 1.0 (* a (+ -1.0 (- (/ (+ b 2.0) a) b)))))))
double code(double a, double b) {
double tmp;
if (b <= -1.15) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((b * (-0.16666666666666666 * (a + (a / b)))) + (0.5 * (1.0 + b))))))));
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-1.15d0)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else if (b <= 1.26d+168) then
tmp = 1.0d0 / (2.0d0 + (b + (a * (((-1.0d0) - b) + (a * ((b * ((-0.16666666666666666d0) * (a + (a / b)))) + (0.5d0 * (1.0d0 + b))))))))
else
tmp = 1.0d0 / (a * ((-1.0d0) + (((b + 2.0d0) / a) - b)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= -1.15) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((b * (-0.16666666666666666 * (a + (a / b)))) + (0.5 * (1.0 + b))))))));
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -1.15: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) elif b <= 1.26e+168: tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((b * (-0.16666666666666666 * (a + (a / b)))) + (0.5 * (1.0 + b)))))))) else: tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))) return tmp
function code(a, b) tmp = 0.0 if (b <= -1.15) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); elseif (b <= 1.26e+168) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(-1.0 - b) + Float64(a * Float64(Float64(b * Float64(-0.16666666666666666 * Float64(a + Float64(a / b)))) + Float64(0.5 * Float64(1.0 + b))))))))); else tmp = Float64(1.0 / Float64(a * Float64(-1.0 + Float64(Float64(Float64(b + 2.0) / a) - b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -1.15) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); elseif (b <= 1.26e+168) tmp = 1.0 / (2.0 + (b + (a * ((-1.0 - b) + (a * ((b * (-0.16666666666666666 * (a + (a / b)))) + (0.5 * (1.0 + b)))))))); else tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -1.15], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e+168], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(-1.0 - b), $MachinePrecision] + N[(a * N[(N[(b * N[(-0.16666666666666666 * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(1.0 + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(-1.0 + N[(N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.15:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(\left(-1 - b\right) + a \cdot \left(b \cdot \left(-0.16666666666666666 \cdot \left(a + \frac{a}{b}\right)\right) + 0.5 \cdot \left(1 + b\right)\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 + \left(\frac{b + 2}{a} - b\right)\right)}\\
\end{array}
\end{array}
if b < -1.1499999999999999Initial program 97.7%
*-lft-identity97.7%
associate-*l/97.7%
associate-/r/97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
*-lft-identity97.7%
associate-*l/97.7%
lft-mult-inverse97.7%
sub-neg97.7%
distribute-frac-neg97.7%
remove-double-neg97.7%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 20.6%
+-commutative20.6%
Simplified20.6%
Taylor expanded in a around 0 20.6%
if -1.1499999999999999 < b < 1.26000000000000006e168Initial program 99.4%
*-lft-identity99.4%
associate-*l/99.4%
associate-/r/99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub68.0%
*-lft-identity68.0%
associate-*l/68.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 73.1%
+-commutative73.1%
distribute-rgt1-in86.6%
Simplified86.6%
Taylor expanded in a around 0 74.0%
Taylor expanded in b around inf 78.2%
distribute-lft-out78.2%
Simplified78.2%
if 1.26000000000000006e168 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 26.2%
+-commutative26.2%
distribute-rgt1-in26.2%
Simplified26.2%
Taylor expanded in a around 0 26.2%
associate-+r+26.2%
+-commutative26.2%
mul-1-neg26.2%
distribute-rgt-neg-in26.2%
mul-1-neg26.2%
distribute-lft-in26.2%
metadata-eval26.2%
mul-1-neg26.2%
unsub-neg26.2%
Simplified26.2%
Taylor expanded in a around -inf 81.1%
associate-*r*81.1%
neg-mul-181.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification68.9%
(FPCore (a b)
:precision binary64
(let* ((t_0 (+ -1.0 (* a (+ 0.5 (* a -0.16666666666666666))))))
(if (<= b -1e-191)
(/ 1.0 (+ 2.0 (* a t_0)))
(if (<= b 7.5e-79)
(/ 1.0 (- (+ b 2.0) (* b (+ a (/ a b)))))
(if (<= b 1.26e+168)
(/ 1.0 (+ 2.0 (+ b (* a (* b t_0)))))
(/ -1.0 (* a (+ 1.0 (- b (/ (+ b 2.0) a))))))))))
double code(double a, double b) {
double t_0 = -1.0 + (a * (0.5 + (a * -0.16666666666666666)));
double tmp;
if (b <= -1e-191) {
tmp = 1.0 / (2.0 + (a * t_0));
} else if (b <= 7.5e-79) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * (b * t_0))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
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 = (-1.0d0) + (a * (0.5d0 + (a * (-0.16666666666666666d0))))
if (b <= (-1d-191)) then
tmp = 1.0d0 / (2.0d0 + (a * t_0))
else if (b <= 7.5d-79) then
tmp = 1.0d0 / ((b + 2.0d0) - (b * (a + (a / b))))
else if (b <= 1.26d+168) then
tmp = 1.0d0 / (2.0d0 + (b + (a * (b * t_0))))
else
tmp = (-1.0d0) / (a * (1.0d0 + (b - ((b + 2.0d0) / a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = -1.0 + (a * (0.5 + (a * -0.16666666666666666)));
double tmp;
if (b <= -1e-191) {
tmp = 1.0 / (2.0 + (a * t_0));
} else if (b <= 7.5e-79) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (2.0 + (b + (a * (b * t_0))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): t_0 = -1.0 + (a * (0.5 + (a * -0.16666666666666666))) tmp = 0 if b <= -1e-191: tmp = 1.0 / (2.0 + (a * t_0)) elif b <= 7.5e-79: tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))) elif b <= 1.26e+168: tmp = 1.0 / (2.0 + (b + (a * (b * t_0)))) else: tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))) return tmp
function code(a, b) t_0 = Float64(-1.0 + Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666)))) tmp = 0.0 if (b <= -1e-191) tmp = Float64(1.0 / Float64(2.0 + Float64(a * t_0))); elseif (b <= 7.5e-79) tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * Float64(a + Float64(a / b))))); elseif (b <= 1.26e+168) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(b * t_0))))); else tmp = Float64(-1.0 / Float64(a * Float64(1.0 + Float64(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) t_0 = -1.0 + (a * (0.5 + (a * -0.16666666666666666))); tmp = 0.0; if (b <= -1e-191) tmp = 1.0 / (2.0 + (a * t_0)); elseif (b <= 7.5e-79) tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))); elseif (b <= 1.26e+168) tmp = 1.0 / (2.0 + (b + (a * (b * t_0)))); else tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(-1.0 + N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1e-191], N[(1.0 / N[(2.0 + N[(a * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.5e-79], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e+168], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(b * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(a * N[(1.0 + N[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1 + a \cdot \left(0.5 + a \cdot -0.16666666666666666\right)\\
\mathbf{if}\;b \leq -1 \cdot 10^{-191}:\\
\;\;\;\;\frac{1}{2 + a \cdot t\_0}\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{-79}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot \left(a + \frac{a}{b}\right)}\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(b \cdot t\_0\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -1e-191Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub82.1%
*-lft-identity82.1%
associate-*l/82.1%
lft-mult-inverse98.7%
sub-neg98.7%
distribute-frac-neg98.7%
remove-double-neg98.7%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in a around 0 47.6%
if -1e-191 < b < 7.49999999999999969e-79Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub66.3%
*-lft-identity66.3%
associate-*l/66.3%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 87.6%
+-commutative87.6%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in a around 0 65.8%
associate-+r+65.8%
+-commutative65.8%
mul-1-neg65.8%
distribute-rgt-neg-in65.8%
mul-1-neg65.8%
distribute-lft-in65.8%
metadata-eval65.8%
mul-1-neg65.8%
unsub-neg65.8%
Simplified65.8%
Taylor expanded in b around inf 93.2%
mul-1-neg93.2%
unsub-neg93.2%
neg-mul-193.2%
Simplified93.2%
if 7.49999999999999969e-79 < b < 1.26000000000000006e168Initial program 98.1%
*-lft-identity98.1%
associate-*l/98.1%
associate-/r/98.1%
remove-double-neg98.1%
unsub-neg98.1%
div-sub74.1%
*-lft-identity74.1%
associate-*l/74.1%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 56.7%
+-commutative56.7%
distribute-rgt1-in56.7%
Simplified56.7%
Taylor expanded in a around 0 47.9%
Taylor expanded in b around inf 47.8%
if 1.26000000000000006e168 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 26.2%
+-commutative26.2%
distribute-rgt1-in26.2%
Simplified26.2%
Taylor expanded in a around 0 26.2%
associate-+r+26.2%
+-commutative26.2%
mul-1-neg26.2%
distribute-rgt-neg-in26.2%
mul-1-neg26.2%
distribute-lft-in26.2%
metadata-eval26.2%
mul-1-neg26.2%
unsub-neg26.2%
Simplified26.2%
Taylor expanded in a around -inf 81.1%
associate-*r*81.1%
neg-mul-181.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification68.1%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (+ -1.0 (* a (+ 0.5 (* a -0.16666666666666666)))))))
(if (<= b -5.2e-192)
(/ 1.0 (+ 2.0 t_0))
(if (<= b 6.4e-9)
(/ 1.0 (- (+ b 2.0) (* b (+ a (/ a b)))))
(if (<= b 1.26e+168)
(/ 1.0 (* b (+ 1.0 t_0)))
(/ -1.0 (* a (+ 1.0 (- b (/ (+ b 2.0) a))))))))))
double code(double a, double b) {
double t_0 = a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))));
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + t_0);
} else if (b <= 6.4e-9) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (b * (1.0 + t_0));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
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 = a * ((-1.0d0) + (a * (0.5d0 + (a * (-0.16666666666666666d0)))))
if (b <= (-5.2d-192)) then
tmp = 1.0d0 / (2.0d0 + t_0)
else if (b <= 6.4d-9) then
tmp = 1.0d0 / ((b + 2.0d0) - (b * (a + (a / b))))
else if (b <= 1.26d+168) then
tmp = 1.0d0 / (b * (1.0d0 + t_0))
else
tmp = (-1.0d0) / (a * (1.0d0 + (b - ((b + 2.0d0) / a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))));
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + t_0);
} else if (b <= 6.4e-9) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 1.26e+168) {
tmp = 1.0 / (b * (1.0 + t_0));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): t_0 = a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))) tmp = 0 if b <= -5.2e-192: tmp = 1.0 / (2.0 + t_0) elif b <= 6.4e-9: tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))) elif b <= 1.26e+168: tmp = 1.0 / (b * (1.0 + t_0)) else: tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))) return tmp
function code(a, b) t_0 = Float64(a * Float64(-1.0 + Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))))) tmp = 0.0 if (b <= -5.2e-192) tmp = Float64(1.0 / Float64(2.0 + t_0)); elseif (b <= 6.4e-9) tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * Float64(a + Float64(a / b))))); elseif (b <= 1.26e+168) tmp = Float64(1.0 / Float64(b * Float64(1.0 + t_0))); else tmp = Float64(-1.0 / Float64(a * Float64(1.0 + Float64(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) t_0 = a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))); tmp = 0.0; if (b <= -5.2e-192) tmp = 1.0 / (2.0 + t_0); elseif (b <= 6.4e-9) tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))); elseif (b <= 1.26e+168) tmp = 1.0 / (b * (1.0 + t_0)); else tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(-1.0 + N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.2e-192], N[(1.0 / N[(2.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.4e-9], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.26e+168], N[(1.0 / N[(b * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(a * N[(1.0 + N[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(-1 + a \cdot \left(0.5 + a \cdot -0.16666666666666666\right)\right)\\
\mathbf{if}\;b \leq -5.2 \cdot 10^{-192}:\\
\;\;\;\;\frac{1}{2 + t\_0}\\
\mathbf{elif}\;b \leq 6.4 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot \left(a + \frac{a}{b}\right)}\\
\mathbf{elif}\;b \leq 1.26 \cdot 10^{+168}:\\
\;\;\;\;\frac{1}{b \cdot \left(1 + t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -5.2000000000000003e-192Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub82.1%
*-lft-identity82.1%
associate-*l/82.1%
lft-mult-inverse98.7%
sub-neg98.7%
distribute-frac-neg98.7%
remove-double-neg98.7%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in a around 0 47.6%
if -5.2000000000000003e-192 < b < 6.40000000000000023e-9Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub69.1%
*-lft-identity69.1%
associate-*l/69.1%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 89.7%
+-commutative89.7%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in a around 0 68.1%
associate-+r+68.1%
+-commutative68.1%
mul-1-neg68.1%
distribute-rgt-neg-in68.1%
mul-1-neg68.1%
distribute-lft-in68.1%
metadata-eval68.1%
mul-1-neg68.1%
unsub-neg68.1%
Simplified68.1%
Taylor expanded in b around inf 91.6%
mul-1-neg91.6%
unsub-neg91.6%
neg-mul-191.6%
Simplified91.6%
if 6.40000000000000023e-9 < b < 1.26000000000000006e168Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub69.4%
*-lft-identity69.4%
associate-*l/69.4%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 35.0%
+-commutative35.0%
distribute-rgt1-in35.0%
Simplified35.0%
Taylor expanded in a around 0 29.9%
Taylor expanded in b around inf 28.2%
if 1.26000000000000006e168 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 26.2%
+-commutative26.2%
distribute-rgt1-in26.2%
Simplified26.2%
Taylor expanded in a around 0 26.2%
associate-+r+26.2%
+-commutative26.2%
mul-1-neg26.2%
distribute-rgt-neg-in26.2%
mul-1-neg26.2%
distribute-lft-in26.2%
metadata-eval26.2%
mul-1-neg26.2%
unsub-neg26.2%
Simplified26.2%
Taylor expanded in a around -inf 81.1%
associate-*r*81.1%
neg-mul-181.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
Simplified81.1%
Final simplification67.9%
(FPCore (a b)
:precision binary64
(let* ((t_0
(/
1.0
(+ 2.0 (* a (+ -1.0 (* a (+ 0.5 (* a -0.16666666666666666)))))))))
(if (<= b -5.2e-192)
t_0
(if (<= b 1.7e-237)
(/ 1.0 (- (+ b 2.0) (* b (+ a (/ a b)))))
(if (<= b 7.6e+76) t_0 (/ -1.0 (* a (+ 1.0 (- b (/ (+ b 2.0) a))))))))))
double code(double a, double b) {
double t_0 = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))))));
double tmp;
if (b <= -5.2e-192) {
tmp = t_0;
} else if (b <= 1.7e-237) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 7.6e+76) {
tmp = t_0;
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
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 = 1.0d0 / (2.0d0 + (a * ((-1.0d0) + (a * (0.5d0 + (a * (-0.16666666666666666d0)))))))
if (b <= (-5.2d-192)) then
tmp = t_0
else if (b <= 1.7d-237) then
tmp = 1.0d0 / ((b + 2.0d0) - (b * (a + (a / b))))
else if (b <= 7.6d+76) then
tmp = t_0
else
tmp = (-1.0d0) / (a * (1.0d0 + (b - ((b + 2.0d0) / a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666))))));
double tmp;
if (b <= -5.2e-192) {
tmp = t_0;
} else if (b <= 1.7e-237) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else if (b <= 7.6e+76) {
tmp = t_0;
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): t_0 = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))))) tmp = 0 if b <= -5.2e-192: tmp = t_0 elif b <= 1.7e-237: tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))) elif b <= 7.6e+76: tmp = t_0 else: tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))) return tmp
function code(a, b) t_0 = Float64(1.0 / Float64(2.0 + Float64(a * Float64(-1.0 + Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))))))) tmp = 0.0 if (b <= -5.2e-192) tmp = t_0; elseif (b <= 1.7e-237) tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * Float64(a + Float64(a / b))))); elseif (b <= 7.6e+76) tmp = t_0; else tmp = Float64(-1.0 / Float64(a * Float64(1.0 + Float64(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) t_0 = 1.0 / (2.0 + (a * (-1.0 + (a * (0.5 + (a * -0.16666666666666666)))))); tmp = 0.0; if (b <= -5.2e-192) tmp = t_0; elseif (b <= 1.7e-237) tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))); elseif (b <= 7.6e+76) tmp = t_0; else tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(1.0 / N[(2.0 + N[(a * N[(-1.0 + N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.2e-192], t$95$0, If[LessEqual[b, 1.7e-237], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.6e+76], t$95$0, N[(-1.0 / N[(a * N[(1.0 + N[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{2 + a \cdot \left(-1 + a \cdot \left(0.5 + a \cdot -0.16666666666666666\right)\right)}\\
\mathbf{if}\;b \leq -5.2 \cdot 10^{-192}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;b \leq 1.7 \cdot 10^{-237}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot \left(a + \frac{a}{b}\right)}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{+76}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -5.2000000000000003e-192 or 1.7000000000000001e-237 < b < 7.60000000000000049e76Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub78.3%
*-lft-identity78.3%
associate-*l/78.3%
lft-mult-inverse99.4%
sub-neg99.4%
distribute-frac-neg99.4%
remove-double-neg99.4%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 68.8%
+-commutative68.8%
Simplified68.8%
Taylor expanded in a around 0 60.2%
if -5.2000000000000003e-192 < b < 1.7000000000000001e-237Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub59.2%
*-lft-identity59.2%
associate-*l/59.2%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 77.6%
+-commutative77.6%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in a around 0 59.8%
associate-+r+59.8%
+-commutative59.8%
mul-1-neg59.8%
distribute-rgt-neg-in59.8%
mul-1-neg59.8%
distribute-lft-in59.8%
metadata-eval59.8%
mul-1-neg59.8%
unsub-neg59.8%
Simplified59.8%
Taylor expanded in b around inf 96.4%
mul-1-neg96.4%
unsub-neg96.4%
neg-mul-196.4%
Simplified96.4%
if 7.60000000000000049e76 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub78.0%
*-lft-identity78.0%
associate-*l/78.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 27.3%
+-commutative27.3%
distribute-rgt1-in27.3%
Simplified27.3%
Taylor expanded in a around 0 21.7%
associate-+r+21.7%
+-commutative21.7%
mul-1-neg21.7%
distribute-rgt-neg-in21.7%
mul-1-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
mul-1-neg21.7%
unsub-neg21.7%
Simplified21.7%
Taylor expanded in a around -inf 62.0%
associate-*r*62.0%
neg-mul-162.0%
mul-1-neg62.0%
unsub-neg62.0%
+-commutative62.0%
Simplified62.0%
Final simplification67.5%
(FPCore (a b)
:precision binary64
(if (<= b -5.2e-192)
(/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0))))
(if (<= b 1e-13)
(/ 1.0 (- (+ b 2.0) (* b (+ a (/ a b)))))
(/ -1.0 (* a (+ 1.0 (- b (/ (+ b 2.0) a))))))))
double code(double a, double b) {
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else if (b <= 1e-13) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-5.2d-192)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else if (b <= 1d-13) then
tmp = 1.0d0 / ((b + 2.0d0) - (b * (a + (a / b))))
else
tmp = (-1.0d0) / (a * (1.0d0 + (b - ((b + 2.0d0) / a))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= -5.2e-192) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else if (b <= 1e-13) {
tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b))));
} else {
tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -5.2e-192: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) elif b <= 1e-13: tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))) else: tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))) return tmp
function code(a, b) tmp = 0.0 if (b <= -5.2e-192) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); elseif (b <= 1e-13) tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * Float64(a + Float64(a / b))))); else tmp = Float64(-1.0 / Float64(a * Float64(1.0 + Float64(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -5.2e-192) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); elseif (b <= 1e-13) tmp = 1.0 / ((b + 2.0) - (b * (a + (a / b)))); else tmp = -1.0 / (a * (1.0 + (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -5.2e-192], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-13], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(a * N[(1.0 + N[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5.2 \cdot 10^{-192}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{elif}\;b \leq 10^{-13}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot \left(a + \frac{a}{b}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -5.2000000000000003e-192Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub82.1%
*-lft-identity82.1%
associate-*l/82.1%
lft-mult-inverse98.7%
sub-neg98.7%
distribute-frac-neg98.7%
remove-double-neg98.7%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in a around 0 42.7%
if -5.2000000000000003e-192 < b < 1e-13Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub69.2%
*-lft-identity69.2%
associate-*l/69.2%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 89.4%
+-commutative89.4%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in a around 0 69.1%
associate-+r+69.1%
+-commutative69.1%
mul-1-neg69.1%
distribute-rgt-neg-in69.1%
mul-1-neg69.1%
distribute-lft-in69.1%
metadata-eval69.1%
mul-1-neg69.1%
unsub-neg69.1%
Simplified69.1%
Taylor expanded in b around inf 93.2%
mul-1-neg93.2%
unsub-neg93.2%
neg-mul-193.2%
Simplified93.2%
if 1e-13 < b Initial program 98.6%
*-lft-identity98.6%
associate-*l/98.6%
associate-/r/98.6%
remove-double-neg98.6%
unsub-neg98.6%
div-sub74.3%
*-lft-identity74.3%
associate-*l/74.3%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 33.5%
+-commutative33.5%
distribute-rgt1-in33.5%
Simplified33.5%
Taylor expanded in a around 0 19.6%
associate-+r+19.6%
+-commutative19.6%
mul-1-neg19.6%
distribute-rgt-neg-in19.6%
mul-1-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
mul-1-neg19.6%
unsub-neg19.6%
Simplified19.6%
Taylor expanded in a around -inf 46.8%
associate-*r*46.8%
neg-mul-146.8%
mul-1-neg46.8%
unsub-neg46.8%
+-commutative46.8%
Simplified46.8%
Final simplification64.4%
(FPCore (a b) :precision binary64 (if (<= b 7.6e+76) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (* a (+ -1.0 (- (/ (+ b 2.0) a) b))))))
double code(double a, double b) {
double tmp;
if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 7.6d+76) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else
tmp = 1.0d0 / (a * ((-1.0d0) + (((b + 2.0d0) / a) - b)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b)));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 7.6e+76: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))) return tmp
function code(a, b) tmp = 0.0 if (b <= 7.6e+76) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); else tmp = Float64(1.0 / Float64(a * Float64(-1.0 + Float64(Float64(Float64(b + 2.0) / a) - b)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 7.6e+76) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / (a * (-1.0 + (((b + 2.0) / a) - b))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 7.6e+76], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(a * N[(-1.0 + N[(N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 7.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 + \left(\frac{b + 2}{a} - b\right)\right)}\\
\end{array}
\end{array}
if b < 7.60000000000000049e76Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub73.8%
*-lft-identity73.8%
associate-*l/73.8%
lft-mult-inverse99.5%
sub-neg99.5%
distribute-frac-neg99.5%
remove-double-neg99.5%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 76.3%
+-commutative76.3%
Simplified76.3%
Taylor expanded in a around 0 62.6%
if 7.60000000000000049e76 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub78.0%
*-lft-identity78.0%
associate-*l/78.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 27.3%
+-commutative27.3%
distribute-rgt1-in27.3%
Simplified27.3%
Taylor expanded in a around 0 21.7%
associate-+r+21.7%
+-commutative21.7%
mul-1-neg21.7%
distribute-rgt-neg-in21.7%
mul-1-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
mul-1-neg21.7%
unsub-neg21.7%
Simplified21.7%
Taylor expanded in a around -inf 62.0%
associate-*r*62.0%
neg-mul-162.0%
mul-1-neg62.0%
unsub-neg62.0%
+-commutative62.0%
Simplified62.0%
Final simplification62.5%
(FPCore (a b) :precision binary64 (if (<= b 3.5e+78) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (- (+ b 2.0) (* b a)))))
double code(double a, double b) {
double tmp;
if (b <= 3.5e+78) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / ((b + 2.0) - (b * a));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 3.5d+78) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else
tmp = 1.0d0 / ((b + 2.0d0) - (b * a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 3.5e+78) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / ((b + 2.0) - (b * a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 3.5e+78: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / ((b + 2.0) - (b * a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 3.5e+78) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); else tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 3.5e+78) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / ((b + 2.0) - (b * a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 3.5e+78], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3.5 \cdot 10^{+78}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot a}\\
\end{array}
\end{array}
if b < 3.5000000000000001e78Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub73.8%
*-lft-identity73.8%
associate-*l/73.8%
lft-mult-inverse99.5%
sub-neg99.5%
distribute-frac-neg99.5%
remove-double-neg99.5%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 76.3%
+-commutative76.3%
Simplified76.3%
Taylor expanded in a around 0 62.6%
if 3.5000000000000001e78 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub78.0%
*-lft-identity78.0%
associate-*l/78.0%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 27.3%
+-commutative27.3%
distribute-rgt1-in27.3%
Simplified27.3%
Taylor expanded in a around 0 21.7%
associate-+r+21.7%
+-commutative21.7%
mul-1-neg21.7%
distribute-rgt-neg-in21.7%
mul-1-neg21.7%
distribute-lft-in21.7%
metadata-eval21.7%
mul-1-neg21.7%
unsub-neg21.7%
Simplified21.7%
Taylor expanded in b around inf 21.7%
associate-*r*21.7%
neg-mul-121.7%
Simplified21.7%
Final simplification54.6%
(FPCore (a b) :precision binary64 (if (<= b 2.7e-15) (/ 1.0 (- 2.0 a)) (/ 1.0 (- (+ b 2.0) (* b a)))))
double code(double a, double b) {
double tmp;
if (b <= 2.7e-15) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / ((b + 2.0) - (b * a));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 2.7d-15) then
tmp = 1.0d0 / (2.0d0 - a)
else
tmp = 1.0d0 / ((b + 2.0d0) - (b * a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 2.7e-15) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / ((b + 2.0) - (b * a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2.7e-15: tmp = 1.0 / (2.0 - a) else: tmp = 1.0 / ((b + 2.0) - (b * a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 2.7e-15) tmp = Float64(1.0 / Float64(2.0 - a)); else tmp = Float64(1.0 / Float64(Float64(b + 2.0) - Float64(b * a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2.7e-15) tmp = 1.0 / (2.0 - a); else tmp = 1.0 / ((b + 2.0) - (b * a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2.7e-15], N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(b + 2.0), $MachinePrecision] - N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2.7 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{2 - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\left(b + 2\right) - b \cdot a}\\
\end{array}
\end{array}
if b < 2.70000000000000009e-15Initial program 99.4%
*-lft-identity99.4%
associate-*l/99.4%
associate-/r/99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub74.7%
*-lft-identity74.7%
associate-*l/74.7%
lft-mult-inverse99.4%
sub-neg99.4%
distribute-frac-neg99.4%
remove-double-neg99.4%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in a around 0 55.6%
neg-mul-155.6%
unsub-neg55.6%
Simplified55.6%
if 2.70000000000000009e-15 < b Initial program 98.6%
*-lft-identity98.6%
associate-*l/98.6%
associate-/r/98.6%
remove-double-neg98.6%
unsub-neg98.6%
div-sub74.3%
*-lft-identity74.3%
associate-*l/74.3%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 33.5%
+-commutative33.5%
distribute-rgt1-in33.5%
Simplified33.5%
Taylor expanded in a around 0 19.6%
associate-+r+19.6%
+-commutative19.6%
mul-1-neg19.6%
distribute-rgt-neg-in19.6%
mul-1-neg19.6%
distribute-lft-in19.6%
metadata-eval19.6%
mul-1-neg19.6%
unsub-neg19.6%
Simplified19.6%
Taylor expanded in b around inf 19.8%
associate-*r*19.8%
neg-mul-119.8%
Simplified19.8%
Final simplification45.3%
(FPCore (a b) :precision binary64 (if (<= a -4.2e-5) (/ -1.0 (* a (+ 1.0 b))) (+ 0.5 (* a 0.25))))
double code(double a, double b) {
double tmp;
if (a <= -4.2e-5) {
tmp = -1.0 / (a * (1.0 + b));
} else {
tmp = 0.5 + (a * 0.25);
}
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-5)) then
tmp = (-1.0d0) / (a * (1.0d0 + b))
else
tmp = 0.5d0 + (a * 0.25d0)
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -4.2e-5) {
tmp = -1.0 / (a * (1.0 + b));
} else {
tmp = 0.5 + (a * 0.25);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -4.2e-5: tmp = -1.0 / (a * (1.0 + b)) else: tmp = 0.5 + (a * 0.25) return tmp
function code(a, b) tmp = 0.0 if (a <= -4.2e-5) tmp = Float64(-1.0 / Float64(a * Float64(1.0 + b))); else tmp = Float64(0.5 + Float64(a * 0.25)); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -4.2e-5) tmp = -1.0 / (a * (1.0 + b)); else tmp = 0.5 + (a * 0.25); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -4.2e-5], N[(-1.0 / N[(a * N[(1.0 + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{-1}{a \cdot \left(1 + b\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 + a \cdot 0.25\\
\end{array}
\end{array}
if a < -4.19999999999999977e-5Initial program 98.5%
*-lft-identity98.5%
associate-*l/98.5%
associate-/r/98.5%
remove-double-neg98.5%
unsub-neg98.5%
div-sub3.0%
*-lft-identity3.0%
associate-*l/3.0%
lft-mult-inverse98.5%
sub-neg98.5%
distribute-frac-neg98.5%
remove-double-neg98.5%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 60.7%
+-commutative60.7%
distribute-rgt1-in98.6%
Simplified98.6%
Taylor expanded in a around 0 18.7%
associate-+r+18.7%
+-commutative18.7%
mul-1-neg18.7%
distribute-rgt-neg-in18.7%
mul-1-neg18.7%
distribute-lft-in18.7%
metadata-eval18.7%
mul-1-neg18.7%
unsub-neg18.7%
Simplified18.7%
Taylor expanded in a around inf 18.7%
if -4.19999999999999977e-5 < a Initial program 99.5%
*-lft-identity99.5%
associate-*l/99.5%
associate-/r/99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub99.5%
*-lft-identity99.5%
associate-*l/99.5%
lft-mult-inverse100.0%
sub-neg100.0%
distribute-frac-neg100.0%
remove-double-neg100.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 55.1%
+-commutative55.1%
Simplified55.1%
Taylor expanded in a around 0 54.2%
*-commutative54.2%
Simplified54.2%
Final simplification45.0%
(FPCore (a b) :precision binary64 (+ 0.5 (* a 0.25)))
double code(double a, double b) {
return 0.5 + (a * 0.25);
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 0.5d0 + (a * 0.25d0)
end function
public static double code(double a, double b) {
return 0.5 + (a * 0.25);
}
def code(a, b): return 0.5 + (a * 0.25)
function code(a, b) return Float64(0.5 + Float64(a * 0.25)) end
function tmp = code(a, b) tmp = 0.5 + (a * 0.25); end
code[a_, b_] := N[(0.5 + N[(a * 0.25), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 + a \cdot 0.25
\end{array}
Initial program 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub74.6%
*-lft-identity74.6%
associate-*l/74.6%
lft-mult-inverse99.6%
sub-neg99.6%
distribute-frac-neg99.6%
remove-double-neg99.6%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 66.1%
+-commutative66.1%
Simplified66.1%
Taylor expanded in a around 0 40.8%
*-commutative40.8%
Simplified40.8%
Final simplification40.8%
(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 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub74.6%
*-lft-identity74.6%
associate-*l/74.6%
lft-mult-inverse99.6%
sub-neg99.6%
distribute-frac-neg99.6%
remove-double-neg99.6%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 66.1%
+-commutative66.1%
Simplified66.1%
Taylor expanded in a around 0 41.1%
neg-mul-141.1%
unsub-neg41.1%
Simplified41.1%
Final simplification41.1%
(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 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub74.6%
*-lft-identity74.6%
associate-*l/74.6%
lft-mult-inverse99.6%
sub-neg99.6%
distribute-frac-neg99.6%
remove-double-neg99.6%
div-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 66.1%
+-commutative66.1%
Simplified66.1%
Taylor expanded in a around 0 39.8%
Final simplification39.8%
(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 2024073
(FPCore (a b)
:name "Quotient of sum of exps"
:precision binary64
:alt
(/ 1.0 (+ 1.0 (exp (- b a))))
(/ (exp a) (+ (exp a) (exp b))))