fix gcc-5 build
authorIgor Sugak <sugak@fb.com>
Fri, 6 Jan 2017 04:11:17 +0000 (20:11 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 6 Jan 2017 04:17:59 +0000 (20:17 -0800)
Summary:
Clang with libgcc-5 reported:
```lang=bash
folly/experimental/test/BitsTest.cpp:249:16: error: use of undeclared identifier 'pow'
  auto value = pow(2, bits) * (negate ? -2.0 : 2.0) / 3.0;
               ^
```
Add missing include statement, and elaborate with the namespace.

Reviewed By: yfeldblum

Differential Revision: D4385807

fbshipit-source-id: a847dd439cd4c9f28ea8f222aa4ab60876949d13

folly/experimental/test/BitsTest.cpp

index af7038249a2499ac55c493691e8a7261f7224370..aeff9d35e511af0b5383022848049227c0c675fd 100644 (file)
@@ -14,6 +14,8 @@
  * limitations under the License.
  */
 
  * limitations under the License.
  */
 
+#include <cmath>
+
 #include <folly/experimental/Bits.h>
 
 #include <glog/logging.h>
 #include <folly/experimental/Bits.h>
 
 #include <glog/logging.h>
@@ -246,7 +248,7 @@ T testValue(int bits) {
   if (std::is_signed<T>::value) {
     --bits;
   }
   if (std::is_signed<T>::value) {
     --bits;
   }
-  auto value = pow(2, bits) * (negate ? -2.0 : 2.0) / 3.0;
+  auto value = std::pow(2, bits) * (negate ? -2.0 : 2.0) / 3.0;
   CHECK_GE(value, std::numeric_limits<T>::min());
   CHECK_LE(value, std::numeric_limits<T>::max());
   return static_cast<T>(value);
   CHECK_GE(value, std::numeric_limits<T>::min());
   CHECK_LE(value, std::numeric_limits<T>::max());
   return static_cast<T>(value);