Results 1 to 6 of 6

Thread: how float variable store in memory

  1. #1
    Join Date
    Feb 2014
    Beans
    3

    how float variable store in memory

    In GDB how to find float variable storage in memory ..
    and i want how float value converting into binary form .. can any one explain this ..!!!!!


    Thanks you ---

  2. #2
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,294
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: how float variable store in memory

    There is no special storage area in memory for floating-point variables, they are stored in exactly the same way as any other variable.
    「明後日の夕方には帰ってるからね。」


  3. #3
    Join Date
    Feb 2014
    Beans
    3

    Re: how float variable store in memory

    or can know how the float point variable into binary number ..???

  4. #4
    Join Date
    Sep 2010
    Beans
    898

    Re: how float variable store in memory


  5. #5
    Join Date
    Feb 2014
    Beans
    3

    Re: how float variable store in memory

    Thank You Dave_L ... But i need an example with explaination .... :

  6. #6
    Join Date
    Apr 2009
    Location
    Germany
    Beans
    2,134
    Distro
    Ubuntu Development Release

    Re: how float variable store in memory

    the wiki articles describes the common representation:
    http://en.wikipedia.org/wiki/Floating_point

    but how exactly its done depends on the platform, there are plenty variations.

    with gdb you can print it by reinterpreting it as an integers of equal size:

    p *(int64_t*)(address-of-double)
    p *(int32_t*)(address-of-float)
    Last edited by MadCow108; February 10th, 2014 at 07:20 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •