I'm using the pow function and found out I had a bug in my code because == and is were not having the same behavior.   Here goes an example: pow(3, 47159012670, 47159012671) == 1 returns True but pow(3, 47159012670, 47159012671) is 1 returns False.  I'd like to know what is it that I'm not getting.
2846
Why does the following behave unexpectedly in Python?  &gt;&gt;&gt; a = 256 &gt;&gt;&gt; b = 256 &gt;&gt;&gt; a is b True           # This is an expected result &gt;&gt;&gt; a = 257 &gt;&gt;&gt; b = 257 &gt;&gt;&gt; a is b False          # What happened here? Why is this False? &gt;&gt;&gt; 257 is 257 True           # Yet the literal numbers compare properly   I am using Python 2.5.2. Trying some different versions of Python, it appears that Python 2.3.3 shows the above behaviour between 99 and 100.  Based on the above, I can hypothesize that Python is internally implemented such that "small" integers are stored in a different way than larger integers and the is operator can tell the difference. Why the leaky abstraction? What is a better way of comparing two arbitrary objects to see whether they are the same when I don't know in advance whether they are numbers or not?
13240
Is there a direct way to determine how many digits a power of 2 will contain without actually performing the multiplication?  An estimation would help as well if there is no absolute solution.  EDIT: In both decimal and binary bases.
115153
I know you can't rely on equality between double or decimal type values normally, but I'm wondering if 0 is a special case.  While I can understand imprecisions between 0.00000000000001 and 0.00000000000002, 0 itself seems pretty hard to mess up since it's just nothing.  If you're imprecise on nothing, it's not nothing anymore.  But I don't know much about this topic so it's not for me to say.  double x = 0.0; return (x == 0.0) ? true : false;   Will that always return true?
89905
For example, when I divided $1$ by $98$, I got an amazing result of $0.0102040816326530612244897...$ where so many numbers get multiplied by two every time in the right pattern with some carrying.  Also, when I divided $1$ by $998$, I got an amazing result of $0.0010020040080160320641282...$.  I have a longer result from my cool memory, which is $0.001002004008016032064128256513026052104208517034068136272545090180360721442885...$What explains why this doubling thing is happening?  I love it when I see it!  Also I don't know if it repeats (I'm talking about 1/998).  I think it does because I looked it up and it said 498 numbers repeat every time, so it's rational.  I mean seriously, how does this doubling happen?  I hope I can receive good information from you!
73098
Is there a way to represent a number with higher than 53-bit precision in JavaScript? In other words, is there a way to represent 64-bit precision number?  I am trying to implement some logic in which each bit of a 64-bit number represents something. I lose the lower significant bits when I try to set bits higher than 2^53.  Math.pow(2,53) + Math.pow(2,0) == Math.pow(2,53)   Is there a way to implement a custom library or something to achieve this?
117193
Do we need to be careful when comparing a double value against zero?  if ( someAmount &lt;= 0){ ..... }
33306
Hey! I was looking at this code at   I noticed that in some situations they used hex numbers, like in line 134:  for (j = 1; val &amp;&amp; j &lt;= 0x80; j &lt;&lt;= 1, q++)   Now why would they use the 0x80? I am not that good with hex but I found an online hex to decimal and it gave me 128 for 0x80.  Also before line 134, on line 114 they have this:  small_n = (n &amp; 0xffff0000) == 0;   The hex to decimal gave me 4294901760 for that hex number. So here in this line they are making a bit AND and comparing the result to 0??  Why not just use the number? Can anyone please explain and please do give examples of other situations.  Also I have seen large lines of code where it's just hex numbers and never really understood why :(
12243
I understand that when you raise any number $x$ to a power, you multiply $x$ by itself the number of times indicated in the power. However, what happens when $i^i$ is performed? How can a number be multiplied an imaginary amount of times? Wolfram Alpha says that it is equal to $e^{{-\pi}/{2}}$, but how would you arrive at that answer? Any response will be appreciated, thanks!
41639
I'm given a inequality as such: $n! &gt; n^3$ Where n > 5,   I've done this so far:  BC: n = 6, 6! > 720 (Works)  IH: let n = k, we have that: $k! &gt; k^3$  IS: try n = k+1, (I'm told to only work from one side)  So I have (k+1)!, but I'm not sure where to go from here.  I've been told that writing out: $(k+1)! &gt; (k+1)^3$ is a fallacy, because I can't sub in k+1 into both sides, but rather prove from one side only.    Any Help on how to continue from here, would be much appreciated.
113458
Using the equivalency, I got the answer equal to $1$, however the answer is given as $\frac34$.    also gives $\frac34$.  Could someone tell me that the given answer is wrong or I made a mistake!
73942
Can someone explain to me how XOR swapping of two variables with no temp variable works?  void xorSwap (int *x, int *y) {     if (x != y) {         *x ^= *y;         *y ^= *x;         *x ^= *y;     } }   I understand WHAT it does, but can someone walk me through the logic of how it works?
45673
What's wrong with this demonstration?:  $$A \iff 1 = 1^1$$ $$A \implies 1 = 1^\frac{2}{2}$$ $$A \implies 1 = (1^2)^\frac{1}{2}$$ $$A \implies 1 = ((-1)^2)^\frac{1}{2}$$ $$A \implies 1 = (-1)^\frac{2}{2}$$ $$A \implies 1 = (-1)^1 = -1$$  So finaly we get  $$1 = -1$$
34629
Why is $ 1^{\infty} \not= \lim_{t \to \infty} 1^t = 1$?  It seems like they're saying the same thing. After all, $1$ to the power of any positive integer is equal to $1$.  I suspect that I'm misunderstanding some fundamental concept and would appreciate it if someone could explain it to me.  Thank you.
76578
I'm trying to prove $2^b-1$ does not divide $2^a + 1$ for $a,b&gt;2$. Can someone give a hint in the right direction for this?
9763
I noticed relation between modulo operation and number which is power of two  Example I have to calculate $ 3431242341 \mod 2^5 $, which is $ 5 $ but it is equivalent to  $ ( 3431242341 \mod 2^9 ) \mod 2^5 $   I tried many examples and it seems to be true in general, and I am not sure if it is a coincidence or true in general that I can use first modulo operation ( greater number) and the result will be the same.
63730
"" (number $5$).  I'm looking at this, and i'm not sure what the $\equiv$ means in this instance? I know the rest of the values, but what does $\equiv$ mean right now?  Thanks in advance!
86253
Prove that $n&lt;3^n$ where $n \in \mathbb N$,  when $ n=1 $, I have proved it's true. And assumed when $n = p$ , $p&lt;3^p$ is true. Can any body help me in showing that it is true for $n =p+1$