]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/root/ctfloat.h
Merge dmd upstream 6d5b853d3
[thirdparty/gcc.git] / gcc / d / dmd / root / ctfloat.h
1
2 /* Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
3 * http://www.digitalmars.com
4 * Distributed under the Boost Software License, Version 1.0.
5 * http://www.boost.org/LICENSE_1_0.txt
6 * https://github.com/dlang/dmd/blob/master/src/dmd/root/ctfloat.h
7 */
8
9 #pragma once
10
11 #include "longdouble.h"
12
13 // Type used by the front-end for compile-time reals
14 typedef longdouble real_t;
15
16 // Compile-time floating-point helper
17 struct CTFloat
18 {
19 static bool yl2x_supported;
20 static bool yl2xp1_supported;
21
22 static void yl2x(const real_t *x, const real_t *y, real_t *res);
23 static void yl2xp1(const real_t *x, const real_t *y, real_t *res);
24
25 static real_t sin(real_t x);
26 static real_t cos(real_t x);
27 static real_t tan(real_t x);
28 static real_t sqrt(real_t x);
29 static real_t fabs(real_t x);
30 static real_t ldexp(real_t n, int exp);
31
32 static bool isIdentical(real_t a, real_t b);
33 static bool isNaN(real_t r);
34 static bool isSNaN(real_t r);
35 static bool isInfinity(real_t r);
36
37 static real_t parse(const char *literal, bool *isOutOfRange = NULL);
38 static int sprint(char *str, char fmt, real_t x);
39
40 static size_t hash(real_t a);
41
42 // Constant real values 0, 1, -1 and 0.5.
43 static real_t zero;
44 static real_t one;
45 static real_t minusone;
46 static real_t half;
47 };