HELP: Floating point overflow (possible OT)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hamish Dean

    HELP: Floating point overflow (possible OT)

    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


  • David Fisher

    #2
    Re: Floating point overflow (possible OT)

    "Hamish Dean" <h.dean@xtra.co .nz> wrote:
    [color=blue]
    > 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.[/color]

    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


    Comment

    • Marc Rohloff

      #3
      Re: HELP: Floating point overflow (possible OT)

      "Hamish Dean" <h.dean@xtra.co .nz> wrote in message news:<FaNBb.254 35$VV6.590783@n ews.xtra.co.nz> ...
      [color=blue]
      > 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.[/color]

      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

      Comment

      Working...