Jump to content

mjwallin47

Members
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    Thanks, I'll give that a try. Mark
  2. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    Thanks DummZeuch, that is what I suspected and have started modifying the code as you suggested. The routine contains a lot of code so it is going to take a while. As I mentioned, the original code was written around 1998 (using Delphi 1, believe it or not) and back in 2014 I was contracted to convert the application so something that would compile in W7. I had to replace all of the ReportSmith reports but unfortunately, for one big key report they had used a reporting product called formGenWin which went out of business around 2006. I obtained as much of the source code of the product that was available, the latest in D5. The bank in their wisdom didn't want to spend the time and money to have me re-write the old report to allow later versions of Delphi. However, the code seemed to work without any exceptions until this t time (under MS 7, done on two years cycles) so I suspected an MS update to have something to do with this problem. This problem came up under MS7, I believe, but I am running MS10 on my machine. I will have to check with them to see what O/S they were using when this blowup occurred. Hopefully, I can get the error to disappear by doctoring the code as you suggest.
  3. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    They are defined as 'Double' inside of an object, so yes they are floating point. If I had done the original code, I would have used integers.
  4. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    Thanks Primoz, That helps me understand Delphi Loops better. Apparently the code works the way it is supposed to, but I think all of the ROUND and INT functions are at the root of my problem. There are a lot of places where code like the following horrors exist: FOR Age := Round(EntryAge) TO Round(RetireAge) Do Begin PVVBEA := PVVBEA + 12 * tBenRa[Age] * VP[Age] * Rate.QW[Age] * Rate.AM[Round(RetireAge), PartGender] * PMEA[Round(RetireAge - EntryAge)] / PMEA[Round(Age - EntryAge)] * Rate.V[Round(RetireAge - Age)] * PTEA[Round(Age - EntryAge)] / PTEA[Round(EntryAge - EntryAge)] * Rate.V[Round(Age - EntryAge)]; End; Its pretty ugly and there are numerous places where a division by zero or FPU errors could happen.
  5. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    Regarding my InvalidOp exception which was my orginal problem, I am having a hard time tracking down the exact location of the problem. The debugger gives me this: procedure _INT asm SUB ESP,4 FSTCW [ESP] FWAIT FLDCW cwChop FRNDINT FWAIT FLDCW [EXP] ADD ESP,4 I am not sure how this helps me find what's going on. Any assembler experts out there who could lend a hand? Thanks
  6. mjwallin47

    Delphi 5 FOR Loop problem (W10-64bit)

    Thanks for replying - I have looked for this in various Delphi manuals, help files and references online and none of them state what you said but I believe you. The code I am maintaining was originally written 20 years ago and I never had a need to change any of the complex algorithms related to financial calculations and assumed they were working as intended. I was trying to track down an Exception (InvalidOp) that has appeared recently in a part of the code that is run only every two years and it is the routine that has the suspected loop problem. The InvalidOp exception may not be related to this loop code but in trying to debug this Exception, I am trying everything. I am not sure that Delphi 5 is the problem but I have been running this code in Windows 10 64bit for some time. I had a similar problem with another D5 app years ago that nearly drove me nuts.
  7. I have been maintaining an old Delphi 5 application under Windows 10 (64bit) for bank for a number of years and have recently run what looks like a show stopper: I am finding an anomalous behavior in a FOR loop with Delphi 5 under Windows 10 64bit. Here is the simplified code: FOR i := nMin TO nEnd Do Begin // Code End The problem is that the code inside the begin..end is being run even if the range of the loop 0 to 0. To test this, I set both nMin and nEnd to 0 and the code inside the Begin..End is still being executed. I am also getting Invalid Op Exceptions. I know that Delphi 5 is way outdated but my client that has ignored my warnings for years and now is apparently going to have to pay the piper. Has anybody else run into this behavior with Delphi 5?
×