Project status: Not Active

This was a small project which was derived from the mazebot project. It is a floating point emulation library. You can get the code from here. Its original purpose was to provide the robot of the aforementioned project a means to achieve floating point calculations which adhere to the IEEE 754 standard. After the mazebot project was presented as my graduation thesis, it turned a bit into a more generic floating point emulation library. At its current stage its only actual use is for someone to study its code and understand how floating point calculations using this standard are actually implemented

The floating point representation can cope only with single precision floats. These are represented by 4 bytes as can be seen in the picture on the right. In these 4 bytes we have the sign, the exponent and the mantissa which determine which number any configuration represents. We can see the C struct which stores our floating point numbers in the actual library code below:

  1. typedef struct
  2. {
  3. union{
  4. struct {
  5. unsigned long mantissa: 23;
  6. unsigned long exponent: 8;
  7. unsigned long sign: 1;
  8. } float_parts;//the struct shares same memory space as the float allowing us to access its parts with the bitfields
  9. float all;
  10. };
  11. }_float __attribute__((__packed__));
  12.  

In case you would like to study the code you can grab it from here as mentioned above. You can use it by calling the .exe from the console in windows, or just by compiling an executable in any other OS. The correct usage is:


[executablename] [float1] [+ OR - OR x OR /] [float2]

Here are the results of calling it with parameters 1.354 x 031 in Windows:

  1. The result of the multiplication of 1.354000 and 0.310000
  2. by your FPU is: 0.419740
  3. The emulation's result is: 0.419740
  4. The FPU took 1306 time units
  5. The emulation took 1810 time units
  6. Press any key to exit the program
  7.  

If there are any changes/addition to this project a corresponding news post will be made and this page will be updated.