Announce: GNU MPFR 4.2.0 is released

2023-01-06 Thread Vincent Lefevre
GNU MPFR 4.2.0 ("fondue savoyarde"), a C library for
multiple-precision floating-point computations with correct rounding,
is now available for download from the MPFR web site:

  https://www.mpfr.org/mpfr-4.2.0/

and from the GNU FTP site:

  https://ftp.gnu.org/gnu/mpfr/

Thanks very much to those who sent us bug reports and/or tested the
release candidate.

The SHA1 digests:
08390d482ffcb198329632c0bf76dace53016dd8  mpfr-4.2.0.tar.bz2
114083f1ff2cbfdc09864d240449eae382a38223  mpfr-4.2.0.tar.gz
4f734ca3ebceac28e2f944b131a47133b19e2c5e  mpfr-4.2.0.tar.xz
3bd321bf4be97012967ea7a6cf000b175725b4de  mpfr-4.2.0.zip

The SHA256 digests:
691db39178e36fc460c046591e4b0f2a52c8f2b3ee6d750cc2eab25f1eaa999d  
mpfr-4.2.0.tar.bz2
f1cc1c6bb14d18f0c61cc416e083f5e697b6e0e3cf9630b9b33e8e483fc960f0  
mpfr-4.2.0.tar.gz
06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993  
mpfr-4.2.0.tar.xz
f1a72de4bb157326ecfd82b52a9781313e07d5a82fe8f17a27d425ed4e7727a7  mpfr-4.2.0.zip

The signatures:
https://www.mpfr.org/mpfr-4.2.0/mpfr-4.2.0.tar.xz.asc
https://www.mpfr.org/mpfr-4.2.0/mpfr-4.2.0.tar.bz2.asc
https://www.mpfr.org/mpfr-4.2.0/mpfr-4.2.0.tar.gz.asc
https://www.mpfr.org/mpfr-4.2.0/mpfr-4.2.0.zip.asc

Each tarball is signed by Vincent Lefèvre. This can be verified using
the GPG key ID 5831D11A0D4DB02A; this key can be retrieved with:

  gpg --recv-keys 5831D11A0D4DB02A

or by downloading it from .
The key fingerprint is:

  A534 BE3F 83E2 41D9 1828  0AEB 5831 D11A 0D4D B02A

The signatures can be verified with: gpg --verify 
You should check that the key fingerprint matches.

Changes from versions 4.1.* to version 4.2.0:
- The "fondue savoyarde" release.
- Binary compatible with MPFR 4.0.* and 4.1.*, though some minor changes in
  the behavior of the formatted output functions may be visible, regarded
  as underspecified behavior or bug fixes (see below).
- New functions mpfr_cosu, mpfr_sinu, mpfr_tanu, mpfr_acosu, mpfr_asinu,
  mpfr_atanu and mpfr_atan2u.
- New functions mpfr_cospi, mpfr_sinpi, mpfr_tanpi, mpfr_acospi, mpfr_asinpi,
  mpfr_atanpi and mpfr_atan2pi.
- New functions mpfr_log2p1, mpfr_log10p1, mpfr_exp2m1, mpfr_exp10m1 and
  mpfr_compound_si.
- New functions mpfr_fmod_ui, mpfr_powr, mpfr_pown, mpfr_pow_uj, mpfr_pow_sj
  and mpfr_rootn_si (mpfr_pown is actually a macro defined as an alias for
  mpfr_pow_sj).
- Bug fixes.
  In particular, for the formatted output functions (mpfr_printf, etc.),
  the case where the precision consists only of a period has been fixed
  to be like ".0" as specified in the ISO C standard, and the manual has
  been corrected and clarified.
  The macros of the custom interface have also been fixed: they now behave
  like functions (except a minor limitation for mpfr_custom_init_set).

You can send success and failure reports to , and give
us the canonical system name (by running the "./config.guess" script),
the processor and the compiler version, in order to complete the
"Platforms Known to Support MPFR" section of the MPFR 4.2.0 web page.

Regards,

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Re: stdc_bit_ceil(3) and wrapping

2023-01-06 Thread Alejandro Colomar via Gcc



On 12/30/22 23:33, Alejandro Colomar wrote:

Hi Yann,

On 12/30/22 21:33, Alejandro Colomar wrote:

On 12/30/22 21:18, Yann Droneaud wrote:

What's wrong with the following ?


[...]





 unsigned long max = upper_bound - 1;
 unsigned long mask = ULONG_MAX >> __builtin_clzl(max);


I hate coding these magic operations out of a function, when I can give it a 
meaningful name.  That reads to me as a magic trick that many maintainers that 
read it after me will blame me for having to parse it.


Moreover, it requires you to have the special case for 0 at the top, which I 
don't want.


I reconsidered; my -1 was equally magic.  And by calling it 'mask',
ULONG_MAX >> n is something not so magic.

The builtin still has the problem that it requires special-casing 0, so I prefer 
the C23 call, which provides the behavior I want for 0:



unsigned long
shadow_random_uniform(unsigned long upper_bound)
{
 unsigned long  r, max, mask;

 max = upper_bound - 1;
 mask = ULONG_MAX >> leading_zerosul(max);


I just realized that this isn't good either.  Shifting right still has undefined 
behavior for max = 0.  I'll fall back to my original plan.




 do {
     r = shadow_random();
     r &= mask;  // optimization
 } while (r > max);

 return r;
}


And, now I don't need to add a wrapper around bit_ceil() that removes the UB. 
stdc_leading_zerosul() is just fine for this use case.


Cheers,

Alex



--



OpenPGP_signature
Description: OpenPGP digital signature


gcc-11-20230106 is now available

2023-01-06 Thread GCC Administrator via Gcc
Snapshot gcc-11-20230106 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/11-20230106/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 11 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-11 revision 65b768fdb1ad302a6537119305317f413bfcbe0e

You'll find:

 gcc-11-20230106.tar.xz   Complete GCC

  SHA256=806831ffc63736ea1aada5f839e08aa53a8196b7f3e07aead6fbcdc4be1baf5f
  SHA1=39dfbdea30bbcc405a77e6d65a1aea1cb44f34f5

Diffs from 11-20221230 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-11
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.