divappr or approximate fraction (a diversion from sqrt...)

Torbjörn Granlund tg at gmplib.org
Sat Oct 17 13:13:03 UTC 2015


nisse at lysator.liu.se (Niels Möller) writes:

  When I looked into sqrt some months ago, I found that it would be nice
  with a divappr function which didn't require the low mostly
  uninteresting dividend limbs as input, a bit similar to bdiv_q.
  
  Maybe one shouldn't think about that as an approximate division, but
  rather as an approximate fraction. I've implemented one variant (see
  below), which takes as input two n limb numbers U and D, with D
  normalized. 
  
This is akin to good old mpn_tdiv_qr with its extra-limb argument which
we never actually allowd to be != 0.  I like the idea to provide the
fraction thing separately.

Depending on submul_1c is a bit of a practical problem, since it not
available in general.  We also lag in implementing addmul_1c (and lack
completely e.g. addmul_2c).

Long ago I looked into using addmul_1 for plain division (not bdiv);
that would speed up things and also simplify low-level code.  We might
want to look into that again.


-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list