#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int main(int argc,char *argv[])
{
float temp=65519;
if (((short)temp) & 0x8000) //负数
{
printf("负 %f\n", (-1)*((float)((~(short)temp)+1))/10 ); //负 -1.700000
}
else
{
printf("正 %f", temp / 10);
}
return 0;
}
65519取反为16
(-1)*(16+1)/10=-1.7
#define Temperature(temperature) (float)((short)temperature & 0x8000? (-1) * ((~(short)temperature) + 1):temperature) //1温度带负数转换