Bookmark and Share

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


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: rounding the minimum of a negative number
Date   Thu, 10 Jan 2013 12:15:45 +0000

I don't think that is a clear specification of what Stata is doing (it
doesn't "make up its own digits") or of what it should, in your view,
do instead.

If you want _display_ to a fixed number of decimal places, that is
ultimately a question of formatting and not a problem of numerics.
That is,

display %3.2 f  1 + 98/100

will ensure that you see "1.98" and this last step is in essence
string manipulation with numeric characters. But all that is done by
(e.g.)

scalar foo = 1.98

is putting a binary approximation of 1.98 in a scalar. Adding bits
will change the accuracy of the approximation (only).

Nick

On Thu, Jan 10, 2013 at 12:59 AM, annoporci <annoporci@gmail.com> wrote:

>> 1. At machine level Stata's calculations are necessarily in binary.
>> Stata and most modern software go to enormous lengths to make it seem
>> otherwise, but the fact is inescapable, ineluctable and inevitable.
>
>
> Sure, I can't argue with that, but I would have expected Stata to keep a few
> digits of zeros stored in memory (say 6 zeros), instead of making up its own
> digits.

> Patrick Toche.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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