gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] More about LONGINT problem


From: John B. Wallace, Jr.
Subject: [Gm2] More about LONGINT problem
Date: Wed, 27 Oct 2004 22:16:26 -0400

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


John Wallace



reply via email to

[Prev in Thread] Current Thread [Next in Thread]