Re: Outdated libtool creates trouble on macOS

2023-07-31 Thread Niels Möller
FX Coudert  writes:

> From the generated files, it seems OK: the only effect is a change in
> the position of some code. Still, it needs to be tested on Windows,
> and I don’t have access to such machines.

One option to get a kind of windows testing is to cross compile, 

 ./configure --host=x86_64-w64-mingw32

and run tests using wine. On debian, the cross compiler is in the
package "gcc-mingw-w64-x86-64-win32".

Regards,
/Niels

-- 
Niels Möller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Outdated libtool creates trouble on macOS

2023-07-31 Thread FX Coudert
OK, final patch. This was the most painful, because I hate autoconf quoting, 
way too many brackets and parentheses. But the patch silences the remaining 
warnings about AC_TRY_COMPILE, AC_TRY_LINK, and AC_TRY_RUN. And it is verified 
to be a no-op in terms of the generated configure file (except the one comment 
changed on purpose, and one extraneous newline character removed).

Hopefully this makes gmp future-proof for at least 10 years in terms of 
autoconf/automake :)

The remaining warnings are:

> glibtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac,
> glibtoolize: and rerunning glibtoolize and aclocal.
> glibtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am.

which is perfectly safe to ignore (it’s just advice). And this:

> configure.ac:4045: warning: AC_PROG_LEX without either yywrap or noyywrap is 
> obsolete
> ./lib/autoconf/programs.m4:716: _AC_PROG_LEX is expanded from...
> ./lib/autoconf/programs.m4:709: AC_PROG_LEX is expanded from...
> aclocal.m4:9472: AM_PROG_LEX is expanded from...
> configure.ac:4045: the top level

which is also safe to ignore. I tried to silence it, but did not find a way: 
AM_PROG_LEX does not accept an extra argument, and switching from AM_PROG_LEX 
to AC_PROG_LEX would introduce a functional change. I’m not sure if the change 
would risk breaking some platforms for gmp with exotic flex implementations, so 
I did not want to risk it. I have filed the issue with automake, asking for 
their opinion on what I think is a automake / autoconf feature mismatch.

Cheers,
FX




ac_try.diff
Description: Binary data
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Outdated libtool creates trouble on macOS

2023-07-31 Thread FX Coudert
Fifth batch, fixing the following:

warning: back quotes and double quotes must not be escaped in: 
$as_me:${as_lineno-$LINENO}: WARNING: the \"none\" host is obsolete, use 
--disable-assembly
warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: 
the \"none\" host is obsolete, use --disable-assembly
warning: AC_OUTPUT should be used without arguments.

Almost there…

FX



batch5.diff
Description: Binary data
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Outdated libtool creates trouble on macOS

2023-07-31 Thread FX Coudert
> No problem, I’ll continue to post small batches of changes here when I get 
> some time.

Fourth patch in the series, dealing with win32 DLL’s. You said you had issues 
with this before, I implemented the changes recommended by the manual (and did 
not use autoupdate, which is not always reliable in my experience).

From the generated files, it seems OK: the only effect is a change in the 
position of some code. Still, it needs to be tested on Windows, and I don’t 
have access to such machines. If there are failures, an alternative would be to 
move up the call to "LT_INIT([win32-dll])” to where AC_LIBTOOL_WIN32_DLL 
previously was called.

Best,
FX




win32.diff
Description: Binary data





PS: for the record, after this is done, only the following remain:

warning: back quotes and double quotes must not be escaped in: 
$as_me:${as_lineno-$LINENO}: WARNING: the \"none\" host is obsolete, use 
--disable-assembly
warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: 
the \"none\" host is obsolete, use --disable-assembly
warning: AC_OUTPUT should be used without arguments.
warning: AC_PROG_LEX without either yywrap or noyywrap is obsolete

warning: The macro `AC_TRY_COMPILE' is obsolete.
warning: The macro `AC_TRY_LINK' is obsolete.
warning: The macro `AC_TRY_RUN' is obsolete.

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Outdated libtool creates trouble on macOS

2023-07-31 Thread FX Coudert
> Yes. But probably not this week for me, my holidays are just starting :-)

No problem, I’ll continue to post small batches of changes here when I get some 
time.

Third batch of changes, dealing with the following:

warning: The macro `AC_CHECK_LIBM' is obsolete.
warning: The macro `AC_PROG_CC_C99' is obsolete.
warning: The macro `AC_PROG_LIBTOOL' is obsolete.
warning: The macro `AC_PROG_NM' is obsolete.
warning: The macro `AC_TYPE_SIGNAL' is obsolete.

These obsolescences are part of the wider move to consider that C89 (or ANSI C) 
is always available. They have been in autoconf since 2012.

FX



batch3.diff
Description: Binary data
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


IEEE P754

2023-07-31 Thread Paul Zimmermann
   Hi,

the reference manual mentions IEEE P754, which was the temporary name during
the standard first version (Project 754 I guess). It should be replaced by
IEEE 754, or better IEEE 754-2019 (the latest revision).

Paul
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: bug

2023-07-31 Thread Paul Zimmermann
   Hi,

as a complement to Torbjörn answer:

1) the decimal string 0.693...875 cannot be represented exactly within 3000
   bits, thus the mpf_set_str() necessarily performs some rounding
2) the mpf_get_str() also has to perform some rounding, since you convert
   a 3000-bit number into a 99-digit decimal string
3) mpf functions do not specify any rounding, see the GMP reference manual:

   Note that the 'mpf' functions are _not_ intended as a smooth
extension to IEEE P754 arithmetic.  In particular results obtained on
one computer often differ from the results on a computer with a
different word size.

   New projects should consider using the GMP extension library MPFR
() instead.  MPFR provides well-defined precision
and accurate rounding, and thereby naturally extends IEEE P754.

4) with MPFR, if you tell mpfr_set_str to round up and mpfr_get_str to
   round to nearest, you get:

$ cat f.c
#include 
#include 

int main()
{
  mpfr_t x;
 mpfr_init2(x,3000);
 
mpfr_set_str(x,"0.6931471805599453094172321214581765680755001343602552541206800094933936219696947156058633269964186875",10,MPFR_RNDU);
 char str[300];
 mpfr_exp_t myexp;
 mpfr_get_str(str, &myexp, 10, 99, x, MPFR_RNDN);
 mpfr_clear(x);


printf("%s\n",str);
}

$ gcc f.c -lmpfr
$ ./a.out
693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418688

Best regards,
Paul Zimmermann

PS: followups about MPFR should go on the MPFR list

> From: 赵世忠 
> Date: Sun, 30 Jul 2023 08:41:43 +0800 (GMT+08:00)
> 
> mpf_t x;
> mpf_init2(x,3000);
> mpf_set_str(x,"0.6931471805599453094172321214581765680755001343602552541206800094933936219696947156058633269964186875",10);
> char str[300];
> mp_exp_t myexp;
> mpf_get_str(str, &myexp, 10, 99, x); 
> mpf_clear(x);
> 
> 
> printf("%s\n",str);
> 
> 
> The last digit should be '8', but mpf_get_str outputs '7'.
> 
> 
> 
> 
> 
> 
> ___
> gmp-bugs mailing list
> gmp-bugs@gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs
> 
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs