MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Floating-Point Computing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93885] Floating-Point Computing
  • From: Antonio <aneves at gmail.com>
  • Date: Fri, 28 Nov 2008 05:04:32 -0500 (EST)

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




  • Prev by Date: Re: Numerical General Relativity packages
  • Next by Date: Re: Mathematica 7: PieChart: opacity of a sector label?
  • Previous by thread: Re: Numerical General Relativity packages
  • Next by thread: Re: Floating-Point Computing