Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

weird behavior quotient operator

Hello,

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 837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951 sage: test//2 837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951/2 sage: 83785236716094168688218220327981082153433159005629218206574922035922990009479932230685369370646 ....: 30888727678204051700187944518981017658536142831535214125053659602283044807607946885170928966526 ....: 46155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504 ....: 593832198908321736540951//2 418926183580470843441091101639905410767165795028146091032874610179614950047399661153426846853231544436383910202585009397225949050882926807141576760706252682980114152240380397344258546448326323077733802025083705140810628342446638516812456156382541413296208847225856048304818513485087252296916099454160868270475

click to hide/show revision 2
None

weird behavior quotient operator

Hello,

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
837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951
sage: test//2
837852367160941686882182203279810821534331590056292182065749220359229900094799322306853693706463088872767820405170018794451898101765853614283153521412505365960228304480760794688517092896652646155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504593832198908321736540951/2
sage: 83785236716094168688218220327981082153433159005629218206574922035922990009479932230685369370646
....: 30888727678204051700187944518981017658536142831535214125053659602283044807607946885170928966526
....: 46155467604050167410281621256684893277033624912312765082826592417694451712096609637026970174504
....: 593832198908321736540951//2
418926183580470843441091101639905410767165795028146091032874610179614950047399661153426846853231544436383910202585009397225949050882926807141576760706252682980114152240380397344258546448326323077733802025083705140810628342446638516812456156382541413296208847225856048304818513485087252296916099454160868270475

418926183580470843441091101639905410767165795028146091032874610179614950047399661153426846853231544436383910202585009397225949050882926807141576760706252682980114152240380397344258546448326323077733802025083705140810628342446638516812456156382541413296208847225856048304818513485087252296916099454160868270475