From owner-freebsd-standards@FreeBSD.ORG Fri Nov 28 16:01:35 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 503F616A4CE for ; Fri, 28 Nov 2003 16:01:35 -0800 (PST) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F33B43F85 for ; Fri, 28 Nov 2003 16:01:34 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) hAT01Y8u030721 for ; Fri, 28 Nov 2003 16:01:34 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost)hAT01XUn030720 for freebsd-standards@freebsd.org; Fri, 28 Nov 2003 16:01:34 -0800 (PST) (envelope-from sgk) Date: Fri, 28 Nov 2003 16:01:33 -0800 From: Steve Kargl To: freebsd-standards@freebsd.org Message-ID: <20031129000133.GA30662@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: Implementing C99's roundf(), round(), and roundl() X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2003 00:01:35 -0000 Can the math functions round[fl]() be implemented in terms of other math(3) functions and still conform to the C99 and POSIX standard? For example, #include float roundf(float x) { float t; if (x >= 0.0) { t = ceilf(x); if ((t - x) > 0.5) t -= 1.0; return t; } else { t = ceilf(-x); if ((t + x) > 0.5) t -= 1.0; return -t; } } -- Steve