please dont rip this site

Microchip Math Floatconv Readme.txt

floatconv - Floating point to byte representation converter

By David Lions,, feedback welcome.

Originally posted to:, version 1.0, 19 December 2000

This is a utility to convert a floating point number into it's byte 
pattern representation.  For example, what do -6.7654 or 3425.45423E27 
look like in byte form?  Type the number into the Float field, press 
Convert To Byte.  The byte representation is shown in the fields Byte1, 
Byte2, Byte3 and Byte4.  Byte1 is the most significant byte...

It can convert four different formats.  Hitech 24 Bit (truncated 
IEEE 754 32Bit), IEEE 754 32Bit, Microchip 24Bit and Microchip 
32Bit.  The Microchip formats referred to here are presented in
Microchip Application Note AN575.  It can also convert back from byte
representation to floating point.

You don't need to know what the mantissa and exponent do to use this 
utility.  You can ignore those fields.

The purpose was to manually alter calibration values in a PIC-based 
device.  We had to alter a floating point number byte-by-byte so it 
was still readable by the compiled code.  It is not trivial to convert 
a floating point value on paper into byte representation.

This archive contains the entire project.  It was a Visual C++ Dialog 
Box program created with AppWizard.  You probably dont have Visual C,
so the final executeable is in the 'Release' directory.

Issues (work for version 1.1):
* There is rounding error.  Only noticed this in 32bit form.  I believe
if the last bit of the mantissa may get rounded down.  Won't be a 
problem for most so I wont fix it.  This will give an error of 
+/- e * (2**exp) where exp is the unbiased exponent and e is the error, 
e=1/(2**23) for 32Bit formats and e=1/(2**15) for 24Bit formats.  You 
basically lose 1 bit of mantissa, and this round is _biased_, i.e. your 
number is always rounded closer to zero.  I don't have any more time to 
look at this.
* Converting back and forward produces different results.  This happens in
32Bit formats mostly.  I think this is also related to the rounding error.
* Change to JavaScript would be better - editor (notepad.exe), compiler 
(web browser) and executeable (web page) are extremely portable.

I do not guarantee that this software will work the way it was intended. 
I do not take responsibility for anything that happens to anyone or 
anything, at any time, as a result of using this or any software, in any 

If you change this software and distribute it publicly, you must identify
yourself as the new contact point, and remove all occurences of my email 
address (


Time spent writing utility: 10 hours
Time spent writing ReadMe.txt: 20 hours

file: /Techref/microchip/math/floatconv/ReadMe.txt, 2KB, , updated: 2000/12/19 19:37, local time: 2022/8/7 21:16,

 ©2022 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> microchip math floatconv ReadMe</A>

Did you find what you needed?


Welcome to!

Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.

Welcome to!