java - Weak Math Skillset: What is an 8-bit numerator and 8-bit denominator? -
i'm embarrassed wield weak math skills, , proud computer science major. i'm in class, , it's overwhelming. part of homework assignment, however, can't continue on until understand section. in class struggling on writing method complete assignment. emailed professor, asking clarification on how method should written.
he said supposed store 8-bit numerator , 8-bit denominator... however... not understand numerator , denominator is. can please explain me?
this part of response got professor:
"[you're] supposed encode coefficients a, b, , c chromosome [chromosome our interface, chromosome chrome our object]. a, b, , c numbers can fractional. must store 8-bit numerator , 8-bit denominator. a, b, , c can positive or negative."
after this, we're supposed map a, b, , c
binary string create new chromosome object.
how translating this: a, b, , c
going doubles (at least) holding decimal value. can't implement until know 8-bit numerator , 8-bit denominator is. please help!
thank you! <3 tg52
this conjecture based on post believe professor asking in assignment represent numerator , denominator of fractions 8-bit signed integers.
using byte
data type suffice in case :
byte: byte data type 8-bit signed two's complement integer. has minimum value of -128 , maximum value of 127 (inclusive). byte data type can useful saving memory in large arrays, memory savings matters. can used in place of int limits clarify code; fact variable's range limited can serve form of documentation.
so have class called fraction like:
class fraction{ private byte numerator; private byte denominator; public fraction(byte numerator, byte denominator){ this.numerator = numerator; this.denominator = denominator; } }
Comments
Post a Comment