[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] More about LONGINT problem
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] More about LONGINT problem |
Date: |
28 Oct 2004 11:23:10 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
"John B. Wallace, Jr." <address@hidden> writes:
> In my previous message I mentioned a problem with direct assignment of a
> constant to a LONGINT (or LONGCARD) variable. Here some is some test code to
> illustrate the problem:
>
>
> MODULE TestLong;
>
> FROM StrIO IMPORT WriteString, WriteLn;
>
> FROM FpuIO IMPORT StrToLongInt, WriteLongInt;
>
> TYPE
> String = ARRAY [0..255] OF CHAR;
>
> VAR
> LongIntegerVariable : LONGINT;
> St : String;
>
> BEGIN
> LongIntegerVariable := 12345678901234;
> WriteLongInt(LongIntegerVariable,0);
> WriteLn;
> St := '12345678901234';
> WriteString(St);
> WriteLn;
> StrToLongInt(St,LongIntegerVariable);
> WriteLongInt(LongIntegerVariable,0);
> WriteLn
> END TestLong.
>
>
> On my system the output is:
>
> 1942892530
> 12345678901234
> 12345678901234
>
> The assignment through string conversion seems to work, but not the direct
> assignment.
>
>
> I wanted to include the test code above in my previous message, but the
> StrToLongInt procedure would hang up (a continuous loop?), and it took
> some time to find the problem. I had to make a slight modification to the
> code in gm2-libs/FpuIO.mod. Here is the diff output:
>
>
> 18a19
> > (* Modified 26 October 2004 by j.b.Wallace, Modified File: FpuIO.mod.jbw
> *)
> 464a466,467
> > ELSE
> > finished := TRUE
> 466,467d468
> < ELSE
> < finished := TRUE
Hi John,
excellent stuff, thank you for the diff and example failure code,
Gaius