Repository: sympy/sympy

Issue:
simplify of cosh(1/2) returns float
Hello,

`simplify` fails to recognize `cosh(1/2)` when given in `exp` form and returns a float, which is clearly a wrong answer. I tried several 
other fractions, only exp(1/2) + exp(-1/2) seems to suffer the issue.

```
In [1]: import sympy as sp

In [2]: sp.simplify(2 * sp.cosh(sp.Rational(1,2)))
Out[2]: 2*cosh(1/2)

In [3]: sp.simplify(sp.exp(sp.Rational(1,3)) + sp.exp(sp.Rational(-1,3)))
Out[3]: 2*cosh(1/3)

In [4]: sp.simplify(sp.exp(sp.Rational(1,2)) + sp.exp(sp.Rational(-1,2)))
Out[4]: 2.25525193041276

In [5]: sp.__version__
Out[5]: '1.8'
```

Discussion:

Patch:
diff --git a/sympy/simplify/trigsimp.py b/sympy/simplify/trigsimp.py
index da40be8521..ca43a63b0b 100644
--- a/sympy/simplify/trigsimp.py
+++ b/sympy/simplify/trigsimp.py
@@ -550,13 +550,13 @@ def f(rv):
         rvd = rv.as_powers_dict()
         newd = rvd.copy()
 
-        def signlog(expr, sign=1):
+        def signlog(expr, sign=S.One):
             if expr is S.Exp1:
-                return sign, 1
+                return sign, S.One
             elif isinstance(expr, exp) or (expr.is_Pow and expr.base == S.Exp1):
                 return sign, expr.exp
-            elif sign == 1:
-                return signlog(-expr, sign=-1)
+            elif sign is S.One:
+                return signlog(-expr, sign=-S.One)
             else:
                 return None, None
 


Test patch:
diff --git a/sympy/simplify/tests/test_trigsimp.py b/sympy/simplify/tests/test_trigsimp.py
index d399d5b94a..414ff0c032 100644
--- a/sympy/simplify/tests/test_trigsimp.py
+++ b/sympy/simplify/tests/test_trigsimp.py
@@ -446,6 +446,11 @@ def test_Piecewise():
     assert trigsimp(Piecewise((e1, e3 < e2), (e3, True))) == \
         Piecewise((e1, e3 < s2), (e3, True))
 
+
+def test_issue_21594():
+    assert simplify(exp(Rational(1,2)) + exp(Rational(-1,2))) == cosh(S.Half)*2
+
+
 def test_trigsimp_old():
     x, y = symbols('x,y')