Floating-Point Formats

Vector file formats occasionally store key points in floating-point format, and a number of different floating-point formats are in common use. Most floating-point data, however, is stored in a portable manner. The least common denominator approach is to store floating-point numbers as ASCII data, as a series of point pairs:

1234.56 2345.678 987.65 8765.43

The main problems you will encounter with floating-point data stored in ASCII format are with formatting conventions--how the numbers are delimited (comma, whitespace, etc.), and how many digits of precision need to be handled by your parsing routines. Library routines are readily available to handle conversion from ASCII to native binary floating-point formats.

Floating-point numbers stored in binary format present different problems. There are a number of floating-point binary formats in common use, including IEEE, Digital Equipment Corporation, and Microsoft Basic. Library routines are available for these conversions, but it may take some searching to find the correct one for your application. Sometimes, however, the hardest part of the job is identifying the formats you are trying to convert from and to.

Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.

Hosted by uCoz