Problem Question How can the following implementation of fractionParse be made less ugly? (Preserving unreduced numerators and denominators is supposed […]

# Tag: rational-numbers

## Rational class with Java

Problem Here is a class to handle fractions with Java using BigInteger because it supports gcd calculus. I don’t know […]

## My Rational struct, version 2

Problem I implemented most of the suggestions from Version 1. Thanks to all who took time to review and offer […]

## Rational class supporting precise numbers

Problem This is my JavaScript Rational class, similar to other languages’ BigFraction class, but with one major difference: This class […]

## Fraction or integer parser

Problem Question How can the following implementation of fractionParse be made less ugly? (Preserving unreduced numerators and denominators is supposed […]

## A utility class for fractions

Problem I’ve been working though Project Euler problems using JavaScript, and along the way I’ve found it useful to create […]

## Fraction (rational number) structure with custom operators

Problem First, the struct itself: struct Fraction { var numerator: Int var denominator: Int { didSet (oldDenominator) { if self.denominator […]

## My Rational struct, version 1

Problem I have written a Rational struct for working with rational numbers, i.e. Rational(int numerator, int denominator). A recent post […]

## “Rational” Wrapper class with support for Rational Number Approximation

Problem Enough with imprecise floating point datatypes called float anddouble. I present to you Rational. Of course, Rational number arithmetic […]

## Creating and testing a Fraction class

Problem The exercise is as follows: Create a class called Fraction that can be used to represent the ratio of […]

- 1
- 2