mini-gmp mpz_{get,set}_d not fully compatible with GMP

Niels Möller nisse at lysator.liu.se
Fri Mar 30 09:15:46 UTC 2018


tg at gmplib.org (Torbjörn Granlund) writes:

> nisse at lysator.liu.se (Niels Möller) writes:
>
>   Torbjörn, what do you think? Are you aware of any system we'd like to
>   support but which lacks float.h?
>
> I have no idea about the presence of float.h in practice.

The data point we have is that back in 2002, it was missing on the C
compiler supplied with SunOS (and my guess is that it was included with
the "SunPRO" compiler Sun wanted to sell you separately).

But we can use https://codesearch.debian.net/ to get a little more data.

If we first get the list of packages which contains the strings
CONFIG_HEADER and float.h (these are the packages where it would make
sense with a configure check for it), that's 2665 packages. Not sure how
to do that as a single query, so I searched for one string at a time,
downloaded the list of matching packages, and combined using sort +
comm.

Next, get the list och packages containing the string HAVE_FLOAT_H.
That's 232 packages.

If we intersect those lists, we get 192 packages (gmp being one of them)
with configure checks for float.h.

If we take the difference, packages which use CONFIG_HEADER, and
float.h, but don't use any HAVE_FLOAT_H symbol, that's 2470 packages.
Some of the notable ones on the list:

  binutils
  bison
  cvs
  dropbear (ssh implementation often used on obscure embedded systems)
  erlang
  expat
  findutils
  firefox
  gdb
  gforth
  gnulib (unclear why that's packaged though)
  libjpeg6g
  lsh-utils (not active but old and has been known to work on obscure unix systems like irix)
  ntp
  octave
  patch
  recode
  screen
  sox
  tar
  tcl8.6
  tcsh
  tk8.6
  xterm

So a lot of old programs, several of them widely portable, seem to use
float.h unconditionally.

> I think it mkes sense to move to C99, but then we should of course first
> decide to do that, then start depending on its features,

I'm not thinking of float.h as a C99 thing, even if c99 formally made it
a mandatory language feature.

It's no big deal to keep the configure test in gmp, but it would help to
use float.h unconditionally in mini-gmp. 

And then we'd get the situation that if there are any systems with
compilers lacking float.h, it will no longer be possible to build gmp
natively there, one would need to cross compile it on a system where the
native compiler has float.h. Which is a bit odd.

Regards,
/Niels


-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list