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: RE: st: A bug in egen and gen?


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: RE: st: A bug in egen and gen?
Date   Fri, 18 Feb 2011 16:27:11 +0000

Not so. 

4.1 is an example of a number that has no exact binary representation. Thus, the -double- approximation and the -float- approximation differ and -compress- refuses to act. This is the sort of example discussed at length, and repeatedly, in Bill Gould's blog entries, to which you have already been referred, and in the literature which they point to, and in the manual entries to which they in turn refer. 

Please do read 

http://blog.stata.com/2011/02/02/how-to-read-the-percent-21x-format/

http://blog.stata.com/2011/02/10/how-to-read-the-percent-21x-format-part-2/

Anyone who wants the extra precision of a -double- -- and who declares emphatically that the extra detail is not noise -- should not complain about this or regard it as a misfeature, because Stata is refusing to discard the extra bits that they themselves insisted on having. Only if all those bits are zero will the -double- and -float- representations be identical. 

Nick 
[email protected] 

Liao, Junlin

[...] 

The -compress- command missing opportunity to reduce double to float can be easily demonstrated.

. set type double

. clear

. gen a=4.1

. compress

. des a

              storage  display     value
variable name   type   format      label      variable label
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a               double %10.0g

. recast float a

. des a

              storage  display     value
variable name   type   format      label      variable label
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
a               float  %10.0g



*
*   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/


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