forked from mattpitkin/tempo2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TKlongdouble.ld.h
57 lines (46 loc) · 1.38 KB
/
TKlongdouble.ld.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef TKlongdouble_h
#define TKlongdouble_h
#define USE_BUILTIN_LONGDOUBLE
#include <math.h>
#ifdef sun
#include <sunmath.h>
//* there is no such file ! J. Wang */
// Note: you sometimes need a compile line e.g. -I/opt/SUNWspro/WS6U2/include/cc
#endif
#define longdouble(a) a##L
#define LD_PI M_PI
#ifdef USE_BUILTIN_LONGDOUBLE
#define LONGDOUBLE_IS_IEEE754
typedef long double longdouble;
#define LONGDOUBLE_ONE 1.0L
/* OSes/architectures lacking built-in double; use "qd" library */
#else
#define LONGDOUBLE_IS_DDREAL
#include "dd.h"
typedef dd_real longdouble;
#define LONGDOUBLE_ONE "1.0"
dd_real pow(const dd_real &a, const dd_real &b);
//operator float(const dd_real &a);
#endif
/* function to get longdouble as string (%g style). This returns
std::string, from which you can get a normal C char * like this:
print_longdouble(x).c_str(). Unfortunately we can't just return char *
directly as it would end up pointing to de-allocated memory, and we
can't do it statically in case you want to say call this twice for
one printf */
#ifdef __cplusplus
#include <string>
std::string print_longdouble(const longdouble &ld);
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* function to parse a string as longdouble */
longdouble parse_longdouble(const char *str);
#ifdef __cplusplus
}
#endif
#define ld_printf printf
#define ld_fprintf fprintf
#define ld_sprintf sprintf
#endif