Skip to content
Advertisement

Tag: fractions

How to restore initial fraction from a big decimal

I have a list of fractions that have to be converted to a bigDecimal first and then converted to a fraction again. I have made two methods: first converts from fraction to bigDecimal and the second does the opposite. However, I have noticed that during the conversion I am losing on some precision, hence I was wondering if there is

How would I make a new fraction if a fraction cannot be simplified?

So I’m writing an assignment for my OOP class that asks the user for a number of fractions, then randomly generates that number of fractions. Part of the assignment states that if one of the fractions cannot be simplified then skip it and create a new fraction that can be simplified. However the unreducible fractions still make it through. I

Advertisement