Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Why the square of a negative number is still negative

 From "Tiago V. Pereira" To statalist@hsphsun2.harvard.edu Subject st: Why the square of a negative number is still negative Date Fri, 16 Dec 2011 14:49:27 -0200 (BRST)

```Thank yo very much, Austin and João Ricardo, for your extremely useful
explanations.

Tiago

----------------------------------------

Dear statalisters,

Can someone explain why is this happening?:

local x = -2
*/Approach A:
dis (`x'^2)*(5)
*/Approach B:
dis (`x'*`x')*(5)
*/Approach C:
dis ((`x')^2)*(5)

My output is:

. dis (`x'^2)*(5)
-20

. */Approach B:

. dis (`x'*`x')*(5)
20

. */Approach C:

.  dis ((`x')^2)*(5)
20

Do I need vacations? (Am I forgetting something very simple from
mathematics?)

All the best,

Tiago

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```