When moving a number from one platform or IEEE notation to another, be alert to the fact that the number may require more storage than previously. When using short numeric variables, some values that use only 3 bytes on one platform may require 4 bytes when transformed to a different platform or IEEE notation.
The only fix for this is to increase the number of bytes used to store the number in the SOURCE. Here is information on how numbers are stored on each platform and in IEEE format.
[ | IEEE Single Precision | | | IEEE Double Precision | | | OS/390 Floating Point | | | Binary Fractions | ] |
The IEEE single precision floating point standard representation requires 32 bits, which may be represented as numbered from 0 to 31, left to right. The first bit is the sign bit, S, the next eight bits are the exponent bits, 'E', and the final 23 bits are the fraction (also called mantissa) 'F'.In C on Microsoft Windows a single precision floating point number is of type "float".S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF 0 1 8 9 31
The value V represented by the 32 bits is determined as follows:
- If E=255 and F is nonzero, then V=NaN ("Not a number")
- If E=255 and F is zero and S is 1, then V=-Infinity
- If E=255 and F is zero and S is 0, then V=Infinity
- If 0<E<255 then V=(-1)**S * 2 ** (E-127) * (1.F) where "1.F" is intended to represent the binary number created by prefixing F with an implicit leading 1 and a binary fraction.
- If E=0 and F is nonzero, then V=(-1)**S * 2 ** (-126) * (0.F) These are "unnormalized" values.
- If E=0 and F is zero and S is 1, then V=-0
- If E=0 and F is zero and S is 0, then V=0
Example:
0x41 0xCB 0x00 0x00 0 10000011 10010110000000000000000 - -------- ----------------------- S E F V = (-1)**S * 2**(E - 127) * 1.(F) V = (-1)**0 * 2**(131 - 127) * 1.(1/2 + 1/16 + 1/64 + 1/128) V = 1 * 16 * 1.5859375 V = 25.375
The IEEE double precision floating point standard representation is used on Windows, UNIX, Linux and AIX platforms. It requires 64 bits represented as shown, numbered from 0 to 63, left to right. The first bit is the sign bit, S, the next eleven bits are the exponent bits, 'E', and the final 52 bits are the fraction (or mantissa) 'F'.S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0 1 11 12 63In C on Microsoft Windows a double precision floating point number is of type "double". The value V represented by the word may be determined as follows:
- If E=2047 and F is nonzero, then V=NaN ("Not a number")
- If E=2047 and F is zero and S is 1, then V=-Infinity
- If E=2047 and F is zero and S is 0, then V=Infinity
- If 0<E<2047 then V=(-1)**S * 2 ** (E-1023) * (1.F) where "1.F" is intended to represent the binary number created by prefixing F with an implicit leading 1 and a binary fraction.
- If E=0 and F is nonzero, then V=(-1)**S * 2 ** (-1022) * (0.F) These are "unnormalized" values.
- If E=0 and F is zero and S is 1, then V=-0
- If E=0 and F is zero and S is 0, then V=0
Example:
0x40 0x39 0x60 0x00 0x00 0x00 0x00 0x00 S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0 10000000011 1001011000000000000000000000000000000000000000000000 - ----------- ---------------------------------------------------- S E F V = (-1)**S * 2**(E - 1023) * 1.(F) V = (-1)**0 * 2**(1027 - 1023) * 1.(1/2 + 1/16 + 1/64 + 1/128) V = 1 * 16 * 1.5859375 V = 25.375
The IBM mainframe host systems (MVS, z/OS, CMS and VSE) all use the same representation consisting of 64 bits, which may be represented as numbered from 0 to 63, left to right. The first bit is the sign bit, S, the next seven bits are the exponent bits, 'E', and the final 56 bits are the fraction (or mantissa) 'F'S EEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0 1 8 9 63Where IEEE double precision floating point uses a base of 2 with a bias 1023, the IBM mainframe uses a base of 16 and a bias of 64. Thus the value V represented by the word may be determined as follows:
V=(-1)**S * 16 ** (E-64) * (0.F)
where ".F" is intended to represent the binary fraction created by the last 56 bits.Example:
0x41 0x50 0x00 0x00 0x00 0x00 0x00 0x00 S EEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0 1000001 01010000000000000000000000000000000000000000000000000000 - ------- -------------------------------------------------------- S E F V = (-1)**S * 16**(E - 64) * 0.F V = (-1)**0 * 16**(65 - 64) * 0.(1/4 + 1/16) V = 1 * 16 * 0.3125 V = 5.0
A binary fraction is one composed of the sum of the fractions represented by each bit position in the bit field containing a 1. The value of the bit positions from left to right are 1/2, 1/4, 1/8, 1/16 ... and so on.Mathmatically these values are expresses as:
1 / (2**BitPosition)Thus the bit in the third position represents the value 1/2**3 = 1/8
1001 0110 = 1/2 + 0 + 0 + 1/16 + 0 + 1/64 + 1/128 + 0 = .5 + 0 + 0 +.0625 + 0 + .015625 + .0078125 + 0 = .5859375
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | Base SAS | z/OS | ||
OpenVMS VAX | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft® Windows® for x64 | ||||
OS/2 | ||||
Microsoft Windows 95/98 | ||||
Microsoft Windows 2000 Advanced Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows XP Professional | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
64-bit Enabled AIX | ||||
64-bit Enabled HP-UX | ||||
64-bit Enabled Solaris | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |
Type: | Usage Note |
Priority: | |
Topic: | Data Management ==> Access ==> Export Data Management ==> Access ==> Import Data Management ==> Data Sources ==> CEDA (Cross-environment Data Access) Data Management ==> Data Sources ==> SAS Data Sets/Tables Data Management ==> Data Sources ==> SPDE (Scalable Performance Data Engine) Data Management ==> Data Sources Data Management ==> Manipulation and Transformation ==> Numeric Precision Data Management |
Date Modified: | 2009-09-16 11:15:41 |
Date Created: | 2008-03-12 12:47:00 |