Bug in gdtoa ?

From: Christophe Juniet <cjuniet_at_entreview.com>
Date: Sun, 6 Apr 2003 16:45:01 +0200
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_at_gluon.dyndns.org:/usr/obj/usr/src/sys/GLUON  i386

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

Thanks,
chris
Received on Sun Apr 06 2003 - 05:45:06 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:02 UTC