xref: /illumos-gate/usr/src/ucblib/libucb/port/stdio/print.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1997, by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 
31 /*	Copyright (c) 1988 AT&T	*/
32 /*	  All Rights Reserved  	*/
33 
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
36 
37 /* Maximum number of digits in any integer representation */
38 #define	MAXDIGS 11
39 
40 /* Maximum total number of digits in E format */
41 #if u3b || M32
42 #define	MAXECVT 17
43 #else
44 #define	MAXECVT 18
45 #endif
46 
47 /* Maximum number of digits after decimal point in F format */
48 #define	MAXFCVT 60
49 
50 /* Maximum significant figures in a floating-point number */
51 #define	MAXFSIG MAXECVT
52 
53 /* Maximum number of characters in an exponent */
54 #if u3b || M32
55 #define	MAXESIZ 5
56 #else
57 #define	MAXESIZ 4
58 #endif
59 
60 /* Maximum (positive) exponent */
61 #if u3b || M32
62 #define	MAXEXP 310
63 #else
64 #define	MAXEXP 40
65 #endif
66 
67 /* Data type for flags */
68 typedef char bool;
69 
70 /* Convert a digit character to the corresponding number */
71 #define	tonumber(x) ((x)-'0')
72 
73 /* Convert a number between 0 and 9 to the corresponding digit */
74 #define	todigit(x) ((x)+'0')
75 
76 /* Max and Min macros */
77 #define	max(a, b) ((a) > (b)? (a): (b))
78 #define	min(a, b) ((a) < (b)? (a): (b))
79