啦啦啦拉拉裤
2021-10-03 19:42
采纳率: 69.1%
浏览 46

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;
}

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题