Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Apr 2003 16:45:01 +0200
From:      Christophe Juniet <cjuniet@entreview.com>
To:        current@freebsd.org
Subject:   Bug in gdtoa ?
Message-ID:  <20030406144500.GA58090@gluon.dyndns.org>

next in thread | raw e-mail | index | archive | help
Hello,
When using 'ls -lh', I noticed a strange behavior: all file sizes ending
with one or more 0 are printed incorrectly.

For instance:
% ls -l .Xauthority
-rw-------   1 chris  chris   110 Apr  6 14:38 .Xauthority
% ls -lh .Xauthority
-rw-------   1 chris  chris  1100B Apr  6 14:38 .Xauthority


While I was looking into printsize() of src/bin/ls/print.c, I made this
simple test:
---8<---
#include <stdio.h>

int main(void)
{
	printf("%.1f\n", 1.0);
	printf("%.1f\n", 10.0);
	printf("%.1f\n", 100.0);
	printf("%.1f\n", 1000.0);
	printf("%.1f\n", 10000.0);

	printf("%.1f\n", 1.0);
	printf("%.1f\n", 11.0);
	printf("%.1f\n", 101.0);
	printf("%.1f\n", 1001.0);
	printf("%.1f\n", 10001.0);

	return 0;
}
---8<---

Which output is:
% cc -o test test.c
% ./test
1.0
10.00
100.000
1000.0000
10000.00000
1.0
11.0
101.0
1001.0
10001.0

I suspect a bug in gdtoa since I get the correct output with
5.0-RELEASE.  I cvsup'ed up src-all and now I'm running:
FreeBSD gluon.dyndns.org 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sun Apr  6 14:15:10
 CEST 2003     root@gluon.dyndns.org:/usr/obj/usr/src/sys/GLUON  i386

If I got something wrong, how do I fix this ?

Thanks,
chris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030406144500.GA58090>