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: rounding the minimum of a negative number

From   Maarten Buis <>
Subject   Re: st: rounding the minimum of a negative number
Date   Thu, 10 Jan 2013 15:53:46 +0100

On Thu, Jan 10, 2013 at 3:19 PM, annoporci wrote:
> Yes. I guess another way of expressing my puzzlement is that Stata does
> not display, by default, to a greater number of decimal places.

Stata is a program for statistical analysis. In any real statistical
analysis involving real data, any number beyond the first (maybe, if
you are lucky the second) is in essence random noice. So from that
perspective Stata is reporting way too many digits.

This is not to say that precision is not a problem. During
computations numerical precision is a major issue. However, my
impression, based on the couple of contacts I have had with the people
from StataCorp (mainly at Stata Users' Group meetings and just reading
what they have written), is that StataCorp tends to take this
extremely seriously.

> I don't know anything about this, but in Python, for instance, according
> to the documentation: "On a typical machine running Python, there are 53
> bits of precision available for a Python float." And, to quote more:
> If Python were to print the true decimal value of the binary approximation
> stored for 0.1, it would have to display:
> 0.1000000000000000055511151231257827021181583404541015625
> So that's still quite a few zeros after the first 1.

Compare that with Stata:
. di %30.25f 0.1

Does not look too different to me.

 > Would I get a more accurate approximation of "-1.981" with Stata if I
> input "-1.981000000001" than if I input "-1.981" ? in the sense that it
> would "force" Stata to store the zeros after 981? (or am I
> misunderstanding the whole issue?)

If you want to store a number equivalent to -1.981 exactly than you
need think in terms of integers, as computers can store integers up to
a given size(*) exactly. In this case you would store the number 1981.

Hope this helps,

(*) To see the limits see the the reference Nick gave you:
and the references therein.

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

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