Thread: What is float equivalent of INT_MAX?

  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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

  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, 02: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, 05:26 PM