samples: bluetooth: fix double promotions

Double promotion warnings are generated with the flag -Wdouble-promotion

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
Ryan McClelland 2023-07-19 11:25:50 -07:00 committed by Carles Cufí
commit 57f49ca2d2
3 changed files with 3 additions and 3 deletions

View file

@ -171,7 +171,7 @@ static void print_stats(char *name, struct iso_recv_stats *stats)
LOG_INF("%s: Received %u/%u (%.2f%%) - Total packets lost %u",
name, stats->iso_recv_count, total_packets,
(float)stats->iso_recv_count * 100 / total_packets,
(double)((float)stats->iso_recv_count * 100 / total_packets),
stats->iso_lost_count);
}

View file

@ -170,7 +170,7 @@ static void print_stats(char *name, struct iso_recv_stats *stats)
LOG_INF("%s: Received %u/%u (%.2f%%) - Total packets lost %u",
name, stats->iso_recv_count, total_packets,
(float)stats->iso_recv_count * 100 / total_packets,
(double)((float)stats->iso_recv_count * 100 / total_packets),
stats->iso_lost_count);
}

View file

@ -117,7 +117,7 @@ static void fill_audio_buf_sin(int16_t *buf, int length_us, int frequency_hz, in
{
const int sine_period_samples = sample_rate_hz / frequency_hz;
const unsigned int num_samples = (length_us * sample_rate_hz) / USEC_PER_SEC;
const float step = 2 * 3.1415 / sine_period_samples;
const float step = 2 * 3.1415f / sine_period_samples;
for (unsigned int i = 0; i < num_samples; i++) {
const float sample = sin(i * step);