Ask Your Question

weird behavior quotient operator

asked 2019-01-18 10:26:41 -0500

Ablia gravatar image

updated 2019-01-19 02:45:43 -0500

FrédéricC gravatar image


i am calculating the quotient of a really big number using the operator // the fact is: if the big number is in a variable, let's say x, and i write x//2, it won't work (it'll return x/2). But if i copy/paste the big number and write //2 at the end, it works.

I don't understand it. I wanted to post a picture as example, but it seems that i need more karma to do it... so instead i put a copy/paste of the problem at the end of this post. The variable's name is "test", so i first print it, then do the //2; as you can see it doesn't work, i got the same number with /2 at the end. Then i copy/paste the number and use //2 again and here it works. The point is: when i use it in a programm, i can't copy/paste the number, it'll be in a variable. And then it fails.

sage: test
sage: test//2
sage: 83785236716094168688218220327981082153433159005629218206574922035922990009479932230685369370646
....: 30888727678204051700187944518981017658536142831535214125053659602283044807607946885170928966526
....: 46155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504
....: 593832198908321736540951//2
edit retag flag offensive close merge delete



How did you construct the variable test? Or more simply: what does type(test) return?

rburing gravatar imagerburing ( 2019-01-18 13:51:55 -0500 )edit

I'm also very curious how you produced test.

slelievre gravatar imageslelievre ( 2019-01-21 03:15:52 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2019-01-19 02:46:07 -0500

FrédéricC gravatar image

try ZZ(test)//2

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-01-18 10:26:41 -0500

Seen: 60 times

Last updated: Jan 19