xref: /illumos-gate/usr/src/ucblib/libucb/port/stdio/print.h (revision 8c0b080c8ed055a259d8cd26b9f005211c6a9753)
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 /* Maximum number of digits in any integer representation */
35 #define	MAXDIGS 11
36 
37 /* Maximum total number of digits in E format */
38 #if u3b || M32
39 #define	MAXECVT 17
40 #else
41 #define	MAXECVT 18
42 #endif
43 
44 /* Maximum number of digits after decimal point in F format */
45 #define	MAXFCVT 60
46 
47 /* Maximum significant figures in a floating-point number */
48 #define	MAXFSIG MAXECVT
49 
50 /* Maximum number of characters in an exponent */
51 #if u3b || M32
52 #define	MAXESIZ 5
53 #else
54 #define	MAXESIZ 4
55 #endif
56 
57 /* Maximum (positive) exponent */
58 #if u3b || M32
59 #define	MAXEXP 310
60 #else
61 #define	MAXEXP 40
62 #endif
63 
64 /* Data type for flags */
65 typedef char bool;
66 
67 /* Convert a digit character to the corresponding number */
68 #define	tonumber(x) ((x)-'0')
69 
70 /* Convert a number between 0 and 9 to the corresponding digit */
71 #define	todigit(x) ((x)+'0')
72 
73 /* Max and Min macros */
74 #define	max(a, b) ((a) > (b)? (a): (b))
75 #define	min(a, b) ((a) < (b)? (a): (b))
76