Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Format problem?


From   Andrzej Niemierko <[email protected]>
To   Stata <[email protected]>
Subject   Re: st: Format problem?
Date   Sun, 29 Jan 2006 08:14:42 -0500

Thank you all for your kind responses. Indeed, using double solved this
annoying and important problem (the numbers are id numbers of patients). I
think that double (not float) should be a default setting in STATA. Saving
some memory is an important issue for only a small percentage of problems.
Andrzej


On 1/28/06 8:15 PM, "Neil Shephard" <[email protected]> wrote:

> On 1/29/06, Andrzej Niemierko <[email protected]> wrote:
>> Could someone please explain to me the following strange behaviour? When I
>> generate a new variable:
>> gen x1=3366161 and then:
>> gen x2=10*x1
>> the number that I get for x2 is 33661608 (not the correct number 33661610).
>> When the initial x1 number is 3366162 the x2 is correct, that is 33661620.
>> Any help?
>> Sorry if this is double post (from a different account).
> 
> Its not a problem specific to Stata, but is more general to copmuters
> and boils down to the fact that computers work in binary and there are
> some numbers that you can't represent accurately in binary.
> 
> For a brief overview in Stata see -man datatypes-, but for more
> information see some the archives, heres a start (searched using the
> term "precision")...
> 
> http://www.stata.com/slsearch.cgi?q=precision&t=statalist
> 
> HTH's
> 
> Neil
> --
> Email - [email protected]
> Website - http://slack.ser.man.ac.uk/
> Blog - http://slack---line.blogspot.com/
> Flickr - http://www.flickr.com/photos/slackline/
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index