Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: RE: RE: estimate precision in MATA

From   Stas Kolenikov <>
Subject   Re: st: RE: RE: estimate precision in MATA
Date   Wed, 22 Sep 2010 08:08:31 -0500

On Wed, Sep 22, 2010 at 2:25 AM, Marie-Claire Robitaille-Blanchet
<> 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()

: printf("%20.18f",pi())

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
Small print: I use this email account for mailing lists only.

*   For searches and help try:

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