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: st: RE: RE: estimate precision in MATA
From
Marie-Claire Robitaille-Blanchet <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: RE: RE: estimate precision in MATA
Date
Thu, 23 Sep 2010 10:38:58 +0800
Thanks!
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stas Kolenikov
Sent: Wednesday, 22 September 2010 9:09 PM
To: [email protected]
Subject: Re: st: RE: RE: estimate precision in MATA
On Wed, Sep 22, 2010 at 2:25 AM, Marie-Claire Robitaille-Blanchet
<[email protected]> wrote:
> Let say I want to sum two variables. I can use format to increase the number of digits after the decimal point for the new variable = old_variable_1 + old_variable_2.
>
> I'm looking for the equivalent but when I sum matrixes in MATA. So I want to increase the number of digit after the decimal point for the new matrix I'm creating from already existing matrixes. And, if possible, I would prefer the entry in the new matrix to be in the data type: double.
Mata already operates in double precision. If you need even higher
precision for your computations, there are -quad*()- functions
available. For each individual number, you can -printf()- it in the
format you like:
. mata
: pi()
3.141592654
: printf("%20.18f",pi())
3.141592653589793100
Here, of course, the trailing zeroes are wrong, but Stata may have no
way of figuring out that they are.
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* 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/