arb/arf/get_si.c

31 lines
713 B
C
Raw Normal View History

/*
2014-06-17 14:56:29 +02:00
Copyright (C) 2014 Fredrik Johansson
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/>.
*/
2014-06-17 14:56:29 +02:00
#include "arf.h"
2015-11-10 13:41:43 +00:00
slong
2014-06-17 14:56:29 +02:00
arf_get_si(const arf_t x, arf_rnd_t rnd)
{
fmpz_t t;
2015-11-05 18:00:39 +00:00
slong v;
2014-06-17 14:56:29 +02:00
fmpz_init(t);
arf_get_fmpz(t, x, rnd);
if (!fmpz_fits_si(t))
{
flint_printf("arf_get_si: result does not fit in a signed slong\n");
2014-06-17 14:56:29 +02:00
abort();
}
v = fmpz_get_si(t);
fmpz_clear(t);
return v;
}