My Project
|
Defines interface of flt32.c functions (do not modify) More...
Go to the source code of this file.
Typedefs | |
typedef int | flt32 |
Functions | |
int | flt32_get_sign (flt32 x) |
int | flt32_get_exp (flt32 x) |
int | flt32_get_val (flt32 x) |
void | flt32_get_sve (flt32 x, int *sign, int *val, int *exp) |
int | flt32_leftmost_1 (int value) |
flt32 | flt32_abs (flt32 x) |
flt32 | flt32_negate (flt32 x) |
flt32 | flt32_add (flt32 x, flt32 y) |
flt32 | flt32_sub (flt32 x, flt32 y) |
This file defines the interface to a C file flt32.c that you will complete. You will learn how to do floating point arithmatic without using any float
variables. Rather you will perform the operations by using the sign, exponent, and digit fields as defined in the IEEE floating Point Standard. You may reuse the code you wrote for field.c
assignment. Or, you may use the provided file field.o
in place of your code. That file is a compiled version of field.c
written by an instructor. You will only be submitting one files (flt32.c
).
typedef int flt32 |
Whenever flt32
is used, the value is an integer in the IEEE floating point 32 bit standard.
Absolute value of the argument. This can be done with a simple bit manipulation operation or with your field
functions. No conditionals are required.
x | some pattern of bits (may be a IEEE floating point value) |
Add two floating point values
x | an integer containing a IEEE floating point value |
y | an integer containing a IEEE floating point value |
int flt32_get_exp | ( | flt32 | x | ) |
int flt32_get_sign | ( | flt32 | x | ) |
void flt32_get_sve | ( | flt32 | x, |
int * | sign, | ||
int * | val, | ||
int * | exp | ||
) |
Get the sign, value, and exponent in a single call. You will use
x | the integer containing a IEEE floating point value |
sign | pointer to location where sign will be stored |
val | pointer to location where value will be stored |
exp | pointer to location where exponent will be stored C pointers to return values. |
int flt32_get_val | ( | flt32 | x | ) |
int flt32_leftmost_1 | ( | int | value | ) |
Negate the argument. This can be done with a simple bit manipulation function (think about the C xor operator (^
) or with your field
functions.
x | the integer containing a IEEE floating point value |
Subtract to floating point values
x | an integer containing a IEEE floating point value |
y | an integer containing a IEEE floating point value |