printf(long double)

Alexander Motin mav at FreeBSD.org
Tue Mar 30 15:39:26 UTC 2010


M. Warner Losh wrote:
> In message: <4BB1C5C9.8000402 at FreeBSD.org>
>             Alexander Motin <mav at FreeBSD.org> writes:
> : 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.
> 
> Yes.  That's possible.  Your code has some mis-match between printf
> args, which most likely is causing problems.

OK, it was wrong indeed. But that is not the reason, but coincidence.
Here is fixed code:
#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

-- 
Alexander Motin


More information about the freebsd-arm mailing list