From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 14660 invoked from network); 22 Apr 2020 13:57:12 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 22 Apr 2020 13:57:12 -0000 Received: (qmail 10228 invoked by uid 550); 22 Apr 2020 13:57:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 10182 invoked from network); 22 Apr 2020 13:57:05 -0000 From: leijitang To: "musl@lists.openwall.com" CC: "zhangwentao (M)" , "wanghao (H)" , "Huangqiang (H)" Thread-Topic: Unexpected exceptions in math functions Thread-Index: AdYYrdsazDHWpCcjQ8CdsMk6xUA61Q== Date: Wed, 22 Apr 2020 13:56:46 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.166.215.54] Content-Type: multipart/alternative; boundary="_000_A157A71BEF653F4BB32E06650E67C99323A48532dggemm514mbxchi_" MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: [musl] Unexpected exceptions in math functions --_000_A157A71BEF653F4BB32E06650E67C99323A48532dggemm514mbxchi_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi all, Recently we update musl in our project from 1.1.2 to version 1.2.0. But the= re are some errors about math functions when running the opensource test cases for musl, which are passed in musl 1.1.2. These e= rrors are about exp2(), pow() and powf(). Logs are listed below. According to the commit message, the underflow exception is signaled if the= result is in the subnormal range even if the result is exact (e.g. exp2(-1023.0)). But we got INEXACT exception at t= he same time, which is not as expected. Is this a problem? Otherwise, there is a overflow exception in powf(0x1.fffffep+127,0x1p+0) wi= th FE_UPWARD rounding mode(log is also behind. As 0x1.fffffep+127 is the largest number that float can represent, there shoul= d not be INEXACT|OVERFLOW exceptions. If these are problems affirmed, is there any patch to fix this? / $ ./exp2.exe src/math/special/exp2.h:12: bad fp exception: RN exp2(-0x1.ff8p+9)=3D0x1p-1= 023, want 0 got INEXACT|UNDERFLOW src/math/special/exp2.h:18: bad fp exception: RN exp2(-0x1.ff8p+9)=3D0x1p-1= 023, want 0 got INEXACT|UNDERFLOW src/math/special/exp2.h:20: bad fp exception: RN exp2(-0x1p+10)=3D0x1p-1024= , want 0 got INEXACT|UNDERFLOW src/math/special/exp2.h:21: bad fp exception: RN exp2(-0x1.004p+10)=3D0x1p-= 1025, want 0 got INEXACT|UNDERFLOW src/math/special/exp2.h:22: bad fp exception: RN exp2(-0x1.0c8p+10)=3D0x1p-= 1074, want 0 got INEXACT|UNDERFLOW / $ ./pow.exe src/math/crlibm/pow.h:13: bad fp exception: RN pow(0x1p+1,-0x1.0c8p+10)=3D0= x1p-1074, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:72: bad fp exception: RN pow(0x1p-1074,0x1p+0)=3D0x1p-10= 74, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:73: bad fp exception: RN pow(0x1p-1042,0x1p+0)=3D0x1p-10= 42, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:75: bad fp exception: RN pow(-0x1p-1074,0x1p+0)=3D-0x1p-= 1074, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:76: bad fp exception: RN pow(-0x1p-1042,0x1p+0)=3D-0x1p-= 1042, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:284: bad fp exception: RN pow(0x1p-1073,0x1p+0)=3D0x1p-1= 073, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:300: bad fp exception: RN pow(0x1p-1024,0x1p+0)=3D0x1p-1= 024, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:304: bad fp exception: RN pow(0x1p-1023,0x1p+0)=3D0x1p-1= 023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:310: bad fp exception: RN pow(0x1.ffffffffffffcp-1023,0x= 1p+0)=3D0x1.ffffffffffffcp-1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:313: bad fp exception: RN pow(0x1.ffffffffffffep-1023,0x= 1p+0)=3D0x1.ffffffffffffep-1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:338: bad fp exception: RN pow(0x1p-537,0x1p+1)=3D0x1p-10= 74, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:437: bad fp exception: RN pow(0x1p+1,-0x1.0c8p+10)=3D0x1= p-1074, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:498: bad fp exception: RN pow(0x1p+350,-0x1.8p+1)=3D0x1p= -1050, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:499: bad fp exception: RN pow(0x1p+700,-0x1.8p+0)=3D0x1p= -1050, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:516: bad fp exception: RN pow(0x1p+1023,-0x1p+0)=3D0x1p-= 1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:544: bad fp exception: RN pow(-0x1p-1073,0x1p+0)=3D-0x1p= -1073, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:548: bad fp exception: RN pow(-0x1p-1024,0x1p+0)=3D-0x1p= -1024, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:551: bad fp exception: RN pow(-0x1p-1023,0x1p+0)=3D-0x1p= -1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:557: bad fp exception: RN pow(-0x1.ffffffffffffcp-1023,0= x1p+0)=3D-0x1.ffffffffffffcp-1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:560: bad fp exception: RN pow(-0x1.ffffffffffffep-1023,0= x1p+0)=3D-0x1.ffffffffffffep-1023, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:581: bad fp exception: RN pow(-0x1p-537,0x1p+1)=3D0x1p-1= 074, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:655: bad fp exception: RN pow(-0x1p+1,-0x1.0c8p+10)=3D0x= 1p-1074, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:695: bad fp exception: RN pow(-0x1p+350,-0x1.8p+1)=3D-0x= 1p-1050, want 0 got INEXACT|UNDERFLOW src/math/ucb/pow.h:708: bad fp exception: RN pow(-0x1p+1023,-0x1p+0)=3D-0x1= p-1023, want 0 got INEXACT|UNDERFLOW / $ ./powf.exe src/math/ucb/powf.h:103: bad fp exception: RU powf(0x1.fffffep+127,0x1p+0)= =3D0x1.fffffep+127, want 0 got INEXACT|OVERFLOW src/math/ucb/powf.h:530: bad fp exception: RN powf(0x1.fffff8p-127,0x1p+0)= =3D0x1.fffff8p-127, want 0 got INEXACT|UNDERFLOW src/math/ucb/powf.h:533: bad fp exception: RN powf(0x1.fffffcp-127,0x1p+0)= =3D0x1.fffffcp-127, want 0 got INEXACT|UNDERFLOW src/math/ucb/powf.h:719: bad fp exception: RN powf(-0x1.fffff8p-127,0x1p+0)= =3D-0x1.fffff8p-127, want 0 got INEXACT|UNDERFLOW src/math/ucb/powf.h:722: bad fp exception: RN powf(-0x1.fffffcp-127,0x1p+0)= =3D-0x1.fffffcp-127, want 0 got INEXACT|UNDERFLOW Regards --_000_A157A71BEF653F4BB32E06650E67C99323A48532dggemm514mbxchi_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all,

 

Recently we update musl in our project from 1.1.2 to= version 1.2.0. But there are some errors about math functions when running

the opensource test cases for musl, which are passed= in musl 1.1.2. These errors are about exp2(), pow() and powf().=

Logs are listed below<= /span>.

According to the commit message, the underflow excep= tion is signaled if the result is in the subnormal range even if=

the result is exact (e.g. exp2(-1023.0)). But we got= INEXACT exception at the same time, which is not as expected.

Is this a problem?

Otherwise, there is a overflow exception in powf(0x1= .fffffep+127,0x1p+0) with FE_UPWARD rounding mode(log is also behin= d. As

0x1.fffffep+127 is the largest number that float= can represent, there should not be INEXACT|OVERFLOW exceptions.=

If these are problems affirmed, is there any patch t= o fix this?

 

 

/ $ ./exp2.exe

src/math/special/exp2.h:12: bad fp exception: RN exp= 2(-0x1.ff8p+9)=3D0x1p-1023,  want 0 got INEXACT|UNDERFLOW

src/math/special/exp2.h:18: bad fp exception: RN exp= 2(-0x1.ff8p+9)=3D0x1p-1023, want 0 got INEXACT|UNDERFLOW

src/math/special/exp2.h:20: bad fp exception: RN exp= 2(-0x1p+10)=3D0x1p-1024, want 0 got INEXACT|UNDERFLOW

src/math/special/exp2.h:21: bad fp exception: RN exp= 2(-0x1.004p+10)=3D0x1p-1025, want 0 got INEXACT|UNDERFLOW

src/math/special/exp2.h:22: bad fp exception: RN exp= 2(-0x1.0c8p+10)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

/ $ ./pow.exe

src/math/crlibm/pow.h:13: bad fp exception: RN pow(0= x1p+1,-0x1.0c8p+10)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW<= /o:p>

src/math/ucb/pow.h:72: bad fp exception: RN pow(0x1p= -1074,0x1p+0)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:73: bad fp exception: RN pow(0x1p= -1042,0x1p+0)=3D0x1p-1042, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:75: bad fp exception: RN pow(-0x1= p-1074,0x1p+0)=3D-0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:76: bad fp exception: RN pow(-0x1= p-1042,0x1p+0)=3D-0x1p-1042, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:284: bad fp exception: RN pow(0x1= p-1073,0x1p+0)=3D0x1p-1073, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:300: bad fp exception: RN pow(0x1= p-1024,0x1p+0)=3D0x1p-1024, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:304: bad fp exception: RN pow(0x1= p-1023,0x1p+0)=3D0x1p-1023, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:310: bad fp exception: RN pow(0x1= .ffffffffffffcp-1023,0x1p+0)=3D0x1.ffffffffffffcp-1023, want 0 got INEX= ACT|UNDERFLOW

src/math/ucb/pow.h:313: bad fp exception: RN pow(0x1= .ffffffffffffep-1023,0x1p+0)=3D0x1.ffffffffffffep-1023, want 0 got INEX= ACT|UNDERFLOW

src/math/ucb/pow.h:338: bad fp exception: RN pow(0x1= p-537,0x1p+1)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:437: bad fp exception: RN pow(0x1= p+1,-0x1.0c8p+10)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:498: bad fp exception: RN pow(0x1= p+350,-0x1.8p+1)=3D0x1p-1050, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:499: bad fp exception: RN pow(0x1= p+700,-0x1.8p+0)=3D0x1p-1050, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:516: bad fp exception: RN pow(0x1= p+1023,-0x1p+0)=3D0x1p-1023, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:544: bad fp exception: RN pow(-0x= 1p-1073,0x1p+0)=3D-0x1p-1073, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:548: bad fp exception: RN pow(-0x= 1p-1024,0x1p+0)=3D-0x1p-1024, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:551: bad fp exception: RN pow(-0x= 1p-1023,0x1p+0)=3D-0x1p-1023, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:557: bad fp exception: RN pow(-0x= 1.ffffffffffffcp-1023,0x1p+0)=3D-0x1.ffffffffffffcp-1023, want 0 got IN= EXACT|UNDERFLOW

src/math/ucb/pow.h:560: bad fp exception: RN pow(-0x= 1.ffffffffffffep-1023,0x1p+0)=3D-0x1.ffffffffffffep-1023, want 0 got IN= EXACT|UNDERFLOW

src/math/ucb/pow.h:581: bad fp exception: RN pow(-0x= 1p-537,0x1p+1)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:655: bad fp exception: RN pow(-0x= 1p+1,-0x1.0c8p+10)=3D0x1p-1074, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:695: bad fp exception: RN pow(-0x= 1p+350,-0x1.8p+1)=3D-0x1p-1050, want 0 got INEXACT|UNDERFLOW

src/math/ucb/pow.h:708: bad fp exception: RN pow(-0x= 1p+1023,-0x1p+0)=3D-0x1p-1023, want 0 got INEXACT|UNDERFLOW

/ $ ./powf.exe

src/math/ucb/powf.h:103: bad fp exception: RU powf(0= x1.fffffep+127,0x1p+0)=3D0x1.fffffep+127, want 0 got INEXACT|OV= ERFLOW

src/math/ucb/powf.h:530: bad fp exception: RN powf(0= x1.fffff8p-127,0x1p+0)=3D0x1.fffff8p-127, want 0 got INEXACT|UNDERFLOW<= o:p>

src/math/ucb/powf.h:533: bad fp exception: RN powf(0= x1.fffffcp-127,0x1p+0)=3D0x1.fffffcp-127, want 0 got INEXACT|UNDERFLOW<= o:p>

src/math/ucb/powf.h:719: bad fp exception: RN powf(-= 0x1.fffff8p-127,0x1p+0)=3D-0x1.fffff8p-127, want 0 got INEXACT|UNDERFLO= W

src/math/ucb/powf.h:722: bad fp exception: RN powf(-= 0x1.fffffcp-127,0x1p+0)=3D-0x1.fffffcp-127, want 0 got INEXACT|UNDERFLO= W

=  

=  

Regar= ds

--_000_A157A71BEF653F4BB32E06650E67C99323A48532dggemm514mbxchi_--