Revision 8d164031 include/mpfr_lustre.c
include/mpfr_lustre.c | ||
---|---|---|
101 | 101 |
{ |
102 | 102 |
mpfr_set_si(out, i, MPFR_RNDN); |
103 | 103 |
} |
104 |
|
|
105 |
void MPFRreal_to_int_step (mpfr_t in1, int *out) |
|
106 |
{ |
|
107 |
*out = mpfr_get_sj (in1, MPFR_RNDN); |
|
108 |
} |
|
109 |
|
|
110 |
void MPFRFloor (mpfr_t in1, int *out) |
|
111 |
{ |
|
112 |
mpfr_t tmp; |
|
113 |
int prec; |
|
114 |
mpfr_init (tmp); // would be better to avoid local init |
|
115 |
prec = mpfr_get_prec (in1); |
|
116 |
mpfr_set_prec(tmp, prec); |
|
117 |
|
|
118 |
mpfr_floor(tmp, in1); |
|
119 |
*out = mpfr_get_sj (tmp, MPFR_RNDN); |
|
120 |
|
|
121 |
mpfr_clear(tmp); |
|
122 |
} |
|
123 |
|
|
124 |
void MPFRCeiling (mpfr_t in1, int *out) |
|
125 |
{ |
|
126 |
mpfr_t tmp; |
|
127 |
int prec; |
|
128 |
mpfr_init (tmp); // would be better to avoid local init |
|
129 |
prec = mpfr_get_prec (in1); |
|
130 |
mpfr_set_prec(tmp, prec); |
|
131 |
|
|
132 |
mpfr_ceil(tmp, in1); |
|
133 |
*out = mpfr_get_sj (tmp, MPFR_RNDN); |
|
134 |
|
|
135 |
mpfr_clear(tmp); |
|
136 |
} |
|
137 |
|
|
138 |
void MPFRRound (mpfr_t in1, int *out) |
|
139 |
{ |
|
140 |
mpfr_t tmp; |
|
141 |
int prec; |
|
142 |
mpfr_init (tmp); // would be better to avoid local init |
|
143 |
prec = mpfr_get_prec (in1); |
|
144 |
mpfr_set_prec(tmp, prec); |
|
145 |
|
|
146 |
mpfr_round(tmp, in1); |
|
147 |
*out = mpfr_get_sj (tmp, MPFR_RNDN); |
|
148 |
|
|
149 |
mpfr_clear(tmp); |
|
150 |
} |
|
151 |
|
|
104 | 152 |
// functions of lustrec_math |
105 | 153 |
void MPFRacos_step (mpfr_t i, |
106 | 154 |
mpfr_t out |
Also available in: Unified diff