gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] Are there standard functions such as FLOAT and TRUNC?


From: Gaius Mulley
Subject: Re: [Gm2] Are there standard functions such as FLOAT and TRUNC?
Date: Thu, 18 Feb 2010 11:41:31 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Carl Glassberg <address@hidden> writes:

> Hello, again.
>
> Are there standard functions such as FLOAT and TRUNC for conversion
> to/from SHORTREAL/REAL/LONGREAL?

Hi Carl,

yes FLOAT, TRUNC exist as well as, TRUNCS, TRUNCL.  Watch out for the
dialect of Modula-2 though since if you use -fpim2 -fpim3 or -fiso
TRUNC returns a CARDINAL.  Whereas -fpim4 TRUNC returns an INTEGER.
I'll update the documentation

> If not, can VAL(LONGREAL, ...) and so forth be used?

and VAL exists.

regards,
Gaius

> I am planning to test SHORTREAL/REAL/LONGREAL.
>
> So far, this is what gm2 versions of Machar yield as machine constants for 
> floating-point:
>
> (Created by converting machar.c to three gm2 versions, one each for
> SHORTREAL, REAL, LONGREAL)

very interesting..! 

> --------------------------------------------------------------
> (* SHORTREAL = float *)
> ibeta =           2
> it =              24
> irnd =            5
> ngrd =            0
> machep =         -23
> negep =          -24
> iexp =            8
> minexp =         -126
> maxexp =          128
> eps =   0.1192092E-6
> epsneg =   0.5960464E-7
> xmin =  0.1175494E-37
> xmax =  3.4028234E+38
> ---------------------------------------
> (* REAL = double *)
> ibeta =           2
> it =             53
> irnd =            5
> ngrd =            0
> machep =        -52
> negep =         -53
> iexp =           11
> minexp =        -1022
> maxexp =         1024
> eps =   0.222044604925031E-15
> epsneg =   0.111022302462515E-15
> xmin =  0.222507385850720E-307
> xmax =  1.797693134862315E+308
> -----------------------------------------------
> (* LONGREAL = long double *)
> ibeta =         2
> it =            64
> irnd =          5
> ngrd =          0
> machep =       -63
> negep =        -64
> iexp =          15
> minexp =       -16382
> maxexp =        16384
> eps =    0.108420217248550443E-18
> epsneg =    0.542101086242752217E-19
> xmin =  0.336210314311209350E-4931
> xmax =  1.189731495357231764E+4932
> ----------------------------------------------------
>
> Carl
>
>
>
>
>       
>
>
> _______________________________________________
> gm2 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gm2

reply via email to

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