Leonardus
helper.h
Go to the documentation of this file.
1
17#pragma once
18
19#include <cstdint>
20#include <limits>
21#include <climits>
22#include <gmp.h>
23
24
26constexpr __float128 M_PI_180q = 0.017453292519943295769236907684886127134Q;
27
29constexpr __float128 M_180_PIq = 57.295779513082320876798154814105170332405Q;
30
32constexpr __float128 M_2PIq = 6.283185307179586476925286766559005768394Q;
33
35constexpr unsigned __int128 UINT128_MAX = std::numeric_limits<unsigned __int128>::max();
36
38constexpr __int128 INT128_MIN = std::numeric_limits<__int128>::min();
39
41constexpr __int128 INT128_MAX = std::numeric_limits<__int128>::max();
42
44constexpr size_t ULBITS = sizeof( unsigned long ) * CHAR_BIT;
45
47constexpr size_t ULCHUNKS = 128 / ULBITS;
48
50extern mpz_t MPZ_ZERO;
51
53extern mpz_t MPZ_ONE;
54
56extern mpz_t MPZ_INT128_MIN;
57
59extern mpz_t MPZ_INT128_MAX;
60
64void helper_init();
65
67void helper_clear();
68
71constexpr size_t maxrealprecision = 34;
72
74constexpr size_t maxarraynesting = 1000;
75
77constexpr size_t maxtreeheight = 1999;
78
80enum class AngularUnit : std::uint8_t {
81 DEG,
82 RAD
83};
84
85class Context;
86
88 using core_t = void( Context & );
The context of execution.
Definition: context.h:37
constexpr unsigned __int128 UINT128_MAX
Maximum unsigned int128.
Definition: helper.h:35
void helper_init()
Initializes MPZ_ global pseudo-constants.
Definition: helper.cpp:27
constexpr __int128 INT128_MIN
Minimum int128.
Definition: helper.h:38
void helper_clear()
Clears MPZ_ global pseudo-constants.
Definition: helper.cpp:40
constexpr size_t maxrealprecision
Valid decimal digits of a 113 bit mantissa of a 128 bit floating point number.
Definition: helper.h:71
mpz_t MPZ_INT128_MAX
mpz_t 2^127-1 initialized by helper_init().
Definition: helper.cpp:24
mpz_t MPZ_ONE
mpz_t 1 initialized by helper_init().
Definition: helper.cpp:22
AngularUnit
Angular Unit for trigonometric functions.
Definition: helper.h:80
constexpr __int128 INT128_MAX
Maximum int128.
Definition: helper.h:41
mpz_t MPZ_ZERO
mpz_t 0 initialized by helper_init().
Definition: helper.cpp:21
constexpr size_t ULCHUNKS
Number of unsigned longs fitting into an UINT128.
Definition: helper.h:47
void(Context &) core_t
A shortcut for the core code functions, the C++ implementations of the operators.
Definition: helper.h:88
constexpr size_t ULBITS
Number of bits in an unsigned long.
Definition: helper.h:44
constexpr __float128 M_180_PIq
180/pi.
Definition: helper.h:29
constexpr __float128 M_2PIq
2pi.
Definition: helper.h:32
constexpr size_t maxarraynesting
The maximum number of nesting levels of procedures accepted by the bind operator.
Definition: helper.h:74
constexpr size_t maxtreeheight
The maximum number of nesting levels of composite semantic objects.
Definition: helper.h:77
constexpr __float128 M_PI_180q
pi/180.
Definition: helper.h:26
mpz_t MPZ_INT128_MIN
mpz_t -2^127 initialized by helper_init().
Definition: helper.cpp:23
@ Q
SOQ.