]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-libs-iso/LowShort.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-libs-iso / LowShort.def
1 (* LowShort.def provides access to limits of the gm2 SHORTREAL.
2
3 Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
21
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
26
27 DEFINITION MODULE LowShort;
28
29 (* Access to underlying properties of the type SHORTREAL *)
30
31 CONST
32 radix = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, radix> )) ; (* ZType *)
33 places = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, places> )) ; (* ZType *)
34 expoMin = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMin> )) ; (* ZType *)
35 expoMax = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, expoMax> )) ; (* ZType *)
36 large = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, large> )) ; (* RType *)
37 small = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, small> )) ; (* RType *)
38 IEC559 = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEC559> )) ; (* BOOLEAN *)
39 LIA1 = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, LIA1> )) ; (* BOOLEAN *)
40 ISO = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, ISO> )) ; (* BOOLEAN *)
41 IEEE = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, IEEE> )) ; (* BOOLEAN *)
42 rounds = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, rounds> )) ; (* BOOLEAN *)
43 gUnderflow = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, gUnderflow> )) ; (* BOOLEAN *)
44 exception = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, exception> )) ; (* BOOLEAN *)
45 extend = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, extend> )) ; (* BOOLEAN *)
46 nModes = __ATTRIBUTE__ __BUILTIN__ (( <SHORTREAL, nModes> )) ; (* ZType *)
47
48 TYPE
49 Modes = PACKEDSET OF [0 .. nModes-1];
50
51 PROCEDURE exponent (x: SHORTREAL): INTEGER;
52 (* Returns the exponent value of x *)
53
54 PROCEDURE fraction (x: SHORTREAL): SHORTREAL;
55 (* Returns the significand (or significant part) of x *)
56
57 PROCEDURE sign (x: SHORTREAL): SHORTREAL;
58 (* Returns the signum of x *)
59
60 PROCEDURE succ (x: SHORTREAL): SHORTREAL;
61 (* Returns the next value of the type SHORTREAL greater than x *)
62
63 PROCEDURE ulp (x: SHORTREAL): SHORTREAL;
64 (* Returns the value of a unit in the last place of x *)
65
66 PROCEDURE pred (x: SHORTREAL): SHORTREAL;
67 (* Returns the previous value of the type SHORTREAL less than x *)
68
69 PROCEDURE intpart (x: SHORTREAL): SHORTREAL;
70 (* Returns the integer part of x *)
71
72 PROCEDURE fractpart (x: SHORTREAL): SHORTREAL;
73 (* Returns the fractional part of x *)
74
75 PROCEDURE scale (x: SHORTREAL; n: INTEGER): SHORTREAL;
76 (* Returns the value of x * radix ** n *)
77
78 PROCEDURE trunc (x: SHORTREAL; n: INTEGER): SHORTREAL;
79 (* Returns the value of the first n places of x *)
80
81 PROCEDURE round (x: SHORTREAL; n: INTEGER): SHORTREAL;
82 (* Returns the value of x rounded to the first n places *)
83
84 PROCEDURE synthesize (expart: INTEGER; frapart: SHORTREAL): SHORTREAL;
85 (* Returns a value of the type SHORTREAL constructed from the given expart and frapart *)
86
87 PROCEDURE setMode (m: Modes);
88 (* Sets status flags appropriate to the underlying implementation of the type SHORTREAL *)
89
90 PROCEDURE currentMode (): Modes;
91 (* Returns the current status flags in the form set by setMode *)
92
93 PROCEDURE IsLowException (): BOOLEAN;
94 (* Returns TRUE if the current coroutine is in the exceptional execution state
95 because of the raising of an exception in a routine from this module; otherwise
96 returns FALSE.
97 *)
98
99 END LowShort.