Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Precision


From   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Precision
Date   Fri, 11 Nov 2005 09:54:37 -0500

You have forgotten to format the values properly, so you think you lost precision when you didn't. All of the digits in your example are maintained when you use doubles or destring. Try your code, but then :

di %20.10f c
348080.2688552010

Michael Blasnik
[email protected]

----- Original Message ----- From: "Sergio Correia" <[email protected]>
<snip>

However, as the following example can show, this is not enough to
maintain ALL the precision.

1) make the data
input str20 x
348080.2688552010
end

2)
gen a=real(x)
gen double b=real(x)
destring x, gen(c)
browse

3) Alternative (a) is pretty bad.
(b) and (c) give 3.4808026885520e+05, which is pretty close.

If that is not enough, I can't help.
<snip>
*
* 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