On Saturday, June 9, 2018 at 7:44:45 AM UTC-7, William wrote:
>
> That "QQ(1) // QQ(2)" returns 1/2 in Sage is surely a mistake.


It may be a mistake, but I am very happy with the consequence. This is what 
I'd expect // to do on the rationals.
FWIW in magma:

> 5 div 2;
2
> R:=pAdicRing(7); a:=R!7;
> a div a;
1 + O(7^19)
> a div a^2;
Runtime error in 'div': Division is not exact

I'm quite happy with that. It gets a little weird with polynomial rings:

> R<x>:=PolynomialRing(Rationals());
> (x+1) div x;
1
> R<x,y>:=PolynomialRing(Rationals(),2);
> (x+1) div x;                          
Runtime error in 'div': Argument 2 does not divide argument 1

but generally I find I need the "division in integral domain with error if 
element is not divisible" operation quite a bit more than "euclidean 
division without reporting the remainder directly".

 

>  It 
> might be my fault -- I have a vague memory of making this choice 
> (probably 14 years ago!).  Why it should be 0: 
>
> $ python3 
> Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
> [GCC 5.4.0 20160609] on linux 
> Type "help", "copyright", "credits" or "license" for more information. 
> >>> 2.5 // 3.5 
> 0.0 
>
> (also, it's called "floor division"!) 
>
> Fortunately, for sage floats // is an error, rather than a wrong answer: 
>
> sage: 2.5 // 3.5 
> TypeError: unsupported operand parent(s) for //: 'Real Field with 53 
> bits of precision' and 'Real Field with 53 bits of precision' 
>
> > 
> > 
> > -- 
> > 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+...@googlegroups.com <javascript:>. 
> > To post to this group, send email to sage-...@googlegroups.com 
> <javascript:>. 
> > Visit this group at https://groups.google.com/group/sage-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to