2016-04-26 17:20:05 +02:00
|
|
|
/*
|
2013-02-13 11:22:03 +01:00
|
|
|
Copyright (C) 2012 Fredrik Johansson
|
|
|
|
|
2016-04-26 17:20:05 +02:00
|
|
|
This file is part of Arb.
|
|
|
|
|
|
|
|
Arb is free software: you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
|
|
|
by the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-02-13 11:22:03 +01:00
|
|
|
|
|
|
|
#include "fmpr.h"
|
|
|
|
|
2015-11-10 13:41:43 +00:00
|
|
|
slong
|
2013-02-13 11:22:03 +01:00
|
|
|
fmpr_get_si(const fmpr_t x, fmpr_rnd_t rnd)
|
|
|
|
{
|
|
|
|
fmpz_t t;
|
2015-11-05 18:03:08 +00:00
|
|
|
slong v;
|
2013-02-13 11:22:03 +01:00
|
|
|
fmpz_init(t);
|
|
|
|
fmpr_get_fmpz(t, x, rnd);
|
|
|
|
if (!fmpz_fits_si(t))
|
|
|
|
{
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("fmpr_get_si: result does not fit in a signed slong\n");
|
2017-02-28 16:50:03 +01:00
|
|
|
flint_abort();
|
2013-02-13 11:22:03 +01:00
|
|
|
}
|
|
|
|
v = fmpz_get_si(t);
|
|
|
|
fmpz_clear(t);
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|