Commit 36a9fc06 authored by Igor Sugak's avatar Igor Sugak Committed by Facebook Github Bot

fix gcc-5 build

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
parent 918988e5
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <cmath>
#include <folly/experimental/Bits.h> #include <folly/experimental/Bits.h>
#include <glog/logging.h> #include <glog/logging.h>
...@@ -246,7 +248,7 @@ T testValue(int bits) { ...@@ -246,7 +248,7 @@ T testValue(int bits) {
if (std::is_signed<T>::value) { if (std::is_signed<T>::value) {
--bits; --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_GE(value, std::numeric_limits<T>::min());
CHECK_LE(value, std::numeric_limits<T>::max()); CHECK_LE(value, std::numeric_limits<T>::max());
return static_cast<T>(value); return static_cast<T>(value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment