unsigned conversion in C works as expected on x86 but not ARM [duplicate]

本秂侑毒 提交于 2020-05-17 09:05:30

问题


I am facing a problem running a C program on ARM processor.

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

int main()
{
    float f = -40.000000;
    unsigned int a = f;

    printf("\t Actual TX Power = %0.2f dBm \n",
         (double)(int)a);

    return 0;
}

outputs:

on x86-        Actual TX Power = -40.00 dBm
on ARM-        Actual TX Power = -0.00 dBm

The value survives the round-trip on x86 but not ARM.

I am not able to figure out what is the issue. What could be the reason behind it.

来源:https://stackoverflow.com/questions/60925860/unsigned-conversion-in-c-works-as-expected-on-x86-but-not-arm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!