Re: Floating-Point Computing
- To: mathgroup at smc.vnet.net
- Subject: [mg93931] Re: Floating-Point Computing
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 28 Nov 2008 07:12:02 -0500 (EST)
- Organization: Uni Leipzig
- References: <ggofnk$rsh$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
Sum[Sqrt[n], {n, 1, 1000000000}]
NSum[Sqrt[n], {n, 1, 1000000000}] ??
Regards
Jens
Antonio wrote:
> Dear List,
>
> I came across this Sun article on floating point:
> http://developers.sun.com/solaris/articles/fp_errors.html
>
> which calculates the following code:
>
> main()
> {
> register i;
> double f=0.0;
> double sqrt();
>
> for(i=0;i<=1000000000;i++)
> {
> f+=sqrt( (double) i);
> }
> printf("Finished %20.14f\n",f);
> }
>
> whose correct answer using Euler-Maclaurin formula is:
> f=21081851083600.37596259382529338
>
> Tried to implement in mathematica, just for fun, so that later I could
> play with precision, but the kernel has no more memory and shuts down.
>
> N[Total[Sqrt[Range[1000000000]]]]
>
> Any ideas?
>
> ANtonio
>
>
>