HP-UX 11i Version 1.6 Release Notes
Programming
C99 Floating Hexadecimal I/O Support in libc
Chapter 7
107
C99 Floating Hexadecimal I/O Support in libc
The strtod, printf, and scanf families of functions are enhanced to handle floating
hexadecimal input and output. HP-UX 11i v1.6 delivers enhancements for C99 Floating
Hexadecimal I/O support in libc.
Summary of Change
The strtod, printf, and scanf families of functions are enhanced to handle floating
hexadecimal input and output.
Details of Change
APIs printf and scanf are enhanced to handle the new format specifiers ‘a’ and ‘A’ for
floating hexadecimal input and output as specified in C99. The API strtod() is
enhanced to accept floating hexadecimal sequences as specified in C99. These changes
are extensions to existing functionality.
Impact
No impact.
Compatibility
The new scanf and strtod functions could affect the behavior of an existing program
which depends on the rejection of input that the updated functions accept as a floating
hexadecimal number. For example, the output of the following program:
#include <stdio.h>
int main() {
const char* input = “0x1p0z”;
float x;
char c;
sscanf(input, “%e%c”, &x, &c);
printf(“x = %g\n”, x);
printf(“c = %c\n”, c);
changes from:
x = 0
c = x
to:
x = 1
c = z
Performance
There is no change in performance.