
(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 21 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-sub75.4%
*-lft-identity75.4%
associate-*l/75.4%
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) 0.8) (/ 1.0 (+ 1.0 (exp (- a)))) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 0.8) {
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) <= 0.8d0) 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) <= 0.8) {
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) <= 0.8: 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) <= 0.8) 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) <= 0.8) 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], 0.8], 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 0.8:\\
\;\;\;\;\frac{1}{1 + e^{-a}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\
\end{array}
\end{array}
if (exp.f64 a) < 0.80000000000000004Initial program 98.4%
*-lft-identity98.4%
associate-*l/98.4%
associate-/r/98.4%
remove-double-neg98.4%
unsub-neg98.4%
div-sub3.1%
*-lft-identity3.1%
associate-*l/3.1%
lft-mult-inverse98.4%
sub-neg98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 99.5%
+-commutative99.5%
Simplified99.5%
if 0.80000000000000004 < (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 98.2%
+-commutative98.2%
Simplified98.2%
Final simplification98.5%
(FPCore (a b) :precision binary64 (if (<= (exp a) 1e-245) (/ (exp a) b) (/ 1.0 (+ 1.0 (exp b)))))
double code(double a, double b) {
double tmp;
if (exp(a) <= 1e-245) {
tmp = exp(a) / b;
} 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) / b
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) / b;
} 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) / b 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) / b); 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) / b; 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] / b), $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}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{1 + e^{b}}\\
\end{array}
\end{array}
if (exp.f64 a) < 9.9999999999999993e-246Initial program 98.4%
*-lft-identity98.4%
associate-*l/98.4%
associate-/r/98.4%
remove-double-neg98.4%
unsub-neg98.4%
div-sub1.6%
*-lft-identity1.6%
associate-*l/1.6%
lft-mult-inverse98.4%
sub-neg98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 61.9%
+-commutative61.9%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in b around inf 98.6%
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.8%
+-commutative97.8%
Simplified97.8%
Final simplification98.0%
(FPCore (a b)
:precision binary64
(if (<= a -360.0)
(/ (exp a) b)
(/
1.0
(+
2.0
(+ b (* a (+ (* a (- 0.5 (/ (* (* b 3.0) (* b 0.5)) b))) (- -1.0 b))))))))
double code(double a, double b) {
double tmp;
if (a <= -360.0) {
tmp = exp(a) / b;
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-360.0d0)) then
tmp = exp(a) / b
else
tmp = 1.0d0 / (2.0d0 + (b + (a * ((a * (0.5d0 - (((b * 3.0d0) * (b * 0.5d0)) / b))) + ((-1.0d0) - b)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (a <= -360.0) {
tmp = Math.exp(a) / b;
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -360.0: tmp = math.exp(a) / b else: tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))) return tmp
function code(a, b) tmp = 0.0 if (a <= -360.0) tmp = Float64(exp(a) / b); else tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(a * Float64(0.5 - Float64(Float64(Float64(b * 3.0) * Float64(b * 0.5)) / b))) + Float64(-1.0 - b)))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (a <= -360.0) tmp = exp(a) / b; else tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[a, -360.0], N[(N[Exp[a], $MachinePrecision] / b), $MachinePrecision], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(a * N[(0.5 - N[(N[(N[(b * 3.0), $MachinePrecision] * N[(b * 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -360:\\
\;\;\;\;\frac{e^{a}}{b}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(a \cdot \left(0.5 - \frac{\left(b \cdot 3\right) \cdot \left(b \cdot 0.5\right)}{b}\right) + \left(-1 - b\right)\right)\right)}\\
\end{array}
\end{array}
if a < -360Initial program 98.4%
*-lft-identity98.4%
associate-*l/98.4%
associate-/r/98.4%
remove-double-neg98.4%
unsub-neg98.4%
div-sub1.6%
*-lft-identity1.6%
associate-*l/1.6%
lft-mult-inverse98.4%
sub-neg98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 61.9%
+-commutative61.9%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in b around inf 98.6%
if -360 < 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 b around 0 52.5%
+-commutative52.5%
distribute-rgt1-in52.5%
rec-exp52.5%
associate-*r/52.5%
*-rgt-identity52.5%
Simplified52.5%
Taylor expanded in a around 0 51.6%
flip-+50.1%
mul-1-neg50.1%
mul-1-neg50.1%
sqr-neg50.1%
div-sub50.1%
pow250.1%
add-sqr-sqrt19.8%
sqrt-unprod50.1%
mul-1-neg50.1%
mul-1-neg50.1%
sqr-neg50.1%
sqrt-unprod45.3%
add-sqr-sqrt65.5%
pow265.5%
Applied egg-rr50.1%
div-sub50.1%
unpow250.1%
unpow250.1%
difference-of-squares65.5%
*-lft-identity65.5%
distribute-rgt-out65.5%
metadata-eval65.5%
cancel-sign-sub-inv65.5%
metadata-eval65.5%
distribute-rgt1-in65.5%
metadata-eval65.5%
cancel-sign-sub-inv65.5%
metadata-eval65.5%
distribute-rgt1-in65.5%
metadata-eval65.5%
Simplified65.5%
times-frac51.6%
*-commutative51.6%
Applied egg-rr51.6%
associate-*r/65.5%
associate-/l*65.5%
metadata-eval65.5%
Simplified65.5%
Final simplification73.6%
(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-sub75.4%
*-lft-identity75.4%
associate-*l/75.4%
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 -4.5e-190)
(/ 1.0 (+ 2.0 (* a (+ (* a (+ 0.5 (* a -0.16666666666666666))) -1.0))))
(if (<= b 3e-9)
(/ 1.0 (+ 2.0 (+ b (* a (+ (* (* b 0.5) (+ a (/ a b))) (- -1.0 b))))))
(/
1.0
(+
2.0
(+
b
(* a (+ (* a (- 0.5 (/ (* (* b 3.0) (* b 0.5)) b))) (- -1.0 b)))))))))
double code(double a, double b) {
double tmp;
if (b <= -4.5e-190) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 3e-9) {
tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-1.0 - b)))));
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-4.5d-190)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * (0.5d0 + (a * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (b <= 3d-9) then
tmp = 1.0d0 / (2.0d0 + (b + (a * (((b * 0.5d0) * (a + (a / b))) + ((-1.0d0) - b)))))
else
tmp = 1.0d0 / (2.0d0 + (b + (a * ((a * (0.5d0 - (((b * 3.0d0) * (b * 0.5d0)) / b))) + ((-1.0d0) - b)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= -4.5e-190) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 3e-9) {
tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-1.0 - b)))));
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -4.5e-190: tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))) elif b <= 3e-9: tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-1.0 - b))))) else: tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))) return tmp
function code(a, b) tmp = 0.0 if (b <= -4.5e-190) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))) + -1.0)))); elseif (b <= 3e-9) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(Float64(b * 0.5) * Float64(a + Float64(a / b))) + Float64(-1.0 - b)))))); else tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(a * Float64(0.5 - Float64(Float64(Float64(b * 3.0) * Float64(b * 0.5)) / b))) + Float64(-1.0 - b)))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= -4.5e-190) tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))); elseif (b <= 3e-9) tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-1.0 - b))))); else tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -4.5e-190], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e-9], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(N[(b * 0.5), $MachinePrecision] * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(a * N[(0.5 - N[(N[(N[(b * 3.0), $MachinePrecision] * N[(b * 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-190}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot \left(0.5 + a \cdot -0.16666666666666666\right) + -1\right)}\\
\mathbf{elif}\;b \leq 3 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(\left(b \cdot 0.5\right) \cdot \left(a + \frac{a}{b}\right) + \left(-1 - b\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(a \cdot \left(0.5 - \frac{\left(b \cdot 3\right) \cdot \left(b \cdot 0.5\right)}{b}\right) + \left(-1 - b\right)\right)\right)}\\
\end{array}
\end{array}
if b < -4.50000000000000021e-190Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.8%
associate-/r/98.8%
remove-double-neg98.8%
unsub-neg98.8%
div-sub83.8%
*-lft-identity83.8%
associate-*l/83.8%
lft-mult-inverse98.8%
sub-neg98.8%
distribute-frac-neg98.8%
remove-double-neg98.8%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in a around 0 47.3%
if -4.50000000000000021e-190 < b < 2.99999999999999998e-9Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.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-exp99.9%
Simplified99.9%
Taylor expanded in b around 0 89.7%
+-commutative89.7%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 84.7%
Taylor expanded in b around inf 93.6%
distribute-lft-out93.6%
associate-*r*93.6%
*-commutative93.6%
Simplified93.6%
if 2.99999999999999998e-9 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub75.4%
*-lft-identity75.4%
associate-*l/75.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 30.1%
+-commutative30.1%
distribute-rgt1-in30.1%
rec-exp30.1%
associate-*r/30.1%
*-rgt-identity30.1%
Simplified30.1%
Taylor expanded in a around 0 26.0%
flip-+11.2%
mul-1-neg11.2%
mul-1-neg11.2%
sqr-neg11.2%
div-sub11.2%
pow211.2%
add-sqr-sqrt0.0%
sqrt-unprod11.2%
mul-1-neg11.2%
mul-1-neg11.2%
sqr-neg11.2%
sqrt-unprod64.8%
add-sqr-sqrt64.8%
pow264.8%
Applied egg-rr11.2%
div-sub11.2%
unpow211.2%
unpow211.2%
difference-of-squares64.8%
*-lft-identity64.8%
distribute-rgt-out64.8%
metadata-eval64.8%
cancel-sign-sub-inv64.8%
metadata-eval64.8%
distribute-rgt1-in64.8%
metadata-eval64.8%
cancel-sign-sub-inv64.8%
metadata-eval64.8%
distribute-rgt1-in64.8%
metadata-eval64.8%
Simplified64.8%
times-frac26.0%
*-commutative26.0%
Applied egg-rr26.0%
associate-*r/64.8%
associate-/l*64.8%
metadata-eval64.8%
Simplified64.8%
Final simplification71.4%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (+ (* a 0.5) -1.0))))
(if (<= b -5.8e-282)
(/ 1.0 (+ 2.0 (* a (+ (* a (+ 0.5 (* a -0.16666666666666666))) -1.0))))
(if (<= b 1e-179)
(/ 1.0 (+ 2.0 (+ b (* b (+ t_0 (/ t_0 b))))))
(/
1.0
(+
2.0
(+
b
(*
a
(+ (* a (- 0.5 (/ (* (* b 3.0) (* b 0.5)) b))) (- -1.0 b))))))))))
double code(double a, double b) {
double t_0 = a * ((a * 0.5) + -1.0);
double tmp;
if (b <= -5.8e-282) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1e-179) {
tmp = 1.0 / (2.0 + (b + (b * (t_0 + (t_0 / b)))));
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
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 * ((a * 0.5d0) + (-1.0d0))
if (b <= (-5.8d-282)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * (0.5d0 + (a * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (b <= 1d-179) then
tmp = 1.0d0 / (2.0d0 + (b + (b * (t_0 + (t_0 / b)))))
else
tmp = 1.0d0 / (2.0d0 + (b + (a * ((a * (0.5d0 - (((b * 3.0d0) * (b * 0.5d0)) / b))) + ((-1.0d0) - b)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double t_0 = a * ((a * 0.5) + -1.0);
double tmp;
if (b <= -5.8e-282) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1e-179) {
tmp = 1.0 / (2.0 + (b + (b * (t_0 + (t_0 / b)))));
} else {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b)))));
}
return tmp;
}
def code(a, b): t_0 = a * ((a * 0.5) + -1.0) tmp = 0 if b <= -5.8e-282: tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))) elif b <= 1e-179: tmp = 1.0 / (2.0 + (b + (b * (t_0 + (t_0 / b))))) else: tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))) return tmp
function code(a, b) t_0 = Float64(a * Float64(Float64(a * 0.5) + -1.0)) tmp = 0.0 if (b <= -5.8e-282) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))) + -1.0)))); elseif (b <= 1e-179) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(b * Float64(t_0 + Float64(t_0 / b)))))); else tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(a * Float64(0.5 - Float64(Float64(Float64(b * 3.0) * Float64(b * 0.5)) / b))) + Float64(-1.0 - b)))))); end return tmp end
function tmp_2 = code(a, b) t_0 = a * ((a * 0.5) + -1.0); tmp = 0.0; if (b <= -5.8e-282) tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))); elseif (b <= 1e-179) tmp = 1.0 / (2.0 + (b + (b * (t_0 + (t_0 / b))))); else tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (((b * 3.0) * (b * 0.5)) / b))) + (-1.0 - b))))); end tmp_2 = tmp; end
code[a_, b_] := Block[{t$95$0 = N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.8e-282], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1e-179], N[(1.0 / N[(2.0 + N[(b + N[(b * N[(t$95$0 + N[(t$95$0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(a * N[(0.5 - N[(N[(N[(b * 3.0), $MachinePrecision] * N[(b * 0.5), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := a \cdot \left(a \cdot 0.5 + -1\right)\\
\mathbf{if}\;b \leq -5.8 \cdot 10^{-282}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot \left(0.5 + a \cdot -0.16666666666666666\right) + -1\right)}\\
\mathbf{elif}\;b \leq 10^{-179}:\\
\;\;\;\;\frac{1}{2 + \left(b + b \cdot \left(t\_0 + \frac{t\_0}{b}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(a \cdot \left(0.5 - \frac{\left(b \cdot 3\right) \cdot \left(b \cdot 0.5\right)}{b}\right) + \left(-1 - b\right)\right)\right)}\\
\end{array}
\end{array}
if b < -5.79999999999999995e-282Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub80.0%
*-lft-identity80.0%
associate-*l/80.0%
lft-mult-inverse99.0%
sub-neg99.0%
distribute-frac-neg99.0%
remove-double-neg99.0%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 63.2%
+-commutative63.2%
Simplified63.2%
Taylor expanded in a around 0 56.0%
if -5.79999999999999995e-282 < b < 1e-179Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub56.1%
*-lft-identity56.1%
associate-*l/56.1%
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 90.2%
+-commutative90.2%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 74.5%
Taylor expanded in b around inf 97.7%
if 1e-179 < b Initial program 99.1%
*-lft-identity99.1%
associate-*l/99.1%
associate-/r/99.1%
remove-double-neg99.1%
unsub-neg99.1%
div-sub78.3%
*-lft-identity78.3%
associate-*l/78.3%
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 58.1%
+-commutative58.1%
distribute-rgt1-in58.1%
rec-exp58.1%
associate-*r/58.1%
*-rgt-identity58.1%
Simplified58.1%
Taylor expanded in a around 0 52.2%
flip-+43.3%
mul-1-neg43.3%
mul-1-neg43.3%
sqr-neg43.3%
div-sub43.3%
pow243.3%
add-sqr-sqrt0.0%
sqrt-unprod43.3%
mul-1-neg43.3%
mul-1-neg43.3%
sqr-neg43.3%
sqrt-unprod75.5%
add-sqr-sqrt75.5%
pow275.5%
Applied egg-rr43.3%
div-sub43.3%
unpow243.3%
unpow243.3%
difference-of-squares75.5%
*-lft-identity75.5%
distribute-rgt-out75.5%
metadata-eval75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
distribute-rgt1-in75.5%
metadata-eval75.5%
cancel-sign-sub-inv75.5%
metadata-eval75.5%
distribute-rgt1-in75.5%
metadata-eval75.5%
Simplified75.5%
times-frac52.2%
*-commutative52.2%
Applied egg-rr52.2%
associate-*r/75.5%
associate-/l*75.5%
metadata-eval75.5%
Simplified75.5%
Final simplification71.4%
(FPCore (a b)
:precision binary64
(if (<= b -2.15e-211)
(/ 1.0 (+ 2.0 (* a (+ (* a (+ 0.5 (* a -0.16666666666666666))) -1.0))))
(if (<= b 1.6e-237)
(/ 1.0 (* b (+ (- 1.0 a) (/ (- 2.0 a) b))))
(if (<= b 5e+78)
(/ 1.0 (+ 2.0 (+ b (* a (+ (* a (- 0.5 (* b 1.5))) (- -1.0 b))))))
(/ 1.0 (* a (- -1.0 (- b (/ (+ b 2.0) a)))))))))
double code(double a, double b) {
double tmp;
if (b <= -2.15e-211) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1.6e-237) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 5e+78) {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (b * 1.5))) + (-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 <= (-2.15d-211)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * (0.5d0 + (a * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (b <= 1.6d-237) then
tmp = 1.0d0 / (b * ((1.0d0 - a) + ((2.0d0 - a) / b)))
else if (b <= 5d+78) then
tmp = 1.0d0 / (2.0d0 + (b + (a * ((a * (0.5d0 - (b * 1.5d0))) + ((-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 <= -2.15e-211) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1.6e-237) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 5e+78) {
tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (b * 1.5))) + (-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 <= -2.15e-211: tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))) elif b <= 1.6e-237: tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))) elif b <= 5e+78: tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (b * 1.5))) + (-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 <= -2.15e-211) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))) + -1.0)))); elseif (b <= 1.6e-237) tmp = Float64(1.0 / Float64(b * Float64(Float64(1.0 - a) + Float64(Float64(2.0 - a) / b)))); elseif (b <= 5e+78) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(a * Float64(0.5 - Float64(b * 1.5))) + 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 <= -2.15e-211) tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))); elseif (b <= 1.6e-237) tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))); elseif (b <= 5e+78) tmp = 1.0 / (2.0 + (b + (a * ((a * (0.5 - (b * 1.5))) + (-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, -2.15e-211], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.6e-237], N[(1.0 / N[(b * N[(N[(1.0 - a), $MachinePrecision] + N[(N[(2.0 - a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5e+78], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(a * N[(0.5 - N[(b * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $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 -2.15 \cdot 10^{-211}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot \left(0.5 + a \cdot -0.16666666666666666\right) + -1\right)}\\
\mathbf{elif}\;b \leq 1.6 \cdot 10^{-237}:\\
\;\;\;\;\frac{1}{b \cdot \left(\left(1 - a\right) + \frac{2 - a}{b}\right)}\\
\mathbf{elif}\;b \leq 5 \cdot 10^{+78}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(a \cdot \left(0.5 - b \cdot 1.5\right) + \left(-1 - b\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 < -2.15e-211Initial program 98.8%
*-lft-identity98.8%
associate-*l/98.8%
associate-/r/98.8%
remove-double-neg98.8%
unsub-neg98.8%
div-sub83.7%
*-lft-identity83.7%
associate-*l/83.7%
lft-mult-inverse98.8%
sub-neg98.8%
distribute-frac-neg98.8%
remove-double-neg98.8%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in a around 0 51.0%
if -2.15e-211 < b < 1.6e-237Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub56.8%
*-lft-identity56.8%
associate-*l/56.8%
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.3%
+-commutative77.3%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 57.9%
associate-+r+57.9%
associate-*r*57.9%
distribute-rgt1-in57.9%
+-commutative57.9%
neg-mul-157.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in b around -inf 96.5%
mul-1-neg96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
distribute-lft-out96.5%
mul-1-neg96.5%
Simplified96.5%
if 1.6e-237 < b < 4.99999999999999984e78Initial program 98.7%
*-lft-identity98.7%
associate-*l/98.7%
associate-/r/98.7%
remove-double-neg98.7%
unsub-neg98.7%
div-sub74.4%
*-lft-identity74.4%
associate-*l/74.4%
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 83.5%
+-commutative83.5%
distribute-rgt1-in83.5%
rec-exp83.5%
associate-*r/83.5%
*-rgt-identity83.5%
Simplified83.5%
Taylor expanded in a around 0 73.6%
*-un-lft-identity73.6%
fma-define73.6%
add-sqr-sqrt0.0%
sqrt-unprod73.6%
mul-1-neg73.6%
mul-1-neg73.6%
sqr-neg73.6%
sqrt-unprod73.6%
add-sqr-sqrt73.6%
Applied egg-rr73.6%
fma-undefine73.6%
distribute-rgt-out73.6%
metadata-eval73.6%
Simplified73.6%
if 4.99999999999999984e78 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in a around -inf 66.4%
mul-1-neg66.4%
distribute-rgt-neg-in66.4%
mul-1-neg66.4%
unsub-neg66.4%
+-commutative66.4%
Simplified66.4%
Final simplification68.6%
(FPCore (a b)
:precision binary64
(if (<= b -5.2e-192)
(/ 1.0 (+ 2.0 (* a (+ (* a (+ 0.5 (* a -0.16666666666666666))) -1.0))))
(if (<= b 7.6e+76)
(/ 1.0 (+ 2.0 (+ b (* a (+ (* (* b 0.5) (+ a (/ a b))) (- -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 * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-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 * ((a * (0.5d0 + (a * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (b <= 7.6d+76) then
tmp = 1.0d0 / (2.0d0 + (b + (a * (((b * 0.5d0) * (a + (a / b))) + ((-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 * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-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 * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))) elif b <= 7.6e+76: tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-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(Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))) + -1.0)))); elseif (b <= 7.6e+76) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(Float64(b * 0.5) * Float64(a + Float64(a / b))) + 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 * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))); elseif (b <= 7.6e+76) tmp = 1.0 / (2.0 + (b + (a * (((b * 0.5) * (a + (a / b))) + (-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[(N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.6e+76], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(N[(b * 0.5), $MachinePrecision] * N[(a + N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - b), $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(a \cdot \left(0.5 + a \cdot -0.16666666666666666\right) + -1\right)}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(\left(b \cdot 0.5\right) \cdot \left(a + \frac{a}{b}\right) + \left(-1 - b\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.8%
associate-/r/98.8%
remove-double-neg98.8%
unsub-neg98.8%
div-sub83.8%
*-lft-identity83.8%
associate-*l/83.8%
lft-mult-inverse98.8%
sub-neg98.8%
distribute-frac-neg98.8%
remove-double-neg98.8%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 54.0%
+-commutative54.0%
Simplified54.0%
Taylor expanded in a around 0 47.3%
if -5.2000000000000003e-192 < b < 7.60000000000000049e76Initial program 99.2%
*-lft-identity99.2%
associate-*l/99.2%
associate-/r/99.2%
remove-double-neg99.2%
unsub-neg99.2%
div-sub68.8%
*-lft-identity68.8%
associate-*l/68.8%
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 81.4%
+-commutative81.4%
distribute-rgt1-in89.9%
rec-exp90.0%
associate-*r/90.0%
*-rgt-identity90.0%
Simplified90.0%
Taylor expanded in a around 0 75.7%
Taylor expanded in b around inf 83.1%
distribute-lft-out83.1%
associate-*r*83.1%
*-commutative83.1%
Simplified83.1%
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-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in a around -inf 66.4%
mul-1-neg66.4%
distribute-rgt-neg-in66.4%
mul-1-neg66.4%
unsub-neg66.4%
+-commutative66.4%
Simplified66.4%
Final simplification68.8%
(FPCore (a b)
:precision binary64
(let* ((t_0 (* a (+ (* a 0.5) -1.0))))
(if (<= b -2e-210)
(/ 1.0 (+ 2.0 t_0))
(if (<= b 2.4e-239)
(/ 1.0 (* b (+ (- 1.0 a) (/ (- 2.0 a) b))))
(if (<= b 7.6e+76)
(/ 1.0 (+ 2.0 (+ b t_0)))
(/ 1.0 (* a (- -1.0 (- b (/ (+ b 2.0) a))))))))))
double code(double a, double b) {
double t_0 = a * ((a * 0.5) + -1.0);
double tmp;
if (b <= -2e-210) {
tmp = 1.0 / (2.0 + t_0);
} else if (b <= 2.4e-239) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (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 = a * ((a * 0.5d0) + (-1.0d0))
if (b <= (-2d-210)) then
tmp = 1.0d0 / (2.0d0 + t_0)
else if (b <= 2.4d-239) then
tmp = 1.0d0 / (b * ((1.0d0 - a) + ((2.0d0 - a) / b)))
else if (b <= 7.6d+76) then
tmp = 1.0d0 / (2.0d0 + (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 = a * ((a * 0.5) + -1.0);
double tmp;
if (b <= -2e-210) {
tmp = 1.0 / (2.0 + t_0);
} else if (b <= 2.4e-239) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (b + t_0));
} else {
tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): t_0 = a * ((a * 0.5) + -1.0) tmp = 0 if b <= -2e-210: tmp = 1.0 / (2.0 + t_0) elif b <= 2.4e-239: tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))) elif b <= 7.6e+76: tmp = 1.0 / (2.0 + (b + 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(Float64(a * 0.5) + -1.0)) tmp = 0.0 if (b <= -2e-210) tmp = Float64(1.0 / Float64(2.0 + t_0)); elseif (b <= 2.4e-239) tmp = Float64(1.0 / Float64(b * Float64(Float64(1.0 - a) + Float64(Float64(2.0 - a) / b)))); elseif (b <= 7.6e+76) tmp = Float64(1.0 / Float64(2.0 + 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 = a * ((a * 0.5) + -1.0); tmp = 0.0; if (b <= -2e-210) tmp = 1.0 / (2.0 + t_0); elseif (b <= 2.4e-239) tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))); elseif (b <= 7.6e+76) tmp = 1.0 / (2.0 + (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[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2e-210], N[(1.0 / N[(2.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.4e-239], N[(1.0 / N[(b * N[(N[(1.0 - a), $MachinePrecision] + N[(N[(2.0 - a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.6e+76], N[(1.0 / N[(2.0 + N[(b + 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(a \cdot 0.5 + -1\right)\\
\mathbf{if}\;b \leq -2 \cdot 10^{-210}:\\
\;\;\;\;\frac{1}{2 + t\_0}\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-239}:\\
\;\;\;\;\frac{1}{b \cdot \left(\left(1 - a\right) + \frac{2 - a}{b}\right)}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{1}{2 + \left(b + 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 < -2.0000000000000001e-210Initial program 98.8%
*-lft-identity98.8%
associate-*l/98.8%
associate-/r/98.8%
remove-double-neg98.8%
unsub-neg98.8%
div-sub83.7%
*-lft-identity83.7%
associate-*l/83.7%
lft-mult-inverse98.8%
sub-neg98.8%
distribute-frac-neg98.8%
remove-double-neg98.8%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in a around 0 46.5%
if -2.0000000000000001e-210 < b < 2.39999999999999993e-239Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub56.8%
*-lft-identity56.8%
associate-*l/56.8%
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.3%
+-commutative77.3%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 57.9%
associate-+r+57.9%
associate-*r*57.9%
distribute-rgt1-in57.9%
+-commutative57.9%
neg-mul-157.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in b around -inf 96.5%
mul-1-neg96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
distribute-lft-out96.5%
mul-1-neg96.5%
Simplified96.5%
if 2.39999999999999993e-239 < 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-sub74.4%
*-lft-identity74.4%
associate-*l/74.4%
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 83.5%
+-commutative83.5%
distribute-rgt1-in83.5%
rec-exp83.5%
associate-*r/83.5%
*-rgt-identity83.5%
Simplified83.5%
Taylor expanded in a around 0 73.6%
Taylor expanded in b around inf 73.6%
distribute-lft-out73.6%
associate-*r*73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in b around 0 73.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-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in a around -inf 66.4%
mul-1-neg66.4%
distribute-rgt-neg-in66.4%
mul-1-neg66.4%
unsub-neg66.4%
+-commutative66.4%
Simplified66.4%
Final simplification67.1%
(FPCore (a b)
:precision binary64
(if (<= b -1.5e-211)
(/ 1.0 (+ 2.0 (* a (+ (* a (+ 0.5 (* a -0.16666666666666666))) -1.0))))
(if (<= b 1.1e-237)
(/ 1.0 (* b (+ (- 1.0 a) (/ (- 2.0 a) b))))
(if (<= b 7.6e+76)
(/ 1.0 (+ 2.0 (+ b (* a (+ (* a 0.5) -1.0)))))
(/ 1.0 (* a (- -1.0 (- b (/ (+ b 2.0) a)))))))))
double code(double a, double b) {
double tmp;
if (b <= -1.5e-211) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1.1e-237) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (b + (a * ((a * 0.5) + -1.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) :: tmp
if (b <= (-1.5d-211)) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * (0.5d0 + (a * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (b <= 1.1d-237) then
tmp = 1.0d0 / (b * ((1.0d0 - a) + ((2.0d0 - a) / b)))
else if (b <= 7.6d+76) then
tmp = 1.0d0 / (2.0d0 + (b + (a * ((a * 0.5d0) + (-1.0d0)))))
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 <= -1.5e-211) {
tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0)));
} else if (b <= 1.1e-237) {
tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b)));
} else if (b <= 7.6e+76) {
tmp = 1.0 / (2.0 + (b + (a * ((a * 0.5) + -1.0))));
} else {
tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= -1.5e-211: tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))) elif b <= 1.1e-237: tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))) elif b <= 7.6e+76: tmp = 1.0 / (2.0 + (b + (a * ((a * 0.5) + -1.0)))) else: tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a)))) return tmp
function code(a, b) tmp = 0.0 if (b <= -1.5e-211) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * Float64(0.5 + Float64(a * -0.16666666666666666))) + -1.0)))); elseif (b <= 1.1e-237) tmp = Float64(1.0 / Float64(b * Float64(Float64(1.0 - a) + Float64(Float64(2.0 - a) / b)))); elseif (b <= 7.6e+76) tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(Float64(a * 0.5) + -1.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) tmp = 0.0; if (b <= -1.5e-211) tmp = 1.0 / (2.0 + (a * ((a * (0.5 + (a * -0.16666666666666666))) + -1.0))); elseif (b <= 1.1e-237) tmp = 1.0 / (b * ((1.0 - a) + ((2.0 - a) / b))); elseif (b <= 7.6e+76) tmp = 1.0 / (2.0 + (b + (a * ((a * 0.5) + -1.0)))); else tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, -1.5e-211], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * N[(0.5 + N[(a * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.1e-237], N[(1.0 / N[(b * N[(N[(1.0 - a), $MachinePrecision] + N[(N[(2.0 - a), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.6e+76], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.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}
\mathbf{if}\;b \leq -1.5 \cdot 10^{-211}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot \left(0.5 + a \cdot -0.16666666666666666\right) + -1\right)}\\
\mathbf{elif}\;b \leq 1.1 \cdot 10^{-237}:\\
\;\;\;\;\frac{1}{b \cdot \left(\left(1 - a\right) + \frac{2 - a}{b}\right)}\\
\mathbf{elif}\;b \leq 7.6 \cdot 10^{+76}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(a \cdot 0.5 + -1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 - \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < -1.50000000000000002e-211Initial program 98.8%
*-lft-identity98.8%
associate-*l/98.8%
associate-/r/98.8%
remove-double-neg98.8%
unsub-neg98.8%
div-sub83.7%
*-lft-identity83.7%
associate-*l/83.7%
lft-mult-inverse98.8%
sub-neg98.8%
distribute-frac-neg98.8%
remove-double-neg98.8%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 57.2%
+-commutative57.2%
Simplified57.2%
Taylor expanded in a around 0 51.0%
if -1.50000000000000002e-211 < b < 1.09999999999999999e-237Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub56.8%
*-lft-identity56.8%
associate-*l/56.8%
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.3%
+-commutative77.3%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 57.9%
associate-+r+57.9%
associate-*r*57.9%
distribute-rgt1-in57.9%
+-commutative57.9%
neg-mul-157.9%
unsub-neg57.9%
Simplified57.9%
Taylor expanded in b around -inf 96.5%
mul-1-neg96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
distribute-lft-out96.5%
mul-1-neg96.5%
Simplified96.5%
if 1.09999999999999999e-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-sub74.4%
*-lft-identity74.4%
associate-*l/74.4%
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 83.5%
+-commutative83.5%
distribute-rgt1-in83.5%
rec-exp83.5%
associate-*r/83.5%
*-rgt-identity83.5%
Simplified83.5%
Taylor expanded in a around 0 73.6%
Taylor expanded in b around inf 73.6%
distribute-lft-out73.6%
associate-*r*73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in b around 0 73.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-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in a around -inf 66.4%
mul-1-neg66.4%
distribute-rgt-neg-in66.4%
mul-1-neg66.4%
unsub-neg66.4%
+-commutative66.4%
Simplified66.4%
Final simplification68.6%
(FPCore (a b) :precision binary64 (if (<= b 2.0) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (* b (+ 1.0 (* a (+ (* a -1.5) -1.0)))))))
double code(double a, double b) {
double tmp;
if (b <= 2.0) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (b * (1.0 + (a * ((a * -1.5) + -1.0))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 2.0d0) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else
tmp = 1.0d0 / (b * (1.0d0 + (a * ((a * (-1.5d0)) + (-1.0d0)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 2.0) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (b * (1.0 + (a * ((a * -1.5) + -1.0))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 2.0: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / (b * (1.0 + (a * ((a * -1.5) + -1.0)))) return tmp
function code(a, b) tmp = 0.0 if (b <= 2.0) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); else tmp = Float64(1.0 / Float64(b * Float64(1.0 + Float64(a * Float64(Float64(a * -1.5) + -1.0))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 2.0) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / (b * (1.0 + (a * ((a * -1.5) + -1.0)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 2.0], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(1.0 + N[(a * N[(N[(a * -1.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 2:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(1 + a \cdot \left(a \cdot -1.5 + -1\right)\right)}\\
\end{array}
\end{array}
if b < 2Initial program 98.9%
*-lft-identity98.9%
associate-*l/98.9%
associate-/r/98.9%
remove-double-neg98.9%
unsub-neg98.9%
div-sub75.1%
*-lft-identity75.1%
associate-*l/75.1%
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 79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in a around 0 66.6%
if 2 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub76.1%
*-lft-identity76.1%
associate-*l/76.1%
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 28.5%
+-commutative28.5%
distribute-rgt1-in28.5%
rec-exp28.5%
associate-*r/28.5%
*-rgt-identity28.5%
Simplified28.5%
Taylor expanded in a around 0 24.3%
flip-+9.0%
mul-1-neg9.0%
mul-1-neg9.0%
sqr-neg9.0%
div-sub9.0%
pow29.0%
add-sqr-sqrt0.0%
sqrt-unprod9.0%
mul-1-neg9.0%
mul-1-neg9.0%
sqr-neg9.0%
sqrt-unprod64.2%
add-sqr-sqrt64.2%
pow264.2%
Applied egg-rr9.0%
div-sub9.0%
unpow29.0%
unpow29.0%
difference-of-squares64.2%
*-lft-identity64.2%
distribute-rgt-out64.2%
metadata-eval64.2%
cancel-sign-sub-inv64.2%
metadata-eval64.2%
distribute-rgt1-in64.2%
metadata-eval64.2%
cancel-sign-sub-inv64.2%
metadata-eval64.2%
distribute-rgt1-in64.2%
metadata-eval64.2%
Simplified64.2%
Taylor expanded in b around inf 24.3%
Final simplification55.5%
(FPCore (a b) :precision binary64 (if (<= b 5e-23) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (+ 2.0 (+ b (* a (* b (* a 0.5))))))))
double code(double a, double b) {
double tmp;
if (b <= 5e-23) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (2.0 + (b + (a * (b * (a * 0.5)))));
}
return tmp;
}
real(8) function code(a, b)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= 5d-23) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else
tmp = 1.0d0 / (2.0d0 + (b + (a * (b * (a * 0.5d0)))))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 5e-23) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (2.0 + (b + (a * (b * (a * 0.5)))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 5e-23: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / (2.0 + (b + (a * (b * (a * 0.5))))) return tmp
function code(a, b) tmp = 0.0 if (b <= 5e-23) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); else tmp = Float64(1.0 / Float64(2.0 + Float64(b + Float64(a * Float64(b * Float64(a * 0.5)))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 5e-23) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / (2.0 + (b + (a * (b * (a * 0.5))))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 5e-23], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + N[(b + N[(a * N[(b * N[(a * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 5 \cdot 10^{-23}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \left(b + a \cdot \left(b \cdot \left(a \cdot 0.5\right)\right)\right)}\\
\end{array}
\end{array}
if b < 5.0000000000000002e-23Initial program 99.4%
*-lft-identity99.4%
associate-*l/99.4%
associate-/r/99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub76.0%
*-lft-identity76.0%
associate-*l/76.0%
lft-mult-inverse99.5%
sub-neg99.5%
distribute-frac-neg99.5%
remove-double-neg99.5%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in a around 0 66.9%
if 5.0000000000000002e-23 < 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.0%
*-lft-identity74.0%
associate-*l/74.0%
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 34.0%
+-commutative34.0%
distribute-rgt1-in34.0%
rec-exp34.0%
associate-*r/34.0%
*-rgt-identity34.0%
Simplified34.0%
Taylor expanded in a around 0 27.5%
Taylor expanded in b around inf 27.6%
Taylor expanded in a around inf 27.6%
*-commutative27.6%
associate-*r*27.6%
*-commutative27.6%
associate-*l*27.6%
*-commutative27.6%
Simplified27.6%
Final simplification55.7%
(FPCore (a b) :precision binary64 (if (<= b 4e+79) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (* a (- -1.0 (- b (/ (+ b 2.0) a)))))))
double code(double a, double b) {
double tmp;
if (b <= 4e+79) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.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) :: tmp
if (b <= 4d+79) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
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 <= 4e+79) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a))));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 4e+79: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a)))) return tmp
function code(a, b) tmp = 0.0 if (b <= 4e+79) 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(b - Float64(Float64(b + 2.0) / a))))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 4e+79) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / (a * (-1.0 - (b - ((b + 2.0) / a)))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 4e+79], 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[(b - N[(N[(b + 2.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4 \cdot 10^{+79}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 - \left(b - \frac{b + 2}{a}\right)\right)}\\
\end{array}
\end{array}
if b < 3.99999999999999987e79Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub74.5%
*-lft-identity74.5%
associate-*l/74.5%
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 75.7%
+-commutative75.7%
Simplified75.7%
Taylor expanded in a around 0 62.7%
if 3.99999999999999987e79 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in a around -inf 66.4%
mul-1-neg66.4%
distribute-rgt-neg-in66.4%
mul-1-neg66.4%
unsub-neg66.4%
+-commutative66.4%
Simplified66.4%
Final simplification63.4%
(FPCore (a b) :precision binary64 (if (<= b 6.4e+81) (/ 1.0 (+ 2.0 (* a (+ (* a 0.5) -1.0)))) (/ 1.0 (* b (- 1.0 a)))))
double code(double a, double b) {
double tmp;
if (b <= 6.4e+81) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (b * (1.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 <= 6.4d+81) then
tmp = 1.0d0 / (2.0d0 + (a * ((a * 0.5d0) + (-1.0d0))))
else
tmp = 1.0d0 / (b * (1.0d0 - a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 6.4e+81) {
tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0)));
} else {
tmp = 1.0 / (b * (1.0 - a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 6.4e+81: tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))) else: tmp = 1.0 / (b * (1.0 - a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 6.4e+81) tmp = Float64(1.0 / Float64(2.0 + Float64(a * Float64(Float64(a * 0.5) + -1.0)))); else tmp = Float64(1.0 / Float64(b * Float64(1.0 - a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 6.4e+81) tmp = 1.0 / (2.0 + (a * ((a * 0.5) + -1.0))); else tmp = 1.0 / (b * (1.0 - a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 6.4e+81], N[(1.0 / N[(2.0 + N[(a * N[(N[(a * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 6.4 \cdot 10^{+81}:\\
\;\;\;\;\frac{1}{2 + a \cdot \left(a \cdot 0.5 + -1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(1 - a\right)}\\
\end{array}
\end{array}
if b < 6.4e81Initial program 99.0%
*-lft-identity99.0%
associate-*l/99.0%
associate-/r/99.0%
remove-double-neg99.0%
unsub-neg99.0%
div-sub74.5%
*-lft-identity74.5%
associate-*l/74.5%
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 75.7%
+-commutative75.7%
Simplified75.7%
Taylor expanded in a around 0 62.7%
if 6.4e81 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub79.2%
*-lft-identity79.2%
associate-*l/79.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 26.3%
+-commutative26.3%
distribute-rgt1-in26.3%
rec-exp26.3%
associate-*r/26.3%
*-rgt-identity26.3%
Simplified26.3%
Taylor expanded in a around 0 22.4%
associate-+r+22.4%
associate-*r*22.4%
distribute-rgt1-in22.4%
+-commutative22.4%
neg-mul-122.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in b around inf 22.4%
Final simplification55.1%
(FPCore (a b) :precision binary64 (if (<= b 3e-15) (/ 1.0 (- 2.0 a)) (/ 1.0 (+ 2.0 (- b (* b a))))))
double code(double a, double b) {
double tmp;
if (b <= 3e-15) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / (2.0 + (b - (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 <= 3d-15) then
tmp = 1.0d0 / (2.0d0 - a)
else
tmp = 1.0d0 / (2.0d0 + (b - (b * a)))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 3e-15) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / (2.0 + (b - (b * a)));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 3e-15: tmp = 1.0 / (2.0 - a) else: tmp = 1.0 / (2.0 + (b - (b * a))) return tmp
function code(a, b) tmp = 0.0 if (b <= 3e-15) tmp = Float64(1.0 / Float64(2.0 - a)); else tmp = Float64(1.0 / Float64(2.0 + Float64(b - Float64(b * a)))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 3e-15) tmp = 1.0 / (2.0 - a); else tmp = 1.0 / (2.0 + (b - (b * a))); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 3e-15], N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 + N[(b - N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 3 \cdot 10^{-15}:\\
\;\;\;\;\frac{1}{2 - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 + \left(b - b \cdot a\right)}\\
\end{array}
\end{array}
if b < 3e-15Initial program 99.4%
*-lft-identity99.4%
associate-*l/99.4%
associate-/r/99.4%
remove-double-neg99.4%
unsub-neg99.4%
div-sub75.5%
*-lft-identity75.5%
associate-*l/75.5%
lft-mult-inverse99.5%
sub-neg99.5%
distribute-frac-neg99.5%
remove-double-neg99.5%
div-exp100.0%
Simplified100.0%
Taylor expanded in b around 0 80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in a around 0 55.9%
neg-mul-155.9%
unsub-neg55.9%
Simplified55.9%
if 3e-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-sub75.0%
*-lft-identity75.0%
associate-*l/75.0%
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.0%
+-commutative33.0%
distribute-rgt1-in33.0%
rec-exp33.0%
associate-*r/33.0%
*-rgt-identity33.0%
Simplified33.0%
Taylor expanded in a around 0 26.5%
Taylor expanded in b around inf 26.6%
Taylor expanded in a around 0 20.3%
mul-1-neg20.3%
Simplified20.3%
Final simplification45.9%
(FPCore (a b) :precision binary64 (if (<= a -1.9) (/ 1.0 (* a (- -1.0 b))) (+ 0.5 (* a 0.25))))
double code(double a, double b) {
double tmp;
if (a <= -1.9) {
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 <= (-1.9d0)) 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 <= -1.9) {
tmp = 1.0 / (a * (-1.0 - b));
} else {
tmp = 0.5 + (a * 0.25);
}
return tmp;
}
def code(a, b): tmp = 0 if a <= -1.9: 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 <= -1.9) 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 <= -1.9) 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, -1.9], 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 -1.9:\\
\;\;\;\;\frac{1}{a \cdot \left(-1 - b\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 + a \cdot 0.25\\
\end{array}
\end{array}
if a < -1.8999999999999999Initial program 98.4%
*-lft-identity98.4%
associate-*l/98.4%
associate-/r/98.4%
remove-double-neg98.4%
unsub-neg98.4%
div-sub1.6%
*-lft-identity1.6%
associate-*l/1.6%
lft-mult-inverse98.4%
sub-neg98.4%
distribute-frac-neg98.4%
remove-double-neg98.4%
div-exp99.8%
Simplified99.8%
Taylor expanded in b around 0 61.9%
+-commutative61.9%
distribute-rgt1-in100.0%
rec-exp100.0%
associate-*r/100.0%
*-rgt-identity100.0%
Simplified100.0%
Taylor expanded in a around 0 19.4%
associate-+r+19.4%
associate-*r*19.4%
distribute-rgt1-in19.4%
+-commutative19.4%
neg-mul-119.4%
unsub-neg19.4%
Simplified19.4%
Taylor expanded in a around inf 19.4%
mul-1-neg19.4%
distribute-rgt-neg-in19.4%
mul-1-neg19.4%
distribute-lft-in19.4%
metadata-eval19.4%
mul-1-neg19.4%
unsub-neg19.4%
Simplified19.4%
if -1.8999999999999999 < 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 b around 0 54.9%
+-commutative54.9%
Simplified54.9%
Taylor expanded in a around 0 54.1%
*-commutative54.1%
Simplified54.1%
Final simplification45.5%
(FPCore (a b) :precision binary64 (if (<= b 1.95) (/ 1.0 (- 2.0 a)) (/ 1.0 (* b (- 1.0 a)))))
double code(double a, double b) {
double tmp;
if (b <= 1.95) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / (b * (1.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 <= 1.95d0) then
tmp = 1.0d0 / (2.0d0 - a)
else
tmp = 1.0d0 / (b * (1.0d0 - a))
end if
code = tmp
end function
public static double code(double a, double b) {
double tmp;
if (b <= 1.95) {
tmp = 1.0 / (2.0 - a);
} else {
tmp = 1.0 / (b * (1.0 - a));
}
return tmp;
}
def code(a, b): tmp = 0 if b <= 1.95: tmp = 1.0 / (2.0 - a) else: tmp = 1.0 / (b * (1.0 - a)) return tmp
function code(a, b) tmp = 0.0 if (b <= 1.95) tmp = Float64(1.0 / Float64(2.0 - a)); else tmp = Float64(1.0 / Float64(b * Float64(1.0 - a))); end return tmp end
function tmp_2 = code(a, b) tmp = 0.0; if (b <= 1.95) tmp = 1.0 / (2.0 - a); else tmp = 1.0 / (b * (1.0 - a)); end tmp_2 = tmp; end
code[a_, b_] := If[LessEqual[b, 1.95], N[(1.0 / N[(2.0 - a), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(b * N[(1.0 - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.95:\\
\;\;\;\;\frac{1}{2 - a}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{b \cdot \left(1 - a\right)}\\
\end{array}
\end{array}
if b < 1.94999999999999996Initial program 98.9%
*-lft-identity98.9%
associate-*l/98.9%
associate-/r/98.9%
remove-double-neg98.9%
unsub-neg98.9%
div-sub75.1%
*-lft-identity75.1%
associate-*l/75.1%
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 79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in a around 0 55.1%
neg-mul-155.1%
unsub-neg55.1%
Simplified55.1%
if 1.94999999999999996 < b Initial program 100.0%
*-lft-identity100.0%
associate-*l/100.0%
associate-/r/100.0%
remove-double-neg100.0%
unsub-neg100.0%
div-sub76.1%
*-lft-identity76.1%
associate-*l/76.1%
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 28.5%
+-commutative28.5%
distribute-rgt1-in28.5%
rec-exp28.5%
associate-*r/28.5%
*-rgt-identity28.5%
Simplified28.5%
Taylor expanded in a around 0 18.8%
associate-+r+18.8%
associate-*r*18.8%
distribute-rgt1-in18.8%
+-commutative18.8%
neg-mul-118.8%
unsub-neg18.8%
Simplified18.8%
Taylor expanded in b around inf 18.8%
Final simplification45.6%
(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-sub75.4%
*-lft-identity75.4%
associate-*l/75.4%
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 65.9%
+-commutative65.9%
Simplified65.9%
Taylor expanded in a around 0 41.3%
*-commutative41.3%
Simplified41.3%
Final simplification41.3%
(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-sub75.4%
*-lft-identity75.4%
associate-*l/75.4%
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 65.9%
+-commutative65.9%
Simplified65.9%
Taylor expanded in a around 0 41.7%
neg-mul-141.7%
unsub-neg41.7%
Simplified41.7%
Final simplification41.7%
(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-sub75.4%
*-lft-identity75.4%
associate-*l/75.4%
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 65.9%
+-commutative65.9%
Simplified65.9%
Taylor expanded in a around 0 40.5%
Final simplification40.5%
(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))))