From <@grizzly.com:markd@grizzly.com>  Thu Mar 23 21:12:08 1995
Received: from cats.ucsc.edu (root@cats-po-1.UCSC.EDU [128.114.129.22]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id VAA14271 for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Mar 1995 21:12:07 -0800
Received: from scruz.ucsc.edu by cats.ucsc.edu with SMTP
	id VAA13021; Thu, 23 Mar 1995 21:11:50 -0800
Received: from osprey by scruz.ucsc.edu id aa00885; 23 Mar 95 22:05 PST
Received: (from markd@localhost) by Grizzly.COM (8.6.9/8.6.9) id UAA01545; Thu, 23 Mar 1995 20:47:31 -0800
Message-Id: <199503240447.UAA01545@Grizzly.COM>
Date: Thu, 23 Mar 1995 20:47:31 -0800
From: Mark Diekhans <markd@grizzly.com>
Reply-To: markd@grizzly.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Broken printf floating point formatting
X-Send-Pr-Version: 3.2

>Number:         272
>Category:       misc
>Synopsis:       Broken printf floating point formatting
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 23 21:20:01 1995
>Closed-Date:    Fri Mar 24 03:06:38 PST 1995
>Last-Modified:  Tue Nov 27 18:41:47 PST 2001
>Originator:     Mark Diekhans
>Release:        FreeBSD 2.0-RELEASE i386
>Organization:
== Mark Diekhans (markd@grizzly.com)     ==
>Environment:

>Description:

printf ("%e", 3.42e12);  outputs "3.42e+12", it should output  "3.420000e+12".

printf ("%#.0f", 0.0);  outputs "0", it should output  "0.".

printf ("%#.0g", 0.0);  outputs "0.e+00", it should output  "0.".


These results conflict with the printf (3) manual page and the behavior
on other systems (I tried SunOS, HP-UX and SCO).


>How-To-Repeat:

#include <stdio.h>

void
Out (format, valueStr, value)
    char   *format;
    char   *valueStr;
    double  value;
{
    char spec [1024];

    strcpy (spec, "%s of %s = ");
    strcat (spec, format);
    strcat (spec, "\n");

    printf (spec, format, valueStr, value);
}

int
main ()
{
    Out ("%e", "3.42e12", 3.42e12);
    Out ("%.4e", "-9.99996", -9.99996);
    Out ("%#.0f", "0.0", 0.0);
    Out ("%#.0g", "0.0", 0.0);
    return 0;
}

>Fix:
	


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Fri Mar 24 03:06:38 PST 1995 
State-Changed-Why:  
Already fixed in revision 1.4 of vfprintf.c. 
>Unformatted:



