gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Another problem with MAX(LONGREAL);


From: Gaius Mulley
Subject: Re: [Gm2] Another problem with MAX(LONGREAL);
Date: Mon, 23 Feb 2015 10:30:22 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Michael Riedl <address@hidden> writes:

> Gaius,
>
> maybe related to the last message - but may be independend from that
>
> Have a look on the following short example
>
> MODULE MaxReal2;
>
> IMPORT STextIO,SLongIO,SWholeIO;
>
> VAR   x : LONGREAL;
>       i : CARDINAL;
>
> BEGIN
>       x:=MAX(LONGREAL);
>
>       STextIO.WriteString("MAX(LONGREAL) = ");
>       SLongIO.WriteEng(x,8,16); (* crashes *)
>       STextIO.WriteLn;
>
>       REPEAT (* does not terminate *)
>         INC(i);
>         x:=0.1*x;
>         IF ((i MOD 100) = 0) THEN
>           STextIO.WriteString("i = ");
>           SWholeIO.WriteCard(i,8);
>           STextIO.WriteLn;
>         END;
>       UNTIL (x < 1000.0);
>
>       STextIO.WriteString("Number of devision by 10 = ");
>       SWholeIO.WriteCard(i,8);
>       STextIO.WriteLn;
>
> END MaxReal2.
>
> The output of MAX(LONGREAL) crashed - maybe something is wrong on the
> representation ? At test for NaN (IF (x # x) ) did not yield a result
> maybe it's INF ? That would explain the behaviour. 
>
> As I saw that LongReal is 12 Byte long my own test routines do not work
> and I don't have a clue about the representation of that kind of
> numbers. If it where INF all exponet bit should be set and all mantissa
> bits should be not set accoring to IEEE 754 - but I'm not sure here.
>
> Attached my test routines which where designed to 4 BYTE REAL and 8
> BYTE LONGREAL (which I assumed in most of my numerical code). If there
> something of interrest in that module - feel free to use that (but please 
> cross-check the code ;-) ).
>
> Gruß / Regards
>
> Michael

Hi Michael,

likewise thanks for the bug report - will investigate!

regards,
Gaius



reply via email to

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