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: Fischlin Andreas
Subject: Re: [Gm2] Are there standard functions such as FLOAT and TRUNC?
Date: Sat, 20 Feb 2010 14:48:42 +0100

Hi Gaius,

Remember, as of pim3 (Wirth, 1985) LONGREAL, LONGCARD, and LONGINT were introduced and concomitantly also FLOATD and TRUNCD. Wirth (1984, 1985) does introduce these new types for the very first time, but Wirth (1984; don't have 1985 handy right now) without the standard functions. However, in the implementations of Modula-2 you find at that time and later FLOATD and TRUNCD.

FLOATD(x) x a value of an integer type (any) and result being of type LONGREAL TRUNCD(x) x a value of type LONGREAL (could be iimplemented accepting any real type) and result being of type LONGINT. Requirement for success being that x must if truncated fall into the range of type LONGINT. Again the very specific behavior being implementation dependent (see also Wirth et al., 1992).

Regards,
Andreas
        

Cited References:
------------------------
Wirth, N., 1985 (ed. 3 (corr.)). Programming in Modula-2. Springer- Verlag: Berlin a.o. 202pp. Wi037

Wirth, N., 1984. Revisions and amendments to Modula-2. Institut für Informatik ETHZ, Swiss Federal Institute of Technology: Zürich, Switzerland. 27-28pp. (ftp://ftp.inf.ethz.ch/pub/publications/tech-reports/ ) Wi073

Wirth, N., 1985. Revisions and amendments to Modula-2. J. Pascal, Ada & Modula-2, 4(1): 25-28. Wi243

Wirth, N., Gutknecht, J., Heiz, W., Schär, H., Seiler, H., Vetterli, C., & Fischlin, A., 1992. MacMETH. A fast Modula-2 language system for the Apple Macintosh. User Manual. 4th, completely revised ed.. Department of Computer Sciences (ETH): Zürich, Switzerland. 116pp. (http://www.sysecol.ethz.ch/SimSoftware/RAMSES/MacMETH.html#Wirth92 ) Wi068



ETH Zurich
Prof. Dr. Andreas Fischlin
Systems Ecology - Institute of Integrative Biology
CHN E 21.1
Universitaetstrasse 16
8092 Zurich
SWITZERLAND

address@hidden
www.sysecol.ethz.ch

+41 44 633-6090 phone
+41 44 633-1136 fax

Make it as simple as possible, but distrust it!
________________________________________________________________________

On 19/Feb/2010, at 17:13 , Gaius Mulley wrote:

Gaius Mulley <address@hidden> writes:

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

Hi,

ok I've updated the documentation and should also correct the above it
should read:

TRUNC, FLOAT, STRUNC, SFLOAT, LTRUNC, LFLOAT which matches the naming
schema in ISO.  I've also modified gm2 and testsuite to allow SFLOAT,
LFLOAT etc rather than FLOATS, FLOATL

regards,
Gaius


_______________________________________________
gm2 mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/gm2





reply via email to

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