[comp.lang.modula2] Logitech 3.x longint bug warning

tom@mims-iris.waterloo.edu (Tom Haapanen) (09/27/89)

I was having real problems getting my numeric conversion routine working
for integers; it was fine for cardinals.  The routine converts a string
to a longint and then does a range check before a conversion.  But, beware:

	WriteLongInt(VAL(LONGINT, MAX(INTEGER)), 10);
	WriteLongInt(VAL(LONGINT, MIN(INTEGER)), 10);

produces the output

	     32767     32768

Pretty sad ... so longints are STILL buggy in Logitech 3.x.  Can anybody
check if this is also true in the OS/2 version?

					\tom haapanen
"now, you didn't really expect          tom@mims-iris.waterloo.edu
 my views to have anything to do        watmims research group
 with my employer's, did you?"          university of waterloo

erja@epimetheus.dk (Erik Jacobsen) (09/28/89)

In article <3298@watale.waterloo.edu> tom@mims-iris.waterloo.edu (Tom Haapanen) writes:
> [Deleted]
>Pretty sad ... so longints are STILL buggy in Logitech 3.x.  Can anybody
>check if this is also true in the OS/2 version?

We have version 3.03 of the LogiTech Modula2-compiler (MS-DOS).
We had this example today:

            PROCEDURE f(l1,l2: LONGINT): LONGINT;
            ...
          VAR
            l1,l2,l3: LONGINT;
            ...
            l1 := l1 + f(l2,l3);

This gave weird results in 'l1'. Rewriting to

            PROCEDURE f(l1,l2: LONGINT): LONGINT; 
            ... 
          VAR 
            l1,l2,l3,l4: LONGINT; 
            ... 
            l4 := f(l2,l3);
            l1 := l1 + l4;

gave the correct result.

Always make expressions involving LONGINTs as simple as possible,
using your own temporary variables (this of course only
applies to the LogiTech-compiler!).

Erik

--------------------------------------------------------------------
Erik Jacobsen,     Computer Science Department,    Aarhus University
Ny Munkegade,    Building 540,       DK-8000 Aarhus C,       Denmark

Phone: +45 86127188, Telefax: +45 86135725, Home phone: +45 86169199
         Internet: erja@daimi.dk,           Ham-radio: OZ6KS