Take the following code in c++ #include &lt;iostream&gt; #include &lt;math.h&gt;  using namespace std;   int main(){   double one, out;     one = (pow(10, 10) - 1 ) / 9; //1111111111    out = one  * pow(10, 12) + one * 80 + 9;   cout &lt;&lt; fixed &lt;&lt; out &lt;&lt; endl; }  it returns 1111111111088888872960.000000  Variable out should equal 1111111111088888888889. When I paste the following formula in , that equals varialble one (10^10 - 1)/9 * 10^12 + 80 * (10^10 - 1)/9 + 9 the result is correct. Could you tell me where I did a mistake?
27
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
95629
I have a question that has been bothering me for quite some time. In second order logic sometimes there is an indication that a variable can be both bound and free. The simplest example I can give is using the variable $v_0$ and the constants $c_0, c_1$ who are not equal to one another. How does one interpret the following formula. $$(v_0=c_0)\wedge \left[ \exists v_0 (v_0 = c_1)\right]$$  I see a few possible interpretations:   The statement is not actually valid because variables cannot be both bound and free. The formula will always be false because $(v_0=c_0)$ restricts $v_0$ such that there cannot exist a $v_0=c_1$ The formula is true when $v_0=c_0$ because one essentially treats the free version of a variable differently from the bound version such that even though $v_0=c_0$ in this particular instance, it still theoretically could be that a variable $v_0$ equals the constant $c_1$ and thus the existence clause is satisfied as well.   I also recognize that it could be something completely different from any of these that I have not thought of yet, I was just curious if there was an accepted way to handle variables which are both free and bound because I have not found any satisfying answers as of yet.
87190
Does math have an incorrect notation / syntax? I don't mean writing misaligned notation (google), but when you take something like a number to powers to powers to powers, $${{2^2}^2}^3$$ (I was told this is incorrect notation by a teacher). Is it really incorrect, or does it just need to be simplified with parentheses? Do people write maths like this?  a radical expression with the root being a radical expression? $$\sqrt[\sqrt{2^3}]{2}$$
112617
This question comes out of a mathematics calendar problem that asked for the tenths digit of the expression $(17 + \sqrt{280})^{17}$.  The calendar implied the digit should be 9, but after playing with the expression for while, factoring it in various ways, binomial expansions, trying series approximations, etc., I made little progress.  I tried a more brute-force approach and entered the expression into a high-precision calculator, which showed the value to be very close to an integer, specifically with a decimal that begins $.999999999824...$  After further trial-and-error, I saw the problem had a number of red herrings (e.g., the fact that the first time and the exponent are equal, or that the number under the radical is different from the square of the first time by a perfect square).  Someone can correct me if I'm wrong, but in general it seems expressions of this form $$(a + \sqrt {a^2 \pm  x})^n$$ where $a$ is a positive integer and $x$ is an integer relatively small compared to $a^2$, tend to rapidly approach integer values as $n$ grows.  I feel like I'm missing something rather obvious here, but could someone enlighten me (or at least give me a hint) about why this expression should give values increasingly close to integers when raised to large powers?
244
How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  &lt;-  Note comma typo! c = d;
13823
I'm trying to find $\int x^x \, dx$, but the only thing I know how to do is this:  Let $u=x^x$.  $$\begin{align} \int x^x \, dx&amp;=\int u \, du\\[6pt] &amp;=\frac{u^2}{2}\\[6pt] &amp;=\dfrac{\left(x^x\right)^2}{2}\\[6pt] &amp;=\frac{x^{2x}}{2} \end{align}$$  But it's certain that this isn't the correct way to evaluate that, and the answer must be wrong.
57093
I think there's a lot for me to learn about data types. Why this happens  double result = ((3/8)*100).ToString();   it gives zero .. should be 37,5 ... :(
43916
I have much more experience programming than I do with advanced mathematics, so perhaps this is just a comfort thing with me, but I often get frustrated when I try to follow mathematical notation. Specifically, I get frustrated trying to keep track of what each variable signifies.  As a programmer, this would be completely unacceptable no matter how many comments you added explaining it:  float A(float P, float r, float n, float t) {   return P * pow(1 + r / n, n * t); }   Yet a mathematician would have no problem with this:     $A = P\ \left(1+\dfrac{r}{n}\right)^{nt}$      where   $A$ = final amount   $P$ = principal amount (initial investment)   $r$ = annual nominal interest rate (as a decimal)   $n$ = number of times the interest is compounded per year   $t$ = number of years   So why don't I ever see the following?  $\text{final_amount} = \text{principal}\; \left(1+\dfrac{\text{interest_rate}}{\text{periods_per_yr}}\right)^{\text{periods_per_yr}\cdot\text{years}}$
13767
What is the correct way of iterating over a vector in C++?  Consider these two code fragments, this one works fine:  for (unsigned i=0; i &lt; polygon.size(); i++) {     sum += polygon[i]; }   and this one:  for (int i=0; i &lt; polygon.size(); i++) {     sum += polygon[i]; }   which generates warning: comparison between signed and unsigned integer expressions.  I'm new in the world of C++, so the unsigned variable looks a bit frightening to me and I know unsigned variables can be dangerous if not used correctly, so - is this correct?
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!
84933
How can I change the variable in $$\int_{0}^{1}\int_{0}^{1} \frac{x-y}{(x+y)^3} dxdy$$ to computer the value  I tried to let $u=x+y$ and $v=x-y$  But I have no idea for next step   Can you give me some suggestion,thank you!!!
22739
Is this purely personal style, or are the generally accepted guidelines? Clearly, when dealing with numbers either $2 \cdot 2$ or $2 \times 2$ is needed, but within formulae where an absence of an operator implies multiplication, when should a \cdot be used? I tend to use it only sparingly if it aids in grouping. (Of course, barring the cases where it's required, e.g. a dot product.)
72967
When I entered the value $$\frac{1}{i}$$ in my calculator, I received the answer as $-i$ whereas I was expecting the answer as $i^{-1}$. Even google calculator shows the same answer (Click  to check it out).  Is there a fault in my calculator or $\frac{1}{i}$ really equals $-i$? If it does then how?
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?
70817
Why does $|e^{ix}|^2 = 1$?   The book said $e^{ix} = \cos x + i\sin x$, and square it, then $|e^{ix}|^2 = \cos^2x + \sin^2x = 1$.  But, when I calculated it, $ |e^{ix}|^2 = \left|\cos x + i\sin x\right|^2 = \cos^2x - \sin^2x + 2i\sin x\cos x$.  I can't make it to be equal $1.$ How can I do it?
97319
Can you please explain why \begin{align*} \lim_{x\to 0^+}{x^{x^x}} &amp;= 0 \end{align*}
63628
Here's an example:  Double d = (1/3); System.out.println(d);   This returns 0, not 0.33333... as it should.  Does anyone know?