# Questions tagged [rational-numbers]

In mathematics, a rational number is any number that can be expressed as the quotient or fraction p/q of two integers, with the denominator q not equal to zero.

13 questions
Filter by
Sorted by
Tagged with
3k views

### Fraction class implemented in Objective-C

Inspired by this question: Fraction (rational number) structure with custom operators, I have written this class for doing some simple work with fractions. ...
13k views

### Implementation of a Rational Number class in C++

First of all, disclaimer; this is for a school assignment. I hope I'm not doing anything inappropriate by asking for input on it, but if it makes a difference, the assignment has already been ...
2k views

### My Rational struct, version 2

I implemented most of the suggestions from Version 1. Thanks to all who took time to review and offer really good comments. ...
4k views

### Fraction class in Java

(See the next iteration.) I have this class for representing exact fractions. See what I have: Fraction.java: ...
784 views

### Risk battle simulator v1

I've written a program to find the odds of either side winning a battle in Risk, and how many men they would have left. I've finished, but I feel that it can be improved since it doesn't function if ...
726 views

### My Rational struct, version 1

I have written a Rational struct for working with rational numbers, i.e. Rational(int numerator, int denominator). A recent ...
2k views

### A fraction of the code

Following up on this post, and including some major changes suggested, here's the revised code. Changes include: No longer keeping an IFormatProvider at instance ...
1k views

### Formattable Fraction

I have written this small little program, to test how my Fraction type behaves when used with and without a custom ...
2k views

### Using TryXXX pattern to avoid exceptions

I have been using the TryXXX and GetXXX pattern lately to give clients a choice whether to trap an exception or to read a boolean. An example of this concept would be ...
3k views

### Fraction (rational number) structure with custom operators

First, the struct itself: ...
3k views

### Cleaning up Reverse Polish Notation evaluator

I was wondering if anyone had some general clean up advice on my code. I believe that more helper functions would be my case but I could be wrong. 30 lines maximum per method is my rule. I can't seem ...