Hi,

The sqrt function does not accept integers of type unsigned long long int. Is there a pre-exisiting C++/C standard function that can compute square roots of integers of that size?

Thanks in advance,
Caelan.

Recommended Answers

All 6 Replies

Your only options appear to be:

  • Use long double
  • Make your own function

C++11 will do it, but will cast the parameter to double first.

Ok. So how would I go about making my own function to do it? I, not entirely sure how to write an efficient square root function.

Oh ok. Thanks a lot. I will have a good read of that.

And this will help with integer roots: http://en.wikipedia.org/wiki/Integer_square_root
It may be more to your needs. Do note that the output still needs to be a floating point value (float or double).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.