struct Rational

Defined at line 17 of file ../../src/camera/lib/numerics/rational.h

Rational represents a rational number. All operations attempt to leave the number as a reduced

fraction, but no attempt is made to detect or avoid overflow, division by zero, or other

undefined behaviors.

Public Members

int64_t n
int64_t d

Public Methods

Rational & Reduce ()

Transforms the number into a reduced fraction and ensures the denominator is non-negative.

Defined at line 11 of file ../../src/camera/lib/numerics/rational.cc

Rational & operator+= (const Rational & r)

Defined at line 30 of file ../../src/camera/lib/numerics/rational.cc

Rational & operator-= (const Rational & r)

Defined at line 35 of file ../../src/camera/lib/numerics/rational.cc

Rational & operator*= (const Rational & r)

Defined at line 40 of file ../../src/camera/lib/numerics/rational.cc

Rational & operator/= (const Rational & r)

Defined at line 45 of file ../../src/camera/lib/numerics/rational.cc

Friends

std::ostream & Rational (std::ostream & osconst Rational & r)