C语言问题 使用位运算将浮点数乘以 2048

请问这个要怎么解决?在“PUT YOUR CODE HERE”写内容,前面内容不要改动,按照要求来写,da佬编写1下,蟹蟹大lao,可以用下面的例子来测试是否正确。

img

img

img


// Multiply a float by 2048 using bit operations only

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <assert.h>

#include "floats.h"

// float_2048 is given the bits of a float f as a uint32_t
// it uses bit operations and + to calculate f * 2048
// and returns the bits of this value as a uint32_t
//
// if the result is too large to be represented as a float +inf or -inf is returned
//
// if f is +0, -0, +inf or -inf, or Nan it is returned unchanged
//
// float_2048 assumes f is not a denormal number
//
uint32_t float_2048(uint32_t f) {
    // PUT YOUR CODE HERE

    return 42;
}

1024=2的10次方,2048=2的11次方,左移1位相当于乘以2,所以左移11位就相当于乘以2048
float a;
a << 11;