Cubic Root

J

JKop

Could someone please point me to somewhere where I can get a full
complete reference of the C++ Standard Libaries, how to use all their
functions and global varibles.


Is there any function in the Stdlib for getting the cubic root of a
number?


Thanks,
-JKop
 
P

P.J. Plauger


And there you will find that cbrt is a C99 function. It's not
required for Standard C++. The C++ committee recently voted to
add cbrt and all the other C99 additions to TR1 the (non-normal)
addition to the Standard C++ library currently being developed.
We, of course, already offer it as part of our C/C++ library.

You can, of course, use pow(x, 1.0 / 3.0), but it is typically
way slower and not nearly as accurate as cbrt, at least with
most libraries and some values of x. My bet is that it will do
what you need quite nicely, however.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
C

Claudio Puviani

P.J. Plauger said:
And there you will find that cbrt is a C99 function. It's not
required for Standard C++. The C++ committee recently voted to
add cbrt and all the other C99 additions to TR1 the (non-normal)
addition to the Standard C++ library currently being developed.
We, of course, already offer it as part of our C/C++ library.

You can, of course, use pow(x, 1.0 / 3.0), but it is typically
way slower and not nearly as accurate as cbrt, at least with
most libraries and some values of x. My bet is that it will do
what you need quite nicely, however.

Yeah, sure, but when will they add the really useful functions like
one_plus_fourth_root_of_n_all_over_two_pi()?

Claudio Puviani
 
J

JKop

Claudio Puviani posted:
Yeah, sure, but when will they add the really useful functions like
one_plus_fourth_root_of_n_all_over_two_pi()?

Claudio Puviani


I think it'd be a fairly common opinion that "cbrt" would be allot
more commonly used than your contrived example.
 
C

Claudio Puviani

JKop said:
Claudio Puviani posted:


I think it'd be a fairly common opinion that "cbrt" would be allot
more commonly used than your contrived example.

When you're done studying C++, you might want to direct your attention to the
concept of humor. It will help you on those occasions when regulars of this
newsgroup fire off jokes at each other.

Claudio Puviani
 
J

JKop

Claudio Puviani posted:
When you're done studying C++, you might want to direct your attention
to the concept of humor. It will help you on those occasions when
regulars of this newsgroup fire off jokes at each other.

Claudio Puviani


Sorry, I assumed your post was sarcasm.
 
G

Gunnar G

You can, of course, use pow(x, 1.0 / 3.0), but it is typically
way slower and not nearly as accurate as cbrt, at least with
most libraries and some values of x. My bet is that it will do
what you need quite nicely, however.
Could you tell me(us) more about the speed and accuracy? Of if you have
some links to some documentation.

Gunnar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top