## lustrec / include / mpfr_lustre.c @ 52016bbb

History | View | Annotate | Download (1.77 KB)

1 | 52016bbb | xthirioux | #include <mpfr.h> |
---|---|---|---|

2 | #include "mpfr_lustre.h" |
||

3 | |||

4 | const int MPFR_PREC = 15; |
||

5 | |||

6 | ```
void MPFRNeq_step (mpfr_t i1, mpfr_t i2,
``` |
||

7 | _Bool (*out) |
||

8 | ) |
||

9 | { |
||

10 | *out = mpfr_lessgreater_p(i1, i2); |
||

11 | } |
||

12 | |||

13 | ```
void MPFREq_step (mpfr_t i1, mpfr_t i2,
``` |
||

14 | _Bool (*out) |
||

15 | ) |
||

16 | { |
||

17 | *out = mpfr_equal_p(i1, i2); |
||

18 | } |
||

19 | |||

20 | ```
void MPFRGt_step (mpfr_t i1, mpfr_t i2,
``` |
||

21 | _Bool (*out) |
||

22 | ) |
||

23 | { |
||

24 | *out = mpfr_greater_p(i1, i2); |
||

25 | } |
||

26 | |||

27 | ```
void MPFRGe_step (mpfr_t i1, mpfr_t i2,
``` |
||

28 | _Bool (*out) |
||

29 | ) |
||

30 | { |
||

31 | *out = mpfr_greaterequal_p(i1, i2); |
||

32 | } |
||

33 | |||

34 | extern void MPFRLt_step (mpfr_t i1, mpfr_t i2, |
||

35 | _Bool (*out) |
||

36 | ) |
||

37 | { |
||

38 | *out = mpfr_less_p(i1, i2); |
||

39 | } |
||

40 | ```
void MPFRLe_step (mpfr_t i1, mpfr_t i2,
``` |
||

41 | _Bool (*out) |
||

42 | ) |
||

43 | { |
||

44 | *out = mpfr_lessequal_p(i1, i2); |
||

45 | } |
||

46 | |||

47 | ```
void MPFRDiv_step (mpfr_t i1, mpfr_t i2,
``` |
||

48 | mpfr_t out |
||

49 | ) |
||

50 | { |
||

51 | mpfr_div(out, i1, i2, MPFR_RNDN); |
||

52 | } |
||

53 | |||

54 | ```
void MPFRTimes_step (mpfr_t i1, mpfr_t i2,
``` |
||

55 | mpfr_t out |
||

56 | ) |
||

57 | { |
||

58 | mpfr_mul(out, i1, i2, MPFR_RNDN); |
||

59 | } |
||

60 | |||

61 | ```
void MPFRMinus_step (mpfr_t i1, mpfr_t i2,
``` |
||

62 | mpfr_t out |
||

63 | ) |
||

64 | { |
||

65 | mpfr_sub(out, i1, i2, MPFR_RNDN); |
||

66 | } |
||

67 | |||

68 | ```
void MPFRPlus_step (mpfr_t i1, mpfr_t i2,
``` |
||

69 | mpfr_t out |
||

70 | ) |
||

71 | { |
||

72 | mpfr_add(out, i1, i2, MPFR_RNDN); |
||

73 | } |
||

74 | |||

75 | ```
void MPFRUminus_step (mpfr_t i,
``` |
||

76 | mpfr_t out |
||

77 | ) |
||

78 | { |
||

79 | mpfr_neg(out, i, MPFR_RNDN); |
||

80 | } |
||

81 | |||

82 | ```
void MPFRInit(mpfr_t i, mpfr_prec_t prec)
``` |
||

83 | { |
||

84 | mpfr_init2(i, prec); |
||

85 | } |
||

86 | |||

87 | ```
void MPFRClear(mpfr_t i)
``` |
||

88 | { |
||

89 | mpfr_clear(i); |
||

90 | } |