Top "Rational-numbers" questions

simplifying fractions in Java

My task is to develop a rational class. If 500 and 1000 are my inputs, then (½) must be my output. I have …

java simplification rational-numbers
Convert a decimal number to a fraction / rational number

In JavaScript, is there any way to convert a decimal number (such as 0.0002) to a fraction represented as a string (…

javascript decimal fractions rational-numbers
Converting float decimal to fraction

I am trying to convert calculations keyed in by users with decimal results into fractions. For e.g.; 66.6666666667 into 66 2/3. Any …

php math floating-point type-conversion rational-numbers
Algorithm for detecting repeating decimals?

Is there an algorithm for figuring out the following things? If the result of a division is a repeating decimal (…

algorithm rational-numbers
How to convert rational and decimal number strings to floats in python?

How can I convert strings which can denote decimal or rational numbers to floats >>> ["0.1234", "1/2"] ['0.1234', '1/2…

python rational-numbers
C++ program with a self-designed class for rational numbers pairs not working as expected

I have a problem with the code below. It is not performing any function now... neither add nor subtract nor …

c++ math rational-numbers
The "guess the number" game for arbitrary rational numbers?

I once got the following as an interview question: I'm thinking of a positive integer n. Come up with an …

algorithm math puzzle rational-numbers