carl
24.04
Computer ARithmetic Library
roundingConversion.h
Go to the documentation of this file.
1
/* This file contains the conversion for the rounding modes of the different floating point implementations.
2
*
3
* @file roundingConversion.h
4
* @author Stefan Schupp <stefan.schupp@cs.rwth-aachen.de
5
*
6
* @since 2013-12-16
7
* @version 2013-12-16
8
*/
9
10
#pragma once
11
12
#include <
carl-common/meta/platform.h
>
13
CLANG_WARNING_DISABLE(
"-Wsign-conversion"
)
14
#ifdef USE_MPFR_FLOAT
15
#include <mpfr.h>
16
#endif
17
CLANG_WARNING_RESET
18
19
#include <cassert>
20
21
namespace
carl
{
22
23
enum class
CARL_RND
:int
24
{
25
N
=0,
26
Z
=1,
27
U
=2,
28
D
=3,
29
A
=4
30
};
31
32
template
<
typename
NumberType>
33
struct
convRnd
34
{
35
CARL_RND
operator()
(
CARL_RND
_rnd )
36
{
37
return
_rnd;
38
}
39
};
40
#ifdef USE_MPFR_FLOAT
41
// mpfr specialization
42
template
<>
43
struct
convRnd<mpfr_ptr>
44
{
45
inline
mpfr_rnd_t
operator()
(
CARL_RND
_rnd )
46
{
47
switch
(_rnd)
48
{
49
case
CARL_RND::A
:
50
return
MPFR_RNDA;
51
case
CARL_RND::D
:
52
return
MPFR_RNDD;
53
case
CARL_RND::N
:
54
return
MPFR_RNDN;
55
case
CARL_RND::U
:
56
return
MPFR_RNDU;
57
case
CARL_RND::Z
:
58
return
MPFR_RNDZ;
59
default
:
60
// should not happen!
61
assert(
false
);
62
//return nullptr;
63
}
64
}
65
};
66
#endif
67
}
platform.h
carl
carl is the main namespace for the library.
carl::CARL_RND
CARL_RND
Definition:
roundingConversion.h:24
carl::CARL_RND::Z
@ Z
carl::CARL_RND::U
@ U
carl::CARL_RND::A
@ A
carl::CARL_RND::N
@ N
carl::CARL_RND::D
@ D
carl::convRnd
Definition:
roundingConversion.h:34
carl::convRnd::operator()
CARL_RND operator()(CARL_RND _rnd)
Definition:
roundingConversion.h:35
carl-arith
numbers
adaption_float
roundingConversion.h
Generated by
1.9.1