HELP: Floating point overflow (possible OT)

Discussion in 'C++' started by Hamish Dean, Dec 10, 2003.

  1. Hamish Dean

    Hamish Dean Guest

    Hi. To explain this, i'll list some relevant info:

    Prog1: A c++ dll, written by me.
    Prog2: A c++ dll, written by a 3rd party.
    Prog3: A c++ application, written by me.
    Prog4: A delphi 7 application, written by me.
    Prog5: A delphi 4 application, written by someone else.

    Prog1 calls a function from Prog2:

    try{
    DoSomething() /*call to Prog2*/
    }
    catch(...){};


    Prog3,4,5 all call the same function from Prog1, with the same input
    variables.

    Prog3,4 both run successfully, no issues.

    Prog5 says "Floating point overflow". This occurs somewhere in the
    DoSomething function, which I obtained from a 3rd party.

    Is this not an exception?? how come catch(...){} does not handle this?

    I am stumped as to how to fix this. Any advice appreciated.

    Hamish






    I've written a .dll in c++ (ProgA). At some point, ProgA
     
    Hamish Dean, Dec 10, 2003
    #1
    1. Advertising

  2. Hamish Dean

    David Fisher Guest

    Re: Floating point overflow (possible OT)

    "Hamish Dean" <> wrote:

    > Prog5 says "Floating point overflow". This occurs somewhere in the
    > DoSomething function, which I obtained from a 3rd party.
    >
    > Is this not an exception?? how come catch(...){} does not handle this?
    >
    > I am stumped as to how to fix this. Any advice appreciated.


    Sounds like a hardware exception as opposed to a "C++ Exception" ...

    Under UNIX you can catch them with signal(). I think Windows has a special
    form of try / catch ("__try" ?) - look up "Structured Exception Handling"
    (SEH) ...

    David F
     
    David Fisher, Dec 11, 2003
    #2
    1. Advertising

  3. Hamish Dean

    Marc Rohloff Guest

    "Hamish Dean" <> wrote in message news:<FaNBb.25435$>...

    > Prog5 says "Floating point overflow". This occurs somewhere in the
    > DoSomething function, which I obtained from a 3rd party.
    >
    > Is this not an exception?? how come catch(...){} does not handle this?
    >
    > I am stumped as to how to fix this. Any advice appreciated.


    Hamish,

    The first thing is that exception handlng doesn't work well across DLL
    calls. So a try / catch doesn't usually help.

    Your problem looks like it might have something to do with the
    configuration of the 8087 (floating point processor) control word.

    You can use a function like:

    function Get8087CW: word;
    asm
    FStCW [Result]
    end;

    To retrieve the control word and check its value under each situation.
    It is a bit mask so you may want to convert it to hex.

    If you have problems post the results here.

    Marc
     
    Marc Rohloff, Dec 11, 2003
    #3
    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. H aka N
    Replies:
    15
    Views:
    15,669
    Ben Jones
    Mar 2, 2006
  2. Motaz Saad
    Replies:
    7
    Views:
    6,494
  3. C. Sengstock

    floating point error: overflow?

    C. Sengstock, Sep 24, 2003, in forum: C Programming
    Replies:
    3
    Views:
    4,244
    Mike Wahler
    Sep 26, 2003
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,348
    Saraswati lakki
    Jan 6, 2012
  5. teeshift
    Replies:
    2
    Views:
    259
    Chris Pearl
    Dec 1, 2006
Loading...

Share This Page