On Sat, Dec 27, 2008 at 5:11 PM, ggrafendorfer <georg.grafendor...@gmail.com> wrote: > > Hi Developers, (sage 3.2.2 on a 32-bit Athlon running Debian etch) > I would report it to trac (tell me if I should), but I'm not sure if > it's a bug, > > increasing precision of a complex number which has imaginary part zero > results in a real number: > > this works: > sage: a = CC(-5. + I*0.0001).n(prec=100) > sage: type(a) > <type 'sage.rings.complex_number.ComplexNumber'> > sage: a.prec() > 100 > > but here a turns into a real number: > sage: a = CC(-5 + I*0.).n(prec=100) > sage: type(a) > <type 'sage.rings.real_mpfr.RealNumber'> > sage: a.prec() > 100 > > if this is a feature, than it's annoying, for example taking the > logarithm of -5 with precision 100 than leads to > > sage: ln(CC(-5).n(prec=100)) > NaN > > I know how to do it the right way (ln(ComplexField(100)(-5)), but the > above should work too, or? >
You should do it the right way instead of the wrong way. It is a very bad idea to do stuff like "ln(CC(-5).n(prec=100))", which basically says "take -5, think of it as a complex number with 53 bits of precision, take the log, then view the answer as magically having 100 bits of precision by basically randomly making up the missing 47 bits". William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---