From owner-freebsd-arch@FreeBSD.ORG Thu Jul 15 15:39:50 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3C89D16A4CE for ; Thu, 15 Jul 2004 15:39:50 +0000 (GMT) Received: from VARK.homeunix.com (adsl-69-107-108-110.dsl.pltn13.pacbell.net [69.107.108.110]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BDBD43D1D for ; Thu, 15 Jul 2004 15:39:50 +0000 (GMT) (envelope-from das@FreeBSD.ORG) Received: from VARK.homeunix.com (localhost [127.0.0.1]) by VARK.homeunix.com (8.12.11/8.12.10) with ESMTP id i6FFdKFG033802; Thu, 15 Jul 2004 08:39:20 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by VARK.homeunix.com (8.12.11/8.12.10/Submit) id i6FFdKRS033801; Thu, 15 Jul 2004 08:39:20 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Thu, 15 Jul 2004 08:39:20 -0700 From: David Schultz To: Jay Sern Liew Message-ID: <20040715153920.GA33631@VARK.homeunix.com> Mail-Followup-To: Jay Sern Liew , freebsd-arch@FreeBSD.ORG References: <1089567603.746.45.camel@athlon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1089567603.746.45.camel@athlon> cc: freebsd-arch@FreeBSD.ORG Subject: Re: increased machine precision for FreeBSD apps? X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2004 15:39:50 -0000 On Sun, Jul 11, 2004, Jay Sern Liew wrote: > This is probably more of an organizational issue than an architectural > one. In the event of running applications with heavy floating point > arithmetic (e.g. scientific computation apps for one, encryption > algorithms, compression, .. etc ), would it be a good idea to decrease > rounding errors by increasing the data type size? Most programmers expect a float to be an IEEE 754 single-precision number, and they expect a double to be a double-precision number. On most modern FPUs, however, floats, doubles, and sometimes even long doubles take about the same number of clock cycles. The only good reason to use float is for things like genomics, where you're doing calculations on gigabytes of data, and the goal is to fit as much of it in memory as possible. So here's how you handle the problem. If you want to use the largest type that's at least as big as a float, use C99's float_t instead. If you want the largest type that's at least as big as a double, use double_t. If you want the largest type possible, at the expense of having to emulate it on architectures such as PowerPC, use long double. If you want to run one of those scientific apps that phk says don't exist, use an arbitrary-precision arithmetic package such as Gnu MP, Paul Rouse's public domain clone thereof, QLIB, or Mathematica.