# HG changeset patch
# User Jason Grout <jasonsage@creativetrax.com>
# Date 1271732481 18000
# Node ID d76b628bbd9cd550bbba242091eb895c9e0a0d3c
# Parent 638055501d7553a8f91383ffa97d3262202932db
#8720: Change printing CC(0) and CDF(0) to show numerical precision, as RR and RDF do.
diff git a/sage/rings/complex_double.pyx b/sage/rings/complex_double.pyx
a

b


912  912  +infinity + +infinity*I 
913  913  sage: CC(CDF(oo,oo)) 
914  914  +infinity + +infinity*I 
 915  sage: CDF(0) 
 916  0.0 
915  917  """ 
916  918  if self._complex.dat[0]: 
917  919  # real part is nonzero 
… 
… 

921  923  if self._complex.dat[1]: # imag is nonzero 
922  924  s = '' 
923  925  else: 
924   return '0' # imag is zero 
 926  return double_to_str(self._complex.dat[0]) # imag is zero 
925  927  
926  928  cdef double y = self._complex.dat[1] 
927  929  if y: 
diff git a/sage/rings/complex_number.pyx b/sage/rings/complex_number.pyx
a

b


445  445  '3.243f6a8885a30 + 2.b7e151628aed2*I' 
446  446  sage: a.str(base=36) 
447  447  '3.53i5ab8p5fc + 2.puw5nggjf8f*I' 
 448  sage: CC(0) 
 449  0.000000000000000 
448  450  """ 
449  451  
450  452  s = "" 
… 
… 

460  462  s = s+" + " 
461  463  s = s+"%s*I"%y.str(base, truncate=truncate) 
462  464  if len(s) == 0: 
463   s = "0" 
 465  s = self.real().str(base, truncate=truncate) 
464  466  return s 
465  467  
466  468  def _latex_(self): 