From owner-freebsd-arm@FreeBSD.ORG Thu Apr 22 09:54:11 2010 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9B2B106564A; Thu, 22 Apr 2010 09:54:11 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bw0-f228.google.com (mail-bw0-f228.google.com [209.85.218.228]) by mx1.freebsd.org (Postfix) with ESMTP id DBA378FC1B; Thu, 22 Apr 2010 09:54:10 +0000 (UTC) Received: by bwz28 with SMTP id 28so9363993bwz.14 for ; Thu, 22 Apr 2010 02:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=3Qbgm3S09ALNl2jlVq9p4iEw6gwVKIEZMYH+ypG+LIs=; b=lQhbLm/BgHDdSGk6DXPjw70t9yLscK2VE9J2Bs8T1oFzArS0u4LgDxTz3knIyGbzr6 Ws4hTRB1X/ziBfvLZeOmcDbnKniXMRTPUvX++7kKUtpFsbofngTcqTB0XBCU5SRkl6XI qz3hkN6NCUP7xJJW3F17Thx5lcLAsSngzsw5g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=KRm1JHPBc5IK8KtTgOwhIs4QZXtW+T/a4dZbiBBo/qw8S6jCqeqrlcWOGGmdfQXFHy sz7SsKGgGcwqdX+uaRLEW7sO6xqzveb2TtOB3UDcLJZ4q/ePYzFSRxn6m37roQsN8axs +BvMV+FQ/Hij8YGHUpT8iaKzN+6rxF88rvJMQ= Received: by 10.102.216.24 with SMTP id o24mr2102496mug.67.1271930049586; Thu, 22 Apr 2010 02:54:09 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id s10sm6793398muh.5.2010.04.22.02.54.08 (version=SSLv3 cipher=RC4-MD5); Thu, 22 Apr 2010 02:54:08 -0700 (PDT) Sender: Alexander Motin Message-ID: <4BD01CB2.6040300@FreeBSD.org> Date: Thu, 22 Apr 2010 12:53:54 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Maks Verver References: <1269955381.00235504.1269942002@10.7.7.3> <1269973399.00235672.1269962405@10.7.7.3> <1269976983.00235685.1269964202@10.7.7.3> <1271046181.00240326.1271033403@10.7.7.3> In-Reply-To: <1271046181.00240326.1271033403@10.7.7.3> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org, Warner Losh Subject: Re: printf(long double) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2010 09:54:11 -0000 Maks Verver wrote: > On 03/30/10 17:39, Alexander Motin wrote: >> #include int main (void) { printf("%Lf %f\n", (long >> double)14.5, (double)14.5); return(0); } >> >> It compiles cleanly on both arm and amd64, but still not working on >> arm: %./a.out 6.500000 14.500000 > > I investigated this in detail and it seems to be caused by a bug in the > __ldtoa function that fails to account for the implicit mantissa bit of > the double value (6 = 14 - 8) because the ARM port doesn't define > LDBL_IMPLICIT_NBIT. > > Attached is a patch to lib/libc/arm/_fpmath.h that corrects this > problem and also corrects the value for LDBL_MANH_SIZE. Your patch seems working for me. Thank you! > Warner, do you > know if there is a subtle reason why arm/_fpmath.h contains the > definitions it does now, or are these errors that should be fixed in the > trunk? -- Alexander Motin