Unittesting and NaN-handling

added NaN flag and handling for this.

Added a unittester that gives some info on what is wrong.

removed ternaries from Fraction.