On Tue, Dec 3, 2024 at 8:24 AM 蒋力夫 Lifu JIANG <lifuji...@hkust-gz.edu.cn> wrote: > > In the following two files: > gcc/libquadmath/math/expq.c > glibc/blob/master/sysdeps/ieee754/ldbl-128/e_expl.c
It looks like a bug to me. I suggest filing one on the glibc side. Uses: /* Calculate t/32768. */ t = x + THREEp96; t -= THREEp96; and iff /* Calculate t/256. */ t = x + THREEp103; t -= THREEp103; is correct then indeed it's supposed to be THREEp96 and not THREEp94. > -------------------------------------------------------------------- > static const __float128 C[] = { > /* Smallest integer x for which e^x overflows. */ > #define himark C[0] > 11356.523406294143949491931077970765Q, > > /* Largest integer x for which e^x underflows. */ > #define lomark C[1] > -11433.4627433362978788372438434526231Q, > > /* 3x2^96 */ > #define THREEp96 C[2] > 237684487542793012780631851008.0Q, > > /* 3x2^103 */ > #define THREEp103 C[3] > 30423614405477505635920876929024.0Q, > > /* 3x2^111 */ > #define THREEp111 C[4] > 7788445287802241442795744493830144.0Q, > -------------------------------------------------------------------- > > Why is 3x2^96 defined as 59421121885698253195157962752 instead of > 237684487542793012780631851008? > 3x2^94=59421121885698253195157962752, > 3x2^96=237684487542793012780631851008, > 3x2^103=30423614405477505635920876929024, > 3x2^111=7788445287802241442795744493830144. >