From owner-freebsd-numerics@freebsd.org Mon Jul 23 19:34:26 2018 Return-Path: Delivered-To: freebsd-numerics@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B182610533A1 for ; Mon, 23 Jul 2018 19:34:26 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D60D8B677 for ; Mon, 23 Jul 2018 19:34:26 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id w6NJYI2f066463 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 23 Jul 2018 12:34:18 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id w6NJYIAb066462 for freebsd-numerics@freebsd.org; Mon, 23 Jul 2018 12:34:18 -0700 (PDT) (envelope-from sgk) Date: Mon, 23 Jul 2018 12:34:18 -0700 From: Steve Kargl To: enh via freebsd-numerics Subject: Re: fmod nan_mix usage Message-ID: <20180723193418.GA66380@troutmask.apl.washington.edu> Reply-To: sgk@troutmask.apl.washington.edu References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: freebsd-numerics@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussions of high quality implementation of libm functions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2018 19:34:26 -0000 On Mon, Jul 23, 2018 at 11:28:08AM -0700, enh via freebsd-numerics wrote: > the recent change from > > return (x*y)/(x*y); > > to > > return nan_mix(x, y)/nan_mix(x, y); > > in e_fmod.c broke some of our unit tests. for example, fmod(3.f, 0.f) in > one of the VM tests. > > bionic/tests/math_test.cpp:(784) Failure in test > math_h_force_long_double.fmod > Value of: isnan(fmod(3.0, 0.0)) > Actual: false > Expected: true Can you share the code for the relevant tests? This simple program gives the expected results on amd64. #include #include int main(void) { printf("%e %d\n", fmodf(3.f, 0.f), isnan(fmodf(3.f, 0.f))); printf("%le %d\n", fmod(3.0, 0.0), isnan(fmod(3.0, 0.0))); printf("%Le %d\n", fmodl(3.L, 0.L), isnan(fmodl(3.L, 0.L))); return 0; } % cc -o z -O a.c -lm && ./z nan 1 nan 1 nan 1 -- Steve