Floats on 64 bit machines

Discussion in 'C++' started by ulvr@rogers.com, Jun 12, 2008.

  1. Guest

    Just a quick question -- are floats on 64 bit machines (Windows/Linux)
    still going to be 4 bytes, or will they be 8 bytes? Is there any
    guarentee that a float is four bytes?

    John
    , Jun 12, 2008
    #1
    1. Advertising

  2. James Kanze Guest

    On Jun 12, 4:20 pm, wrote:
    > Just a quick question -- are floats on 64 bit machines
    > (Windows/Linux) still going to be 4 bytes, or will they be 8
    > bytes? Is there any guarentee that a float is four bytes?


    No, there never has been. There's probably a minimum size (in
    bits), because the standard does make some guarantees concerning
    range and precision, but it's difficult to establish, since the
    standard allows different bases. And there's definitely no
    maximum size.

    If you limit yourself to machines with IEEE floating point, then
    you can pretty much count on a float being 32 bits---for most
    machines, this will mean a size of 4 (but from what I've heard,
    on some DSP, it will be a size of 1).

    --
    James Kanze (GABI Software) email:
    Conseils en informatique orient�e objet/
    Beratung in objektorientierter Datenverarbeitung
    9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34
    James Kanze, Jun 13, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,714
    Timothy Bendfelt
    Jan 19, 2007
  2. Kosio

    Floats to chars and chars to floats

    Kosio, Sep 16, 2005, in forum: C Programming
    Replies:
    44
    Views:
    1,244
    Tim Rentsch
    Sep 23, 2005
  3. Why Tea

    Arithmetic for 32-bit and 64-bit machines

    Why Tea, Jan 9, 2008, in forum: C Programming
    Replies:
    10
    Views:
    649
    cr88192
    Jan 10, 2008
  4. Rob Clewley
    Replies:
    4
    Views:
    2,652
    Martin v. Löwis
    Mar 22, 2009
  5. Sal
    Replies:
    16
    Views:
    186
    Ilya Zakharevich
    May 25, 2010
Loading...

Share This Page