Statalist The Stata Listserver


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

st: Display of data in the Data Editor


From   "Allan Reese (Cefas)" <allan.reese@cefas.co.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Display of data in the Data Editor
Date   Wed, 9 Aug 2006 12:34:05 +0100

Ngoc Anh asked why 6945.3 is displayed like 6945.299999.

Svend Juul explains, correctly, that computers work with binary numbers, 
and the number 6945.3 has no exact binary representation. 
_________________________________________

The display in the data editor is controlled by the format for the number, which Ngoc Anh can change.  However, I recently fell foul of the finite precision problem by creating new cases by copy'n'paste.  Although the new cases looked to have the same value, they sorted separately from the old ones.

The command "replace x=x[_n-1] in 11/20" 
would have copied the value keeping the same random bits at the end.  Setting the format as %20.19 showed why the values as pasted were different.

Allan Reese


***********************************************************************************
This email and any attachments are intended for the named recipient only.  Its unauthorised use, distribution, disclosure, storage or copying is not permitted.  If you have received it in error, please destroy all copies and notify the sender.  In messages of a non-business nature, the views and opinions expressed are the author's own and do not necessarily reflect those of the organisation from which it is sent.  All emails may be subject to monitoring.
***********************************************************************************


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index