-
Notifications
You must be signed in to change notification settings - Fork 0
EBinary
EBinary is a class which can act as any type of binary that is available. It does this with a string attribute Type
which is checked to see what function should be called.
Type
is a string attribute that is set when the object is instantiated. It can be one of three options:
- "STANDARD" - A standard binary with no signs
- "TWOS_COMPLIMENT" - A binary number in two's compliment, where the first bit is negative but has a magnitude as well
- "SIGN_MAGNITUDE" - A binary number where the first bit is negative, with no magnitude
BinaryNum
holds the number in binary. It can be set with a binary number, or a denary number which is converted to binary.
The Length
attribute holds the number of bits in the binary number.
SetBinaryWithDenary
does not return anything. It takes an int
as a parameter. It sets the BinaryNum
attribute to the binary representation of the denary that was inputted, in the style specified by the Type
attribute.
GetDenary
returns an int
, which is the denary representation of the the binary held in BinaryNum
. It takes no parameters. It automatically adjusts for the Type
.