FAQ 7.31

The precision of a floating point number is about 16 digits and your 'x' is
at that limit.  If you reduce it, you will see a result:

> x=0.99999999999999999
> 1-x
[1] 0
> print(1-x, digits=20)
[1] 0
> x=0.99999999999999
> print(1-x, digits=20)
[1] 0.00000000000000999200722162641
>


On Fri, Jan 8, 2010 at 11:56 AM, Paul Evans <p.evan...@yahoo.com> wrote:

> Hi all,
>
> How can I get R to change the default precision value? For example:
> > x=0.99999999999999999
> > 1-x
> [1] 0
> >
>
>
> Is there a way that I can get a non-zero value using some parameter, or
> some package?
> many thanks.
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to