numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::numbers Namespace Reference

Namespace of classes of numbers. More...

Namespaces

namespace  impl
 Namespace of internal implementations.
 

Classes

class  custom_float
 Class of floating numbers in a custom number system with given radix. More...
 
class  fraction
 Class of fractions. More...
 

Functions

template<num_collect::base::concepts::integral Integer>
constexpr auto operator* (const fraction< Integer > &left, const fraction< Integer > &right) -> fraction< Integer >
 Multiply two fractions.
 
template<num_collect::base::concepts::integral Integer>
constexpr auto operator+ (const fraction< Integer > &left, const fraction< Integer > &right) -> fraction< Integer >
 Add two fractions.
 
template<num_collect::base::concepts::integral Integer>
constexpr auto operator- (const fraction< Integer > &left, const fraction< Integer > &right) -> fraction< Integer >
 Subtract a fraction from another fraction.
 
template<num_collect::base::concepts::integral Integer>
constexpr auto operator/ (const fraction< Integer > &left, const fraction< Integer > &right) -> fraction< Integer >
 Divide a fraction by another fraction.
 
template<num_collect::base::concepts::integral Integer>
auto operator<< (std::ostream &stream, const fraction< Integer > &val) -> std::ostream &
 Format a fraction.
 

Detailed Description

Namespace of classes of numbers.

Function Documentation

◆ operator*()

auto num_collect::numbers::operator* ( const fraction< Integer > & left,
const fraction< Integer > & right ) -> fraction<Integer>
constexpr

Multiply two fractions.

Template Parameters
IntegerType of integers in the fractions.
Parameters
[in]leftLeft-hand-side value.
[in]rightRight-hand-side value.
Returns
Product of the fractions.

Definition at line 331 of file fraction.h.

◆ operator+()

auto num_collect::numbers::operator+ ( const fraction< Integer > & left,
const fraction< Integer > & right ) -> fraction<Integer>
constexpr

Add two fractions.

Template Parameters
IntegerType of integers in the fractions.
Parameters
[in]leftLeft-hand-side value.
[in]rightRight-hand-side value.
Returns
Sum of the fractions.

Definition at line 303 of file fraction.h.

◆ operator-()

auto num_collect::numbers::operator- ( const fraction< Integer > & left,
const fraction< Integer > & right ) -> fraction<Integer>
constexpr

Subtract a fraction from another fraction.

Template Parameters
IntegerType of integers in the fractions.
Parameters
[in]leftLeft-hand-side value.
[in]rightRight-hand-side value.
Returns
Difference of the fractions.

Definition at line 317 of file fraction.h.

◆ operator/()

auto num_collect::numbers::operator/ ( const fraction< Integer > & left,
const fraction< Integer > & right ) -> fraction<Integer>
constexpr

Divide a fraction by another fraction.

Template Parameters
IntegerType of integers in the fractions.
Parameters
[in]leftLeft-hand-side value.
[in]rightRight-hand-side value.
Returns
Quotient of the fractions.

Definition at line 345 of file fraction.h.

◆ operator<<()

auto num_collect::numbers::operator<< ( std::ostream & stream,
const fraction< Integer > & val ) -> std::ostream&
inline

Format a fraction.

Template Parameters
IntegerType of integers in the fraction.
Parameters
[in]streamOutput stream.
[in]valFraction value.
Returns
Output stream.

Definition at line 400 of file fraction.h.