Isn't it python based when dividing integers?

7//5 is 1 and 7%5 is 2 since 5*1+2 is 7.

-7//5 is -1 and -7%5 is -2 since 5*-1+-2 is -7.

Right?
On Nov 12, 2012 10:01 AM, "P Purkayastha" <[email protected]> wrote:

> On 11/12/2012 06:08 PM, siham ezzouak wrote:
>
>> Hello
>> I need for some demonstrations in my research to know how sage compute
>> arithmetic modulo that means x%y.
>> we know this is the remainder of division the x by y so sage compute the
>> remainder of division or use other methods.
>>
>> thank you in advance for your answer.
>>
>>
> It depends on the type of the number, whether it is an integer or real,
> etc. You can get the exact code by doing this:
>
> sage: a = 5
> sage: a.__mod__??
>
> or
>
> sage: a = 5.1
> sage: a.__mod__??
>
> or
>
> sage: a = 3/5
> sage: a.__mod__??
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to sage-support+unsubscribe@**
> googlegroups.com <sage-support%[email protected]>.
> Visit this group at 
> http://groups.google.com/**group/sage-support?hl=en<http://groups.google.com/group/sage-support?hl=en>
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to