move mag_add_ui_2exp_si to its own file and document it

This commit is contained in:
Fredrik Johansson 2016-02-28 02:39:07 +01:00
parent 2ba00389d6
commit 25d4fbcf92
7 changed files with 43 additions and 17 deletions

View file

@ -25,8 +25,6 @@
#include "acb.h"
void mag_add_ui_2exp_si(mag_t, const mag_t, ulong, slong);
static void
acb_rising_get_mag2_right(mag_t bound, const arb_t a, const arb_t b, ulong n)
{

View file

@ -66,17 +66,6 @@ arb_atan_inf_eps(arb_t z, const arf_t x, slong prec)
fmpz_clear(mag);
}
/* TODO: move out */
void
mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e)
{
mag_t t;
mag_init(t);
mag_set_ui_2exp_si(t, y, e);
mag_add(z, x, t);
mag_clear(t);
}
void
arb_atan_arf(arb_t z, const arf_t x, slong prec)
{

View file

@ -25,8 +25,6 @@
#include "arb.h"
void mag_add_ui_2exp_si(mag_t, const mag_t, ulong, slong);
/*
Determine N such that the error is bounded by 2^-prec.
We choose an N with many trailing zeros to improve efficiency

View file

@ -72,8 +72,6 @@ arf_log_via_mpfr(arf_t z, const arf_t x, slong prec, arf_rnd_t rnd)
TMP_END;
}
void mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e);
void
arb_log_arf_huge(arb_t z, const arf_t x, slong prec)
{

View file

@ -204,6 +204,10 @@ Arithmetic
Sets *z* to an upper bound for `x + 2^e`.
.. function:: void mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e)
Sets *z* to an upper bound for `x + y 2^e`.
.. function:: void mag_div(mag_t z, const mag_t x, const mag_t y)
.. function:: void mag_div_ui(mag_t z, const mag_t x, ulong y)

2
mag.h
View file

@ -305,6 +305,8 @@ void mag_add(mag_t z, const mag_t x, const mag_t y);
void mag_add_lower(mag_t z, const mag_t x, const mag_t y);
void mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e);
void mag_div(mag_t z, const mag_t x, const mag_t y);
MAG_INLINE void

37
mag/add_ui_2exp_si.c Normal file
View file

@ -0,0 +1,37 @@
/*=============================================================================
This file is part of ARB.
ARB is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
ARB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ARB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
=============================================================================*/
/******************************************************************************
Copyright (C) 2014 Fredrik Johansson
******************************************************************************/
#include "mag.h"
void
mag_add_ui_2exp_si(mag_t z, const mag_t x, ulong y, slong e)
{
mag_t t;
mag_init(t);
mag_set_ui_2exp_si(t, y, e);
mag_add(z, x, t);
mag_clear(t);
}