Boost logo

Boost Users :

Subject: Re: [Boost-users] [math][special_functions] Why is cbrt(x) slowerthan pow(x, 1/3)?
From: John Maddock (john_at_[hidden])
Date: 2010-01-14 07:06:47


> Thanks a lot for the suggestion: I didn't know that std::cbrt() exists!

There's no std:: version until the next C++ std comes out, some compilers
have a version in global namespace as part of their C99 and POSIX support,
others such as msvc do not.

> I
> alway relied on cplusplus.com as reference; I will have to change that! Of
> course this is again a lot faster:
>
> average time to compute 5000000 roots with pow(): 0.613 s.
> average time to compute 5000000 roots with cbrt(): 0.464 s.
>
> Thanks again - I am happy now... ;-)

Hopefully the Boost version will be able to match this soon... the limiting
factor at present seems to be the performance of frexp/ldexp which are
particularly bad on msvc :-(

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net