What is float equivalent of INT_MAX?

This is a discussion on What is float equivalent of INT_MAX? within the C++ Programming forums, part of the General Programming Boards category; Hi all, I have a 32-bit processor, and I believe floats are generally given 23 bits for the mantissa, but ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    41

    What is float equivalent of INT_MAX?

    Hi all,
    I have a 32-bit processor, and I believe floats are generally given 23 bits for the mantissa, but I want to know for sure. However I'm running Red Hat Linux 9.0, which has no float.h that I can find, even though /usr/include/c++/3.2.2/cfloat seems to include it?? The cfloat header looks like this:

    Code:
    #ifndef _CPP_CFLOAT
    #define _CPP_CFLOAT 1
    #pragma GCC system_header
    #include <float.h>
    #endif
    but a 'find' doesn't yield any float.h anywhere on my system.

    My floats are 4 bytes in size, but how can I find how those 32 bits are actually structured, other than writing a for loop that just spits out the biggest number it can, then seeing how many bits are required to represent that number?
    Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,672
    float.h is stored in a funny place

    Try
    g++ -MD prog.cpp

    Then read the prog.d file for where everything actually came from.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    41
    wow, that's a handy trick. Thanks! It is weird that it's stored under a redhat directory, but that certainly answered my question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-13-2009, 03:25 PM
  2. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  3. Could somebody please help me with this C program
    By brett73 in forum C Programming
    Replies: 6
    Last Post: 11-25-2004, 01:19 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 04:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21