- Sep 29, 2004
- 18,656
- 68
- 91
How would you spec the storage of floats in a data file (binary data file).  It's not as easy as you might think as there is no standard for storing a float in memory or anywhere pretty much (lie a network which is big endien).  So, floats are not easily cross platform.
BDC is one option but that would blow up the file size. I need to keep this file compact so I need to use only 4 bytes.
The Interface document needs to specify exactly how to store a float.
NOTES:
http://en.wikipedia.org/wiki/IEEE_754-1985
Some people might not understand the problem, but trust me ... it is a real world issue. I need to do this because I am dealing with two vendors and 2 much different architectures.
From my testing, Wintel machines place things in the order shown here:
http://en.wikipedia.org/wiki/F...ating_Point_Format.svg
Bits 0..7 are byte 1
Bits 8..15 are byte 2
Bits 16..23 are byte 3
Bits 24..31 are byte 4
			
			BDC is one option but that would blow up the file size. I need to keep this file compact so I need to use only 4 bytes.
The Interface document needs to specify exactly how to store a float.
NOTES:
http://en.wikipedia.org/wiki/IEEE_754-1985
Some people might not understand the problem, but trust me ... it is a real world issue. I need to do this because I am dealing with two vendors and 2 much different architectures.
From my testing, Wintel machines place things in the order shown here:
http://en.wikipedia.org/wiki/F...ating_Point_Format.svg
Bits 0..7 are byte 1
Bits 8..15 are byte 2
Bits 16..23 are byte 3
Bits 24..31 are byte 4
 
				
		 
			 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		
 Facebook
Facebook Twitter
Twitter