don't allow negative zero; ``printf("%.3f", (double)-0.00005);''
[unix-history] / usr / src / lib / libc / stdio / printf.c
... / ...
CommitLineData
1/*
2 * Copyright (c) 1987 Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of California at Berkeley. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
11 */
12
13#if defined(LIBC_SCCS) && !defined(lint)
14static char sccsid[] = "@(#)printf.c 5.3 (Berkeley) %G%";
15#endif /* LIBC_SCCS and not lint */
16
17#include <stdio.h>
18
19printf(fmt, args)
20 char *fmt;
21 int args;
22{
23 int len;
24
25 len = _doprnt(fmt, &args, stdout);
26 return(ferror(stdout) ? EOF : len);
27}