printf(long double)

Alexander Motin mav at FreeBSD.org
Tue Mar 30 09:35:11 UTC 2010


Hi.

Playing with SheevaPlug (Marvell 88F6281 rev A0) with fresh 9-CURRENT
I've found that many system statistics utilities are lying, showing
number few times smaller then expected. After some investigation I've
found that the problem possibly goes from different meaning of (long
double) type for compiler and printf() code.

I've written small test to check it:
#include <stdio.h>
int
main (void)
{
        printf("%d %d\n", sizeof(long double), sizeof(double));
        printf("%Lf %f %Lf %f\n", (long double)14.5, (long double)14.5,
                (double)14.5, (double)14.5);
}

On amd64 it prints:
# ./a.out
16 8
14.500000 14.500000 14.500000 14.500000

But on arm:
%./a.out
8 8
6.500000 14.500000 6.500000 14.500000

Can somebody comment this?

-- 
Alexander Motin


More information about the freebsd-arm mailing list