Date: Mon, 12 Apr 2010 02:42:06 +0200 From: Maks Verver <maksverver@geocities.com> To: Alexander Motin <mav@FreeBSD.org> Cc: freebsd-arm@FreeBSD.org Subject: Re: printf(long double) Message-ID: <4BC26C5E.7000509@geocities.com> In-Reply-To: <4BB21B2A.6090209@FreeBSD.org> References: <4BB1C5C9.8000402@FreeBSD.org> <20100330.090525.956847443318914833.imp@bsdimp.com> <4BB21B2A.6090209@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------050601000805050903080207 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi Alexander, On 03/30/10 17:39, Alexander Motin wrote: > #include <stdio.h> 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. 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? Kind regards, Maks Verver. --------------050601000805050903080207 Content-Type: text/plain; name="arm-longdouble.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="arm-longdouble.patch" --- lib/libc/arm/_fpmath.h.orig 2010-04-11 23:23:37.000000000 +0200 +++ lib/libc/arm/_fpmath.h 2010-04-11 23:25:48.000000000 +0200 @@ -56,8 +56,9 @@ #define LDBL_NBIT 0 #define mask_nbit_l(u) ((void)0) +#define LDBL_IMPLICIT_NBIT -#define LDBL_MANH_SIZE 32 +#define LDBL_MANH_SIZE 20 #define LDBL_MANL_SIZE 32 #define LDBL_TO_ARRAY32(u, a) do { \ --------------050601000805050903080207--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BC26C5E.7000509>