31 #include "../include/Fraction.h"
45 return float(
num) / float(
den);
50 return double(
num) / double(
den);
55 return round((
double)
num /
den);
68 second = first % second;
This class represents a fraction.
int num
Numerator for the fraction.
Fraction()
Default Constructor.
Fraction Reciprocal()
Return the reciprocal as a Fraction.
float ToFloat()
Return this fraction as a float (i.e. 1/2 = 0.5)
double ToDouble()
Return this fraction as a double (i.e. 1/2 = 0.5)
void Reduce()
Reduce this fraction (i.e. 640/480 = 4/3)
int ToInt()
Return a rounded integer of the fraction (for example 30000/1001 returns 30)
int GreatestCommonDenominator()
Calculate the greatest common denominator.
int den
Denominator for the fraction.
This namespace is the default namespace for all code in the openshot library.