# Finding square root using sqrt() function

Page 1 of 1

## 3 Replies - 3663 Views - Last Post: 20 December 2009 - 01:14 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=146347&amp;s=5ccae210dc76a9b3343df4b5ad09db69&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 amitjena

Reputation: 0
• Posts: 1
• Joined: 19-December 09

# Finding square root using sqrt() function

Posted 19 December 2009 - 07:24 PM

using sqrt() when i tried finding the square root of 2 it showed result correct upto 6 places then it rounded up.
I am a maths student so how can i get the square root of 2 upto 100 places of decimal without rounding up.
Is This A Good Question/Topic? 0

## Replies To: Finding square root using sqrt() function

### #2 no2pencil

• Professor Snuggly Pants

Reputation: 6644
• Posts: 30,937
• Joined: 10-May 07

## Re: Finding square root using sqrt() function

Posted 19 December 2009 - 07:27 PM

There is an entire wiki site devoted to the square root of two.

Show us what you've tried & we'll gladly help out as best we can.

### #3 NickDMax

Reputation: 2255
• Posts: 9,245
• Joined: 18-February 07

## Re: Finding square root using sqrt() function

Posted 19 December 2009 - 07:45 PM

Basically you need an arbitrary precision library. Or BIGNUM library. Floating point calculations are rather limited -- they are great for most things, but no so great for calculating sqrt(2) or PI to 100's or 1000's of decimal places.

Personally I just use mathematica:
```N[Sqrt[2] , 100] = 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573
```

but to do so in C/C++ is really not all that hard either (most arbitrary Precision libraries have a sqrt function).

### #4 janotte

• code > sword

Reputation: 991
• Posts: 5,141
• Joined: 28-September 06

## Re: Finding square root using sqrt() function

Posted 20 December 2009 - 01:14 AM

If you are a math's student you should think about whether C++ is the right language to be working in.

A specialised, maths rich language, like mathematica, might be more what you are looking for?
http://www.wolfram.com/