# HG changeset patch
# User William Stein <wstein@gmail.com>
# Date 1274838015 25200
# Node ID f57d301de3488988c1ca412ff8b04ead86983830
# Parent bb9e9b1ca4f0c18671752b7911566ee21f06daa4
trac 8847  pynac.pyx use double precision special functions instead of long double
diff git a/sage/symbolic/pynac.pyx b/sage/symbolic/pynac.pyx
a

b


13  13  long double tgammal(long double) 
14  14  long double lgammal(long double) 
15  15  
 16  # We use the following only on Cygwin 
 17  double log(double) 
 18  double lgamma(double) 
 19  double tgamma(double) 
 20  double sqrt(double) 
 21  
 22  # We do this so we can very quickly decide if we're on Cygwin 
 23  import os 
 24  cdef bint CYGWIN = os.uname()[0].startswith('CYGWIN') 
 25  
16  26  include "../ext/cdefs.pxi" 
17  27  include "../ext/stdsage.pxi" 
18  28  include "../libs/ginac/decl.pxi" 
… 
… 

1122  1132  ################################################################# 
1123  1133  cdef public object py_tgamma(object x) except +: 
1124  1134  if PY_TYPE_CHECK_EXACT(x, float): 
1125   return tgammal(x) 
 1135  return tgamma(x) if CYGWIN else tgammal(x) 
1126  1136  #FIXME: complex 
1127  1137  try: 
1128  1138  return x.gamma() 
… 
… 

1350  1360  x = float(x) 
1351  1361  if PY_TYPE_CHECK_EXACT(x, float): 
1352  1362  if (<float>x) > 0: 
1353   return logl(x) 
 1363  return log(x) if CYGWIN else logl(x) 
1354  1364  elif x < 0: 
1355  1365  res = gsl_complex_log(gsl_complex_rect(PyFloat_AsDouble(x), 0)) 
1356  1366  return PyComplex_FromDoubles(res.dat[0], res.dat[1]) 
… 
… 

1477  1487  
1478  1488  cdef public object py_lgamma(object x) except +: 
1479  1489  if PY_TYPE_CHECK_EXACT(x, float): 
1480   return lgammal(x) 
 1490  return lgamma(x) if CYGWIN else lgammal(x) 
1481  1491  #FIXME: complex 
1482  1492  try: 
1483  1493  return x.log_gamma() 
… 
… 

1492  1502  # WORRY: What if Integer's sqrt calls symbolic one and we go in circle? 
1493  1503  return x.sqrt() 
1494  1504  except AttributeError, msg: 
1495   return sqrtl(float(x)) 
 1505  return sqrt(float(x)) if CYGWIN else sqrtl(float(x)) 
1496  1506  
1497  1507  cdef public object py_abs(object x) except +: 
1498  1508  return abs(x) 