🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #285

Re: RTE200 - not Delay!

#285
From: Robert AH Prins
Date: Tue, 15 Jun 1999 00:00
46 lines
2467 bytes
In article <7k3adq$ci3$1@ezekiel.eunet.ie>,
  "Frank Peelo" <fpeelo@indigo.ie> wrote:
>
> Robert AH Prins wrote in message <7k34er$qcn$1@nnrp1.deja.com>...
> >const
> >  a: longint = $80000000;
> >  b: longint = -1;
> >
> >begin
> >  writeln(a div b);
> >end.
> >
> >Any clues as to how to get rid of this one?
>
> $80000000 is the largest negative number that a LongInt can hold,
> ie -MaxLongInt-1
>
> If you multiply or divide it by -1 you get MaxLongInt+1 which
> will not fit in a LongInt.
>
> Are you sure LongInt is appropriate for what you are doing?

The problem is a program a friend gave me. It has no source, and is not
Y2K compliant, and according to him, would be very hard to replace. He
asked me if I can have a look at it, to see if I can add some windowing
logic. To do so, I have started to disassemble it, and while doing so, I
stumbled on 2 sections doing longint multiply & longint division, but
entirely with 8086 instructions. "Great, I can replace them with the BP7
RTL equivalent code, giving me about 40 bytes space" Of course, before
doing so, you check your code, using the boundary cases and while doing
so, I found that the BP7 RTL cannot handle the given division, the
current program returns -2147483648...., as does the TP6 and non-386
BP7. In many ways the RTE200 generated by BP7/386 is a blessing, and
maybe I should have posted with a title of "Help, _NO_ RTE200!"

In the event, I have decided to test for -2147483648/-1 and return the
incorrect answer to keep the program consistent.

Robert
--
Robert AH Prins
prinsra@williscorroon.com


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Technical Details
Message-ID: <7k4ufo$enb$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7k34er$qcn$1@nnrp1.deja.com> <7k3adq$ci3$1@ezekiel.eunet.ie>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111659,9ab1c9cdd12e03da
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,9ab1c9cdd12e03da
X-Google-Attributes: gid108ebd,public
From: Robert AH Prins <prinsra@williscorroon.com>
Subject: Re: RTE200 - not Delay!
Date: 1999/06/15
Message-ID: <7k4ufo$enb$1@nnrp1.deja.com>
X-Deja-AN: 489731804
References: <7k34er$qcn$1@nnrp1.deja.com> <7k3adq$ci3$1@ezekiel.eunet.ie>
X-Http-Proxy: 1.0 x29.deja.com:80 (Squid/1.1.22) for client 193.130.234.1
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Tue Jun 15 07:14:04 1999 GMT
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal
X-Http-User-Agent: Mozilla/4.05 [en] (WinNT; I)