[sage-devel] Re: __repr__ for RDF

2014-08-21 Thread Dima Pasechnik
On 2014-08-21, Jeroen Demeyer jdeme...@cage.ugent.be wrote:
 Currently in Sage, we have

 sage: RR(2/3)
 0.667
 sage: float(2/3)
 0.
 sage: RDF(2/3)
 0.6667

 It's annoying that all these 3 are exactly the same thing (53-bit 
 precision floats with the same bit pattern), but all 3 have a different 
 __repr__. I noticed this in a doctest failure #16858 (a float was 
 expected, but an RDF element was returned). The easy thing to do would 
 be to just fix those doctests.

 However, I would actually like to make the __repr__ of RDF consistent 
 with the __repr__ of Python floats (except maybe NaN and infinity 
 values, which are currently special-cased anyway). The change itself is 
 quite easy, but it obviously gives massive amounts of doctest failures. 
 I personally don't mind fixing those, but I wanted to ask for opinions 
 here, since that change will have a significant impact.

 Everything I said about RDF also applies to CDF, I would change that also.

 Opinions?

I think it's a great idea, and will reduce the confusion level quite a bit; 
what precision will you choose as the right one?
float() ?


 Jeroen.


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: __repr__ for RDF

2014-08-21 Thread Jeroen Demeyer

On 2014-08-21 15:05, Dima Pasechnik wrote:

I think it's a great idea, and will reduce the confusion level quite a bit;
what precision will you choose as the right one?
I will simply use the repr() function for Python floats (except for NaN 
and infinities).


--
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: __repr__ for RDF

2014-08-21 Thread Volker Braun
+1

There is another ticket that'll require some larger scale fixing of 
doctests at http://trac.sagemath.org/ticket/16746...

On Thursday, August 21, 2014 8:07:22 AM UTC+1, Jeroen Demeyer wrote:

 Currently in Sage, we have 

 sage: RR(2/3) 
 0.667 
 sage: float(2/3) 
 0. 
 sage: RDF(2/3) 
 0.6667 

 It's annoying that all these 3 are exactly the same thing (53-bit 
 precision floats with the same bit pattern), but all 3 have a different 
 __repr__. I noticed this in a doctest failure #16858 (a float was 
 expected, but an RDF element was returned). The easy thing to do would 
 be to just fix those doctests. 

 However, I would actually like to make the __repr__ of RDF consistent 
 with the __repr__ of Python floats (except maybe NaN and infinity 
 values, which are currently special-cased anyway). The change itself is 
 quite easy, but it obviously gives massive amounts of doctest failures. 
 I personally don't mind fixing those, but I wanted to ask for opinions 
 here, since that change will have a significant impact. 

 Everything I said about RDF also applies to CDF, I would change that also. 

 Opinions? 
 Jeroen. 


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.