Statalist


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

Re: st: Bug?


From   "David Muller" <davidmull@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Bug?
Date   Tue, 21 Oct 2008 12:01:55 +1100

Hi Le

This is a precision issue (not a bug). See the FAQ:

http://www.stata.com/support/faqs/data/float.html

If you use the following codes you will get the expected results.
Cheers,
David

**************************************************
 . di ceil(float((0.05-0.04)/0.01))
1

. di ceil(float((0.04-0.03)/0.01))
1

**************************************************

On 10/21/08, Le Wang <statauser@gmail.com> wrote:
> Hi all,
>
> Thanks in advance for your time.
>
> I am trying to use -- ceil() -- to do the following calculations that
> are supposed to give identical results, but the results turn out to be
> different. I couldn't figure out the solution to this problem.
>
> Le
>
> The codes
> -----------------------------------------------------------------------
>
> . di ceil((0.05-0.04)/0.01)
> 2
>
> . di ceil((0.04-0.03)/0.01)
> 2
>
>
> . di (0.04-0.03)/0.01
> 1
>
> -----------------------------------------------------------------------
>
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~
> Le Wang, Ph.D
> Assistant Professor
> Department of Economics
> University of New Hampshire
> *
> *   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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index