Jump to content

Home

What Nasa Spends Our Money On


Boba Rhett

Recommended Posts

actually coming to think of it....that's not very much work at all!

 

look at this simple C++ program

 

int a = 2;

cout << setprecision(10000000) << sqrt(a);

 

That little piece of code would easily chug out the first 10 million digits of the sqrt of 2...except, if i tried it on my delicate computer it might hang up or get stuck, but for one of NASA's best computers that program would be a joke...just output it to a file and then copy paste it into html...

 

or maybe not...but there sure is a simple way to do it :o

Link to comment
Share on other sites

Originally posted by krkode

actually coming to think of it....that's not very much work at all!

 

look at this simple C++ program

 

 

 

That little piece of code would easily chug out the first 10 million digits of the sqrt of 2...except, if i tried it on my delicate computer it might hang up or get stuck, but for one of NASA's best computers that program would be a joke...just output it to a file and then copy paste it into html...

 

or maybe not...but there sure is a simple way to do it :o

 

 

That wouldn't work at all.....You didn't #include iomanip.h.....or iostream.h. ;)

 

 

Yeah, that is about how simple it is though, just would take a long time to get all those numbers. Hmmm...maybe i'll try it next compsci class, see what happens :D

Link to comment
Share on other sites

we have to assume that it has all been declared :D

 

anyway, i tried it with 100 and 150 and it still gives me the first 20 or so digits only :( --> also might depend on what compiler you use

 

But that's only an intro program, i'm sure there are ones more complicated than that that could output 1 million :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...