mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
controllib: fix implicit cast warn with clang 10
This commit is contained in:
@@ -78,8 +78,8 @@ public:
|
|||||||
|
|
||||||
if (phase == 0) {
|
if (phase == 0) {
|
||||||
do {
|
do {
|
||||||
float U1 = (float)rand() / RAND_MAX;
|
float U1 = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
|
||||||
float U2 = (float)rand() / RAND_MAX;
|
float U2 = static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
|
||||||
V1 = 2 * U1 - 1;
|
V1 = 2 * U1 - 1;
|
||||||
V2 = 2 * U2 - 1;
|
V2 = 2 * U2 - 1;
|
||||||
S = V1 * V1 + V2 * V2;
|
S = V1 * V1 + V2 * V2;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public:
|
|||||||
virtual ~BlockRandUniform() = default;
|
virtual ~BlockRandUniform() = default;
|
||||||
float update()
|
float update()
|
||||||
{
|
{
|
||||||
static float rand_max = RAND_MAX;
|
static float rand_max = static_cast<float>(RAND_MAX);
|
||||||
float rand_val = rand();
|
float rand_val = rand();
|
||||||
float bounds = getMax() - getMin();
|
float bounds = getMax() - getMin();
|
||||||
return getMin() + (rand_val * bounds) / rand_max;
|
return getMin() + (rand_val * bounds) / rand_max;
|
||||||
|
|||||||
Reference in New Issue
Block a user