From: Jonathan B. <jbr...@ea...> - 2006-04-26 12:52:52
|
On Tue, 2006-04-25 at 19:16 -0700, Martin Mason wrote: > Hi Folks, > > > > Just finishing up a program to convert observations of RA and Dec > into orbital elements. I am trying to match the precision of my > measuring instruments, which means I need to worry about how the > vector object stores its components. I know that the regular float > variable type has 53 bits of precision. When I display the contents > of the vector, it seems like it is truncating it to something like 24 > bits. Is this just in the display or is this real? IE > > Angular Momentum <0.122495, 0.227241, 1.46103> > Magnitude of Angular Momentum 1.48366502545 > > > > Is the output just hiding the extra digits or are they disappearing? > Anyone done any testing on this? visual.vector stores its components as 3 C "double" variables, which are equivalent to Python floats. The display is deliberately truncated in vector.__str__(), but you can provide your own version of that function that provides the full resolution if you wish. def my_vector_str(self): return "<%.15e, %.15e, %.15e>" %(self.x, self.y, self.z) visual.vector.__str__ = my_vector_str HTH, -Jonathan |