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