32 #ifndef VSMC_RNG_U01_H
33 #define VSMC_RNG_U01_H
72 #if VSMC_HAS_OPENCL_DOUBLE
74 #define U01_OPEN_OPEN_32 u01_open_open_32_53
75 #define U01_OPEN_CLOSED_32 u01_open_closed_32_53
76 #define U01_CLOSED_OPEN_32 u01_closed_closed_32_53
77 #define U01_CLOSED_CLOSED_32 u01_closed_closed_32_53
79 #define U01_OPEN_OPEN_64 u01_open_open_64_53
80 #define U01_OPEN_CLOSED_64 u01_open_closed_64_53
81 #define U01_CLOSED_OPEN_64 u01_closed_closed_64_53
82 #define U01_CLOSED_CLOSED_64 u01_closed_closed_64_53
84 #else // VSMC_HAS_OPENCL_DOUBLE
86 #define U01_OPEN_OPEN_32 u01_open_open_32_24
87 #define U01_OPEN_CLOSED_32 u01_open_closed_32_24
88 #define U01_CLOSED_OPEN_32 u01_closed_closed_32_24
89 #define U01_CLOSED_CLOSED_32 u01_closed_closed_32_24
91 #endif // VSMC_HAS_OPENCL_DOUBLE
93 #define VSMC_RNG_U01_31f (1.0f / (1024.0f * 1024.0f * 1024.0f * 2.0f))
94 #define VSMC_RNG_U01_24f (128.0f * VSMC_RNG_U01_31f)
95 #define VSMC_RNG_U01_23f (256.0f * VSMC_RNG_U01_31f)
96 #define VSMC_RNG_U01_32 (1.0 / (1024.0 *1024.0 * 1024.0 * 4.0))
97 #define VSMC_RNG_U01_63 (2.0 * VSMC_RNG_U01_32 * VSMC_RNG_U01_32)
98 #define VSMC_RNG_U01_53 (1024.0 * VSMC_RNG_U01_63)
99 #define VSMC_RNG_U01_52 (2048.0 * VSMC_RNG_U01_63)
121 #if VSMC_HAS_OPENCL_DOUBLE
152 {
return ((u & UINT64_C(0x7ffffffffffffe00)) + (u & 0x200)) *
VSMC_RNG_U01_63;}
213 #endif // VSMC_HAS_OPENCL_DOUBLE
215 #endif // VSMC_RNG_U01_H
static float u01_closed_closed_32_24(uint32_t u)
Converting 32-bits unsigned to single precision uniform .
static float u01_open_open_64_24(uint64_t u)
Converting 64-bits unsigned to single precision uniform .
static float u01_closed_closed_64_24(uint64_t u)
Converting 64-bits unsigned to single precision uniform .
static double u01_closed_open_32_53(uint32_t u)
Converting 32-bits unsigned to double precision uniform .
static float u01_closed_open_32_24(uint32_t u)
Converting 32-bits unsigned to single precision uniform .
static double u01_open_open_32_53(uint32_t u)
Converting 32-bits unsigned to double precision uniform .
static float u01_open_closed_64_24(uint64_t u)
Converting 64-bits unsigned to single precision uniform .
static double u01_open_closed_32_53(uint32_t u)
Converting 32-bits unsigned to double precision uniform .
static float u01_open_closed_32_24(uint32_t u)
Converting 32-bits unsigned to single precision uniform .
static float u01_closed_open_64_24(uint64_t u)
Converting 64-bits unsigned to single precision uniform .
#define VSMC_STATIC_INLINE
static double u01_closed_closed_32_53(uint32_t u)
Converting 32-bits unsigned to double precision uniform .
static double u01_open_closed_64_53(uint64_t u)
Converting 64-bits unsigned to double precision uniform .
static double u01_open_open_64_53(uint64_t u)
Converting 64-bits unsigned to double precision uniform .
static float u01_open_open_32_24(uint32_t u)
Converting 32-bits unsigned to single precision uniform .
static double u01_closed_closed_64_53(uint64_t u)
Converting 64-bits unsigned to double precision uniform .
static double u01_closed_open_64_53(uint64_t u)
Converting 64-bits unsigned to double precision uniform .