MIPI_AdvancedC_FRTK/Lect1/20_task_11_page_28.c

27 lines
359 B
C
Raw Permalink Normal View History

2024-11-14 08:45:50 +03:00
#include <stdio.h>
#include <stdint.h>
union floatbit {
float value;
struct {
uint32_t mant : 23;
uint32_t exp : 8;
uint32_t sign : 1;
} bit;
} f;
float mult4(float f) {
union floatbit tmp;
tmp.value = f;
tmp.bit.exp += 2;
return tmp.value;
}
int main ()
{
float a, res;
scanf("%f",&a);
res = mult4(a);
printf("%.3f", res);
return 0;
}