Cruise autonomy software may need exact decimal formatting for diagnostic values without relying on floating-point arithmetic. Given a fraction, determine whether its decimal expansion terminates or repeats, and return the exact representation.
You must not use division or multiplication operators anywhere in your algorithm. Bit shifts, addition, subtraction, comparisons, dictionaries, and string operations are allowed.
Implement fraction_to_decimal(numerator, denominator).
numerator is an integer.denominator is a nonzero integer.def fraction_to_decimal(numerator, denominator):