Skip to content

Commit 55d4bd2

Browse files
committed
Fix implicit int to float conversion.
1 parent 336aa9c commit 55d4bd2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/unit/test_fixed_point.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,8 @@ void test_random_torture(void) {
287287

288288
for (int i = 0; i < 1000; i++) {
289289
/* Generate random values in safe range [-100, 100] */
290-
float f_a = ((float)rand() / RAND_MAX) * 200.0f - 100.0f;
291-
float f_b = ((float)rand() / RAND_MAX) * 200.0f - 100.0f;
290+
float f_a = ((float)((double)rand() / (double)RAND_MAX)) * 200.0f - 100.0f;
291+
float f_b = ((float)((double)rand() / (double)RAND_MAX)) * 200.0f - 100.0f;
292292

293293
fixed_t a = fixed_from_float(f_a);
294294
fixed_t b = fixed_from_float(f_b);

0 commit comments

Comments
 (0)