diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2016-12-16 17:42:40 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-01-12 15:15:37 -0800 |
commit | 797249bf725051a07ad128b27a7f01d7be86f01c (patch) | |
tree | 1dc86f57f4ac6059a67ca44555995d6d282d400c /host | |
parent | 8cf404c6b261bed98d0f551dffbabe050c9f490e (diff) | |
download | uhd-797249bf725051a07ad128b27a7f01d7be86f01c.tar.gz uhd-797249bf725051a07ad128b27a7f01d7be86f01c.tar.bz2 uhd-797249bf725051a07ad128b27a7f01d7be86f01c.zip |
utils: tests: cast RAND_MAX to double before division
Diffstat (limited to 'host')
-rw-r--r-- | host/tests/convert_test.cpp | 4 | ||||
-rw-r--r-- | host/utils/converter_benchmark.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/host/tests/convert_test.cpp b/host/tests/convert_test.cpp index 6c1b94c45..dd04dcafc 100644 --- a/host/tests/convert_test.cpp +++ b/host/tests/convert_test.cpp @@ -285,8 +285,8 @@ BOOST_AUTO_TEST_CASE(test_convert_types_fc32_to_sc16){ const size_t nsamps = 13; std::vector<fc32_t> input(nsamps); BOOST_FOREACH(fc32_t &in, input) in = fc32_t( - (std::rand()/float(RAND_MAX/2)) - 1, - (std::rand()/float(RAND_MAX/2)) - 1 + (std::rand()/(RAND_MAX/2.0)) - 1, + (std::rand()/(RAND_MAX/2.0)) - 1 ); std::vector<uint32_t> interm(nsamps); std::vector<sc16_t> output(nsamps); diff --git a/host/utils/converter_benchmark.cpp b/host/utils/converter_benchmark.cpp index c0cd28440..f6d7e9650 100644 --- a/host/utils/converter_benchmark.cpp +++ b/host/utils/converter_benchmark.cpp @@ -82,8 +82,8 @@ void init_random_vector_complex_float(std::vector<char> &buf_ptr, const size_t n std::complex<T> * const buf = reinterpret_cast<std::complex<T> * const>(&buf_ptr[0]); for (size_t i = 0; i < n_items; i++) { buf[i] = std::complex<T>( - T((std::rand()/double(RAND_MAX/2)) - 1), - T((std::rand()/double(RAND_MAX/2)) - 1) + T(std::rand()/(RAND_MAX/2.0) - 1), + T(std::rand()/(RAND_MAX/2.0) - 1) ); } } |