.\" SUCH DAMAGE.
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.55 2003/01/06 06:19:19 tjr Exp $
+.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.58 2004/10/16 16:00:01 stefanf Exp $
.\"
-.Dd January 4, 2003
+.Dd October 16, 2004
.Dt PRINTF 3
.Os
.Sh NAME
conversion:
.Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G"
.It Sy Modifier Ta Cm a , A , e , E , f , F , g , G
+.It Cm l No (ell) Ta Vt double
+(ignored, same behavior as without it)
.It Cm L Ta Vt "long double"
.El
.Pp
.It Cm aA
The
.Vt double
-argument is converted to hexadecimal notation in the style
+argument is rounded and converted to hexadecimal notation in the style
.Sm off
.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,
.Sm on
where the number of digits after the hexadecimal-point character
is equal to the precision specification.
-If the precision is missing, it is taken as enough to exactly
-represent the floating-point number; if the precision is
-explicitly zero, no hexadecimal-point character appears.
-This is an exact conversion of the mantissa+exponent internal
-floating point representation; the
-.Sm off
-.Oo \- Oc Li 0x Ar h Li \&. Ar hhh
-.Sm on
-portion represents exactly the mantissa; only denormalized
-mantissas have a zero value to the left of the hexadecimal
-point.
+If the precision is missing, it is taken as enough to represent
+the floating-point number exactly, and no rounding occurs.
+If the precision is zero, no hexadecimal-point character appears.
The
.Cm p
is a literal character
-.Ql p ;
-the exponent is preceded by a positive or negative sign
-and is represented in decimal, using only enough characters
-to represent the exponent.
+.Ql p ,
+and the exponent consists of a positive or negative sign
+followed by a decimal number representing an exponent of 2.
The
.Cm A
conversion uses the prefix
(rather than
.Ql p )
to separate the mantissa and exponent.
+.Pp
+Note that there may be multiple valid ways to represent floating-point
+numbers in this hexadecimal format.
+For example,
+.Li 0x3.24p+0 , 0x6.48p-1
+and
+.Li 0xc.9p-2
+are all equivalent.
+The format chosen depends on the internal representation of the
+number, but the implementation guarantees that the length of the
+mantissa will be minimized.
+Zeroes are always represented with a mantissa of 0 (preceded by a
+.Ql -
+if appropriate) and an exponent of
+.Li +0 .
.It Cm C
Treated as
.Cm c
.Pp
The
.Nm
-family of functions currently lack the ability to use the
-.Cm '
-flag in conjunction with the
-.Cm f
-conversion specifier.
-The
-.Cm a
-and
-.Cm A
-conversion specifiers have not yet been implemented.
-The
-.Cm L
-modifier for floating point formats simply round the
-.Vt "long double"
-argument to
-.Vt double ,
-providing no additional precision.
-.Pp
-The
-.Nm
family of functions do not correctly handle multibyte characters in the
.Fa format
argument.