Thank you Kyle. It seems to work. So now does someone have an example of it failing on some number that is real?
{{{ CC(60).imag() /// 0.000000000000000 }}} {{{ CC(pi).imag() /// 0.000000000000000 }}} {{{ CC(sqrt(2)).imag() /// 0.000000000000000 }}} {{{ CC(-90 + i).imag() /// 1.00000000000000 }}} {{{ CC(-90).imag() /// 0.000000000000000 }}} On 5/10/07, Kyle Schalm <[EMAIL PROTECTED]> wrote: > > > presumably you could do > > if CC(x).imag() != 0: > # raise error > > > > > Well I would like to make a Point class for a 2D coordinate system. So > > what is the best way to prevent most numbers with non-zero imaginary > > parts from becoming x and/or y in the definition of a given point? > > Like I would like to at least prevent 3 + i from being x and/or y. > > > > On 5/9/07, Justin C. Walker <[EMAIL PROTECTED]> wrote: > >> > >> > >> On May 9, 2007, at 23:19 , Timothy Clemans wrote: > >> > >>> > >>> I don't want someone trying to make a 3D point using a complex number > >>> with a non-zero imaginary part. > >> > >> There should be a simpler way to check for that than for real > >> numbers, but if you are trying to make this absolutely foolproof, you > >> could be in for a lifetime of successive refinements to your code. > >> > >> Justin > >> > >> -- > >> Justin C. Walker, Curmudgeon at Large > >> Director > >> Institute for the Enhancement of the Director's Income > >> ----------- > >> Nobody knows the trouble I've been > >> ----------- > >> > >> > >> > >> > >>> > >> > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---