Sign in to follow this  

c++, should I create my own Complex Numbers class?

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to use complex numbers, and I've found that there is a std::complex class, but it doesn't have any sqrt function for it, so should I just create my own one, or is there a sqrt function for complex numbers hidden away somewhere in the std library? thx

Share this post


Link to post
Share on other sites
I think <complex> specialises std::sqrt() to work with it.

Remember the SC++L often uses free functions where some may expect member functions.

Even if it didn't instead of re-writing the entire class you could write a free function to compute the square root, much faster [smile]

Share this post


Link to post
Share on other sites

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this