#include <rational.h>
Definition at line 13 of file rational.h.
◆ Rational() [1/2]
| constexpr impeller::Rational::Rational |
( |
int32_t |
num | ) |
|
|
inlineexplicitconstexpr |
◆ Rational() [2/2]
| constexpr impeller::Rational::Rational |
( |
int32_t |
num, |
|
|
uint32_t |
den |
|
) |
| |
|
inlineconstexpr |
Definition at line 17 of file rational.h.
17 : num_(num), den_(den) {}
◆ GetDenominator()
| uint32_t impeller::Rational::GetDenominator |
( |
| ) |
const |
|
inline |
◆ GetHash()
| uint64_t impeller::Rational::GetHash |
( |
| ) |
const |
◆ GetNumerator()
| int32_t impeller::Rational::GetNumerator |
( |
| ) |
const |
|
inline |
◆ Invert()
| Rational impeller::Rational::Invert |
( |
| ) |
const |
◆ operator Scalar()
| impeller::Rational::operator Scalar |
( |
| ) |
const |
|
inlineexplicit |
Definition at line 31 of file rational.h.
31 {
return static_cast<float>(num_) / den_; }
◆ operator!=()
| bool impeller::Rational::operator!= |
( |
const Rational & |
that | ) |
const |
Definition at line 28 of file rational.cc.
29 return !(*
this == that);
◆ operator<()
| bool impeller::Rational::operator< |
( |
const Rational & |
that | ) |
const |
Definition at line 32 of file rational.cc.
33 if (den_ == that.den_) {
34 return num_ < that.num_;
35 }
else if ((num_ >= 0) != (that.num_ >= 0)) {
36 return num_ < that.num_;
38 return AbsToUnsigned(num_) * that.den_ < AbsToUnsigned(that.num_) * den_;
◆ operator==()
| bool impeller::Rational::operator== |
( |
const Rational & |
that | ) |
const |
Definition at line 18 of file rational.cc.
19 if (den_ == that.den_) {
20 return num_ == that.num_;
21 }
else if ((num_ >= 0) != (that.num_ >= 0)) {
24 return AbsToUnsigned(num_) * that.den_ == AbsToUnsigned(that.num_) * den_;
The documentation for this class was generated from the following files: