My Project
Functions
testFlt32.c File Reference

Driver to test functions of flt32.c (do not modify) More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "field.h"
#include "flt32.h"

Functions

void printBinaryMSB (int value, int msb)
 
void printBinary (int value)
 
int main (int argc, char *argv[])
 

Detailed Description

This is a driver program to test the functions defined in flt32.h and implemented in flt32.c. The program takes one or more command line parameters and calls one of the methods, then prints the results. To see how to use the program, execute testFlt32 in a terminal window. This will print a usage statement defining how to run the program. The first parameter of the program is always a key defining which function to run. The options are:

A sample execution might be: testFlt32 abs -2.5

which prints

2.5

All values may be entered as signed floating point numbers. The argument to lm1 may be a floating point number or a hex value.

Author
Fritz Sieker

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Entry point of the program

Parameters
argccount of arguments, will always be at least 1
argvarray of parameters to program argv[0] is the name of the program, so additional parameters will begin at index 1.
Returns
0 the Linux convention for success.
void printBinary ( int  value)

Print a 32 bit binary representation of a value.

Parameters
valuethe value to be printed
void printBinaryMSB ( int  value,
int  msb 
)

Print the binary representation of a value starting at the specified bit position. A separator is printed every 4 bits for easy reading.

Parameters
valuethe value to be printed
msbthe bit position to begin printing (31 to 0)