]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot-ch/Gcbuiltin.c
1 /* Gcbuiltin.c provides access to some math intrinsic functions.
3 Copyright (C) 2016-2022 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius@glam.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)
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 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
22 #include "Gcbuiltin.h"
27 #define exp1 2.7182818284590452353602874713526624977572f
30 cbuiltin_sqrt (double x
)
36 cbuiltin_sqrtl (long double x
)
42 cbuiltin_sqrtf (float x
)
48 cbuiltin_exp (double x
)
54 cbuiltin_expf (float x
)
60 cbuiltin_expl (long double x
)
65 /* calculcate ln from log. */
68 cbuiltin_ln (double x
)
70 return log (x
) / log (exp1
);
74 cbuiltin_lnf (float x
)
76 return logf (x
) / logf (exp1
);
80 cbuiltin_lnl (long double x
)
82 return logl (x
) / logl (exp1
);
86 cbuiltin_sin (double x
)
92 cbuiltin_sinl (long double x
)
98 cbuiltin_sinf (float x
)
104 cbuiltin_cos (double x
)
110 cbuiltin_cosf (float x
)
116 cbuiltin_cosl (long double x
)
122 cbuiltin_tan (double x
)
128 cbuiltin_tanl (long double x
)
134 cbuiltin_tanf (float x
)
140 cbuiltin_arctan (double x
)
146 cbuiltin_arctanf (float x
)
152 arctanl (long double x
)
158 cbuiltin_entier (double x
)
160 return (int)floor (x
);
164 cbuiltin_entierf (float x
)
166 return (int)floorf (x
);
170 cbuiltin_entierl (long double x
)
172 return (int)floorl (x
);