From josh.m.ulrich at gmail.com  Thu May 14 00:08:28 2009
From: josh.m.ulrich at gmail.com (Joshua Ulrich)
Date: Wed, 13 May 2009 17:08:28 -0500
Subject: [Rd] simple add error (PR#13699)
In-Reply-To: <20090513123512.32DFE282C768@mail.pubhealth.ku.dk>
References: <20090513123512.32DFE282C768@mail.pubhealth.ku.dk>
Message-ID: <8cca69990905131508ve1b96d7h67ce7ffadfbf5745@mail.gmail.com>

Gostan,

This is not a bug.  You're asking for 20 decimal digits of precision,
which is impossible with double-precision floating point arithmetic.

http://fr.wikipedia.org/wiki/Virgule_flottante

Best,
Josh
--
http://www.fosstrading.com



On Wed, May 13, 2009 at 7:35 AM,  <gostan at igmm.cnrs.fr> wrote:
> Full_Name: Gostan Thierry
> Version: 2.6.1 (2007-11-26)
> OS: Windows XP
> Submission from: (NULL) (193.49.190.42)
>
>
> I cannot explain why R seems to have problems adding two big numbers.
>
> sprintf("%f",10^4+10^19) gives "10000000000000010240.000000"
> ? ? ? ? ? ? ? ? ? ?instead of "10000000000000010000.000000"
>
> problems seems to arrive when i'm trying to add a big and a small number...
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] simple add error (PR#13699)
Joshua Ulrich