Ask Your Question
1

weird behavior quotient operator

asked 2019-01-18 17:26:41 +0100

Ablia gravatar image

updated 2019-01-19 09:45:43 +0100

FrédéricC gravatar image

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
edit retag flag offensive close merge delete

Comments

1

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

rburing gravatar imagerburing ( 2019-01-18 20:51:55 +0100 )edit

I'm also very curious how you produced test.

slelievre gravatar imageslelievre ( 2019-01-21 10:15:52 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-01-19 09:46:07 +0100

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

Stats

Asked: 2019-01-18 17:26:41 +0100

Seen: 604 times

Last updated: Jan 19 '19