This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Initialize long with floats binary representation

Hello,

how can I achieve


long l = WHAT_EVER_MACRO (-12.5);

main()
{
  printf("%X",l);
}

resulting in output "0xC1480000" the binary representation of the float -12.5 .
Without that MACRO the value is 0xFFFFFFF4 = -12 for integers .

Because of given circumstances in an existing project I have to store float values during initialization in long variables.

Is there any possibility?

Thanks in advance

Jürgen

Parents
  • "But that would obviously depend on:"

    sure. but why is it relevant here?

    "So why did you write
    "and why you think it will help maintain data integrity / validity.""

    because I presumed that we were talking about THIS PARTICULAR case in this very discussion, not ALL cases.

    maybe that's an assumption not applicable to you guys?

Reply
  • "But that would obviously depend on:"

    sure. but why is it relevant here?

    "So why did you write
    "and why you think it will help maintain data integrity / validity.""

    because I presumed that we were talking about THIS PARTICULAR case in this very discussion, not ALL cases.

    maybe that's an assumption not applicable to you guys?

Children
No data