Functions
convert.h File Reference

Defines interface of convert.c functions (do not modify) More...

Go to the source code of this file.

Functions

unsigned int toiFloat (const char *str, int width)
 
float fromiFloat (unsigned int x, int width)
 

Detailed Description

This file defines the interface to a C file convert.c that converts between float and unsigned int types. Thus, you do not need to declare ANY float variables anywhere in your code. Note that the test driver testFloat.c does not use any float variables. While the declared variables are <ocde>int, and thus have 32 bits, the width parameter defines whether the lower 16 or all 32 bits hold the relevant information.

Function Documentation

float fromiFloat ( unsigned int  x,
int  width 
)

Convert a iFloat_t to a float

Parameters
xthe unsigned int containing bits for a IEEE floating point value
widththe "size" of the representation (32 or 16)
Returns
the value as a float
unsigned int toiFloat ( const char *  str,
int  width 
)

Convert a string to a iFloat_t

Parameters
strthe string to convert
widththe "size" of the representation (32 or 16)
Returns
an unsigned int containing the IEEE floating point value