[M3devel] LONGINT, looks urgent...

Dragiša Durić dragisha at m3w.org
Mon Sep 28 13:17:34 CEST 2009


Mea culpa... Test code alone works well on LINUXLIBC6, it's obviously
something higher up. I've used Fmt.LongInt, but addedd to this code, it
also works well. I'll check it more, for now - sorry for false alarm.

On Sun, 2009-09-27 at 14:59 -0400, Tony Hosking wrote:
> It works OK for me on I386_DARWIN running with the CVS head.  This  
> program produces identical output for both the INTEGER and LONGINT  
> values.
> 
> Main.m3:
> 
> MODULE Main;
> IMPORT MainC;
> 
> VAR
>    a, i: INTEGER;
>    aa: LONGINT;
> BEGIN
>    i := 0;
>    FOR ii := 1L TO 1793L DO
>      INC(i);
>      a := i * 17 DIV 100;
>      MainC.PutInt(a);
>      aa := ii * 17L DIV 100L;
>      MainC.PutLong(aa);
>    END;
> END Main.
> 
> MainC.i3:
> 
> INTERFACE MainC;
> 
> <*EXTERNAL*> PROCEDURE PutLong (x: LONGINT);
> <*EXTERNAL*> PROCEDURE PutInt (x: INTEGER);
> 
> END MainC.
> 
> MainC.C:
> 
> #include <stdio.h>
> 
> void PutLong (long long x) {
>    printf("%d\n", x);
> }
> 
> void PutInt (long x) {
>    printf("%d\n", x);
> }
> 
> 
> On 26 Sep 2009, at 15:11, Dragiša Durić wrote:
> 
> > Spent a piece of day with
> >
> > pdv := osnovica * 17L DIV 100L;
> >
> > varying osnovica from 1, over 1791, 1793... and many more. It looks  
> > like
> > LONGINT arithmetic in anything except simplest expressions is broken.
> > When turned to:
> >
> > WITH step1 = osnovica * 17L, step2 = step1 DIV 100L DO
> >  pdv := step2;
> > END;
> >
> > it works...
> >
> > I have no much time ATM (doing various M3+Gtk+ tasks right now,  
> > tight on
> > delivery schedule) to check it more. My version is a bit rusty but not
> > much. If nobody makes more research, I'll - few weeks is most  
> > earliest I
> > can expect any free time.
> > -- 
> > Dragiša Durić <dragisha at m3w.org>
> 
-- 
Dragiša Durić <dragisha at m3w.org>




More information about the M3devel mailing list