Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: error calculating powers


From   "Y.R.E. Retamal" <[email protected]>
To   [email protected]
Subject   Re: st: error calculating powers
Date   Tue, 11 Feb 2014 14:45:18 +0000

Dear Nick

Thank you very much for your help. It works perfectly.
Best wishes

Rodrigo



On 2014-02-11 12:12, Nick Cox wrote:
See the help on -precision-. You need a -double-.

. set obs 1
obs was 0, now 1

. gen double x1 = 3333^3

. gen x2 = 3333^3

. format %21x x*

. l

     +-----------------------------------------------+
     |                    x1                      x2 |
     |-----------------------------------------------|
  1. | +1.13dd59efa0000X+023   +1.13dd5a0000000X+023 |
     +-----------------------------------------------+

. format %15.0f x*

. l

     +---------------------------+
     |          x1            x2 |
     |---------------------------|
  1. | 37025927037   37025927168 |
     +---------------------------+

Nick
[email protected]


On 11 February 2014 10:59, Y.R.E. Retamal <[email protected]> wrote:
Dear list

I need to calculate large numbers using STATA. For example, 3333^3 =
37025927037

However, when I calculate it using STATA,

g example=3333^3
format %15.0f

The "example" variable shows the following values: 37025927168, quite
different from the true value.
Do you have any idea about this?

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index