1
#ifndef _NPY_NPY_FPMATH_H_
2
#define _NPY_NPY_FPMATH_H_
4
#include "npy_config.h"
6
#include "numpy/npy_os.h"
7
#include "numpy/npy_cpu.h"
8
#include "numpy/npy_common.h"
11
/* This hardcoded logic is fragile, but universal builds makes it
12
* difficult to detect arch-specific features */
14
/* MAC OS X < 10.4 and gcc < 4 does not support proper long double, and
15
* is the same as double on those platforms */
16
#if NPY_BITSOF_LONGDOUBLE == NPY_BITSOF_DOUBLE
17
/* This assumes that FPU and ALU have the same endianness */
18
#if NPY_BYTE_ORDER == NPY_LITTLE_ENDIAN
19
#define HAVE_LDOUBLE_IEEE_DOUBLE_LE
20
#elif NPY_BYTE_ORDER == NPY_BIG_ENDIAN
21
#define HAVE_LDOUBLE_IEEE_DOUBLE_BE
23
#error Endianness undefined ?
26
#if defined(NPY_CPU_X86)
27
#define HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE
28
#elif defined(NPY_CPU_AMD64)
29
#define HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE
30
#elif defined(NPY_CPU_PPC) || defined(NPY_CPU_PPC64)
31
#define HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE
36
#if !(defined(HAVE_LDOUBLE_IEEE_QUAD_BE) || \
37
defined(HAVE_LDOUBLE_IEEE_QUAD_LE) || \
38
defined(HAVE_LDOUBLE_IEEE_DOUBLE_LE) || \
39
defined(HAVE_LDOUBLE_IEEE_DOUBLE_BE) || \
40
defined(HAVE_LDOUBLE_IEEE_DOUBLE_16_BYTES_BE) || \
41
defined(HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE) || \
42
defined(HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE))
43
#error No long double representation defined