printf(long double)
Maks Verver
maksverver at geocities.com
Mon Apr 12 00:42:26 UTC 2010
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.
-------------- next part --------------
--- 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 { \
More information about the freebsd-arm
mailing list