Statalist The Stata Listserver


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

st: strange behavior using round function


From   Nicola Tommasi <[email protected]>
To   [email protected]
Subject   st: strange behavior using round function
Date   Tue, 12 Sep 2006 18:08:36 +0200

hi all,

I would appreciate if someone could help me understand why the ROUND function behaves so differently when calculating t1_y and t2_y
The result for t2_y should be 80.54
Below follows the code.

Thanks

Sincerely,

Nicola Tommasi



. matrix list mati;

mati[2,2]
       c1    c2
r1   818  1535
r2   248   371

. di "`tot1'";
1066

. di "`tot2'";
1906

. local t1_y = round(mati[1,1]/`tot1'*100, 0.01);

. local t2_y = round(mati[1,2]/`tot2'*100, 0.01);

. di "`t1_y'";
76.74

. di "`t2_y'";
80.54000000000001





______________________________________________________________
         dott. Nicola Tommasi
         Centro Interdipartimentale di Documentazione Economica (C.I.D.E)
         University of Verona
         via dell'Artigliere, 19
         37129 Verona (Italy)
         tel.: +39-045-8028048
         fax.: +39-045-8028047
_______________________________________________________________________

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