Daily bump.
[official-gcc.git] / gcc / m2 / gm2-libs / SMathLib0.mod
bloba9e926328dbc7952787dfb0b579694ba6386c8be
1 (* SMathLib0.mod provide access to the SHORTREAL instrinics.
3 Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
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.
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.
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.
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/>. *)
27 IMPLEMENTATION MODULE SMathLib0 ;
29 IMPORT cbuiltin, libm ;
31 PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_sqrtf)) sqrt (x: SHORTREAL): SHORTREAL;
32 BEGIN
33 RETURN cbuiltin.sqrtf (x)
34 END sqrt ;
36 PROCEDURE exp (x: SHORTREAL) : SHORTREAL ;
37 BEGIN
38 RETURN libm.expf (x)
39 END exp ;
43 log (b)
44 log (b) = c
45 a ------
46 log (a)
50 PROCEDURE ln (x: SHORTREAL) : SHORTREAL ;
51 BEGIN
52 RETURN libm.logf (x) / libm.logf (exp1)
53 END ln ;
55 PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_sinf)) sin (x: SHORTREAL) : SHORTREAL ;
56 BEGIN
57 RETURN cbuiltin.sinf (x)
58 END sin ;
60 PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_cosf)) cos (x: SHORTREAL) : SHORTREAL ;
61 BEGIN
62 RETURN cbuiltin.cosf (x)
63 END cos ;
65 PROCEDURE tan (x: SHORTREAL) : SHORTREAL ;
66 BEGIN
67 RETURN libm.tanf (x)
68 END tan ;
70 PROCEDURE arctan (x: SHORTREAL) : SHORTREAL ;
71 BEGIN
72 RETURN libm.atanf (x)
73 END arctan ;
75 PROCEDURE entier (x: SHORTREAL) : INTEGER ;
76 BEGIN
77 RETURN TRUNC (libm.floorf (x))
78 END entier ;
81 END SMathLib0.