On Tue, Apr 20, 2010 at 6:43 AM, Jason Grout <jason-s...@creativetrax.com> wrote: > On 04/20/2010 08:28 AM, William Stein wrote: >> >> On Tue, Apr 20, 2010 at 6:24 AM, Jason Grout >> <jason-s...@creativetrax.com> wrote: >>> >>> On 04/20/2010 07:25 AM, William Stein wrote: >>>> >>>> On Monday, April 19, 2010, Tom Boothby<tomas.boot...@gmail.com> >>>> wrote: >>>>> >>>>> +1 to consistency. IMHO, imprecise fields should represent their zero >>>>> as 0.0, as floats do. >>>> >>>> Jason's patch does not do that.... >>>> >>> >>> That's right. In Sage, notice that RR(0) does not print out 0.0, it >>> prints >>> out 0.000000000000000. Here is what happens after my patch: >>> >>> sage: CDF(0) >>> 0.0 >>> sage: CC(0) >>> 0.000000000000000 >>> sage: float(0) >>> 0.0 >>> sage: complex(0,0) >>> 0j >>> >>> Note that after the patch, CDF and CC are consistent with RDF and RR. >>> That >>> means that CC and RR are not consistent with a python float or python >>> complex. >> >> And what is your argument for that choice? > > > 1. It was a minimal change to CDF/CC that took care of something really bad, > in my opinion: that CDF(0) and CC(0) did not show that the zero was a > floating point number (i.e., they printed out '0'). > > 2. The most obvious convention to follow was the RDF/RR conventions, since > those types are most like CDF and CC in Sage. > > 3. So now, the reasoning is punted over to RR and RDF. I believe the > reasoning there is that in RR, we want to exactly show the precision. > However, that design choice has been in Sage for a long time now.
This argument could be strengthened by noting what Pari, Magma, Maple, and Mathematica do, and aiming for consistency with them too. Perhaps Magma is the only one that is relevant, since the others don't have a notion of parents. flat:~ wstein$ magma Magma V2.15-11 Tue Apr 20 2010 06:47:52 on flat [Seed = 3208201223] Type ? for help. Type <Ctrl>-D to quit. > R := RealField(100); > R!0; 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org