Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: RE: Problem with "real" command


From   Jérôme Fauconnier <jerome.fauconnier@imag.fr>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Problem with "real" command
Date   Wed, 29 Jun 2011 16:50:42 +0200

It works
Thank you very much

Dr Jérôme Fauconnier
CHU Grenoble
Pôle de Santé Publique
Département d'Information Médicale
Pavillon Taillefer
BP217
38043 GRENOBLE cedex
Tel : + 33 4 76 76 50 35
Fax : + 33 4 76 76 52 02
mail : jerome.fauconnier@imag.fr

Le 29 juin 2011 à 14:24, Nick Cox a écrit :

> This is not a problem with the -real()- function at all. The problem lies in your use by default of a -float- variable type. 
> 
> You need to use a more appropriate storage type, e.g. -double-, to avoid precision problems. 
> 
> . gen double numven6=real("600010154088")
> 
> . format numven6 %18.0f
> 
> . l numven6 in 1
> 
>     +--------------+
>     |      numven6 |
>     |--------------|
>  1. | 600010154088 |
>     +--------------
> 
> -search precision- for many sources of further information. 
> 
> Nick 
> n.j.cox@durham.ac.uk 
> 
> Jérôme Fauconnier
> 
> When I  use the "real" function with large numbers, I have random results as  :
> 
> command :
> gen numven6=real("600010154088")
> 
> i get the following result :
> 
> numven6=600010129408
> 
> Have anybody had the same problem?
> 
> *
> *   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/


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