Thread: Floating point error: Overflow !

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    2

    Exclamation Floating point error: Overflow !

    Hello,

    I use Turbo C for compiling firstly

    No problem in compiling. The program is about bank interests and have many long calculations.

    Can u give some informations about this alert?

    /*
    Floating point error: Overflow
    Abnormal program termination
    */

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You either have too big a number, or two many digits of precision. If you're using a 'float', try replacing all instances with 'double' instead.

    While you're at it, you probably want to get a real compiler (ie: Not 16bit) just for the hell of it.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Jul 2003
    Posts
    2
    with double, all calculations are wrong ! any idea about it?

    any documentation or something about overflow?
    Last edited by gvn; 07-17-2003 at 06:54 PM.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If you require precision, never use floating point numbers. Floating point numbers by nature are unprecise and have nasty little precision problems due to the way they're stored.

    I believe in limits.h or ... can't quite plaec it ... there are limits which define the upper and lower maximums for your floating point numbers. An overflow simply means you're running beyond that number.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    yes, the limits are in limits.h

    unsigned char is UCHAR_MAX
    unsigned short is USHRT_MAX

    so float is probably something like FLOAT_MAX
    Away.

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    Are you dividing by zero anywhere?

  7. #7
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by blackrat364
    yes, the limits are in limits.h

    unsigned char is UCHAR_MAX
    unsigned short is USHRT_MAX

    so float is probably something like FLOAT_MAX
    Limits.h only contains limits for integral types. You need to look in float.h for floating-point types limits.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decimal places on Floating point number
    By manutdfan in forum C Programming
    Replies: 1
    Last Post: 10-29-2006, 12:56 PM
  2. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 12:07 PM
  3. floating point question
    By Eric Cheong in forum C Programming
    Replies: 8
    Last Post: 09-10-2004, 10:48 PM
  4. 2 questions about floating point and %
    By ams80 in forum C Programming
    Replies: 2
    Last Post: 08-14-2002, 10:55 AM
  5. Replies: 2
    Last Post: 09-10-2001, 12:00 PM