From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/6306 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [math] The math library have some bug for ceil,floor,round functioin, in arm mode Date: Mon, 13 Oct 2014 22:42:39 -0400 Message-ID: <20141014024238.GL32028@brightrain.aerifal.cx> References: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1413254588 9581 80.91.229.3 (14 Oct 2014 02:43:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Oct 2014 02:43:08 +0000 (UTC) Cc: musl To: bobodog <8192542@qq.com> Original-X-From: musl-return-6319-gllmg-musl=m.gmane.org@lists.openwall.com Tue Oct 14 04:43:01 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Xds4i-0007oC-JO for gllmg-musl@plane.gmane.org; Tue, 14 Oct 2014 04:43:00 +0200 Original-Received: (qmail 9279 invoked by uid 550); 14 Oct 2014 02:43:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9271 invoked from network); 14 Oct 2014 02:42:59 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:6306 Archived-At: On Tue, Oct 14, 2014 at 10:17:34AM +0800, bobodog wrote: > HI,ALL > We use musl in arm process, but found some bugs about math library, x86 process is ok! I can't reproduce this issue. Are you using soft (arm) or hard (armhf) float based target? > The test code: > int test(int argc, char ** argv) > { > double n = 0.0; > int i; > > > for(i = 0; i < 20; i++) > { > n = n - 0.125; > printf("ceil(%f) = %f, floor(%f) = %f, round(%f) = %f\n", n, ceil(n), n, floor(n), n, round(n)); > } > > > return 0; > }‍ Is this the whole test program? I don't see a main function or any #include directives. Compiling it with gcc -Dtest=main results in: foo.c:10:17: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default] foo.c:10:78: warning: incompatible implicit declaration of built-in function ‘ceil’ [enabled by default] foo.c:10:90: warning: incompatible implicit declaration of built-in function ‘floor’ [enabled by default] foo.c:10:103: warning: incompatible implicit declaration of built-in function ‘round’ [enabled by default] These warnings should all be treated as errors; calling a function with variadic arguments (printf) or a function that returns a floating point type without a valid declaration/prototype is a serious error and will not work. Rich