jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Classes | Namespaces | Typedefs | Functions
fraction_type.hpp File Reference
#include <limits>
#include <ratio>
#include <chrono>
#include <condition_variable>
#include <cstdio>
#include <cinttypes>
#include <cstdint>
#include <cmath>
#include <jau/int_types.hpp>
#include <jau/int_math.hpp>
#include <jau/ordered_atomic.hpp>
#include <jau/cpp_pragma.hpp>
#include <jau/backtrace.hpp>
Include dependency graph for fraction_type.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  jau::fraction< Int_type, >
 Fraction template type using integral values, evaluated at runtime. More...
 
struct  jau::fraction_timespec
 Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platforms. More...
 

Namespaces

namespace  jau
 __pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
 
namespace  jau::fraction_tv
 
namespace  jau::fractions_i64
 fractions namespace to provide fraction constants using int64_t as underlying integral integer type.
 
namespace  jau::fractions_i64_literals
 
namespace  std
 STL namespace.
 

Typedefs

typedef fraction< int64_t > jau::fraction_i64
 fraction using int64_t as integral type More...
 
typedef fraction< uint64_t > jau::fraction_u64
 fraction using uint64_t as integral type More...
 
typedef ordered_atomic< jau::fraction_i64, std::memory_order_relaxed > jau::relaxed_atomic_fraction_i64
 Relaxed non-SC atomic integral scalar jau::fraction_i64. More...
 
typedef ordered_atomic< jau::fraction_u64, std::memory_order_relaxed > jau::relaxed_atomic_fraction_u64
 Relaxed non-SC atomic integral scalar jau::fraction_u64. More...
 
typedef ordered_atomic< jau::fraction_i64, std::memory_order_seq_cst > jau::sc_atomic_fraction_i64
 SC atomic integral scalar jau::fraction_i64. More...
 
typedef ordered_atomic< jau::fraction_u64, std::memory_order_seq_cst > jau::sc_atomic_fraction_u64
 SC atomic integral scalar jau::fraction_u64. More...
 

Functions

template<typename int_type >
constexpr fraction< int_type > jau::abs (const fraction< int_type > &rhs) noexcept
 Returns the absolute fraction. More...
 
constexpr fraction_timespec jau::abs (const fraction_timespec &rhs) noexcept
 Returns the absolute fraction_timespec. More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::days (86 '400l, 1lu)
 days is 86400/1 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::giga (1 '000 '000 '000l, 1lu)
 giga is 10^9 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::hours (3 '600l, 1lu)
 hours is 3660/1 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::kilo (1 '000l, 1lu)
 kilo is 10^3 More...
 
template<typename int_type >
constexpr const fraction< int_type > & jau::max (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Return the maximum of the two given fractions. More...
 
constexpr const fraction_timespec & jau::max (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 Return the maximum of the two given fraction_timespec. More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::mega (1 '000 '000l, 1lu)
 mega is 10^6 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::micro (1l, 1 '000 '000lu)
 micro is 10^-6 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::milli (1l, 1 '000lu)
 milli is 10^-3 More...
 
template<typename int_type >
constexpr const fraction< int_type > & jau::min (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Return the minimum of the two given fractions. More...
 
constexpr const fraction_timespec & jau::min (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 Return the minimum of the two given fraction_timespec. More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::minutes (60l, 1lu)
 minutes is 60/1 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::nano (1l, 1 '000 '000 '000lu)
 nano is 10^-9 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::one (1l, 1lu)
 one is 10^0 or 1/1 More...
 
template<typename int_type >
constexpr bool jau::operator!= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator!= (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_d (unsigned long long int __d)
 Literal for fractions_i64::days. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_G (unsigned long long int __G)
 Literal for fractions_i64::giga. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_h (unsigned long long int __h)
 Literal for fractions_i64::hours. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_k (unsigned long long int __k)
 Literal for fractions_i64::kilo. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_M (unsigned long long int __M)
 Literal for fractions_i64::mega. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_m (unsigned long long int __m)
 Literal for fractions_i64::milli. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_min (unsigned long long int __min)
 Literal for fractions_i64::minutes. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_ms (unsigned long long int __ms)
 Literal for fractions_i64::milli. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_n (unsigned long long int __n)
 Literal for fractions_i64::nano. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_ns (unsigned long long int __ns)
 Literal for fractions_i64::nano. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_one (unsigned long long int __one)
 Literal for fractions_i64::one. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_p (unsigned long long int __p)
 Literal for fractions_i64::pico. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_s (unsigned long long int __s)
 Literal for fractions_i64::seconds. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_T (unsigned long long int __T)
 Literal for fractions_i64::tera. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_u (unsigned long long int __u)
 Literal for fractions_i64::micro. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_us (unsigned long long int __us)
 Literal for fractions_i64::micro. More...
 
constexpr fraction_i64 jau::fractions_i64_literals::operator""_y (unsigned long long int __y)
 Literal for fractions_i64::years. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator* (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Returns product of two fraction. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator* (const fraction< int_type > &lhs, const int_type &rhs) noexcept
 Returns multiplication of fraction with scalar. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator* (const int_type &lhs, const fraction< int_type > &rhs) noexcept
 Returns multiplication of fraction with scalar. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator+ (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Returns sum of two fraction. More...
 
constexpr fraction_timespec jau::operator+ (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 Returns sum of two fraction_timespec. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator- (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Returns difference of two fraction. More...
 
constexpr fraction_timespec jau::operator- (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 Returns difference of two fraction_timespec. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator/ (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 Returns division of two fraction. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator/ (const fraction< int_type > &lhs, const int_type &rhs) noexcept
 Returns division of fraction with scalar. More...
 
template<typename int_type >
constexpr fraction< int_type > jau::operator/ (const int_type &lhs, const fraction< int_type > &rhs) noexcept
 Returns division of fraction with scalar. More...
 
template<typename int_type >
constexpr bool jau::operator< (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator< (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
template<typename int_type >
std::ostream & std::operator<< (std::ostream &os, const jau::fraction< int_type > &v) noexcept
 Output stream operator for jau::fraction. More...
 
std::ostream & std::operator<< (std::ostream &os, const jau::fraction_timespec &v) noexcept
 Output stream operator for jau::fraction_timespec. More...
 
template<typename int_type >
constexpr bool jau::operator<= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator<= (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
template<typename int_type >
constexpr bool jau::operator== (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator== (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
template<typename int_type >
constexpr bool jau::operator> (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator> (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
template<typename int_type >
constexpr bool jau::operator>= (const fraction< int_type > &lhs, const fraction< int_type > &rhs) noexcept
 
constexpr bool jau::operator>= (const fraction_timespec &lhs, const fraction_timespec &rhs) noexcept
 
constexpr const jau::fraction_i64 jau::fractions_i64::pico (1l, 1 '000 '000 '000 '000lu)
 pico is 10^-12 More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::seconds (1l, 1lu)
 seconds is 1/1 More...
 
template<typename int_type >
constexpr snsize_t jau::sign (const fraction< int_type > &rhs) noexcept
 Returns the value of the sign function applied to numerator. More...
 
constexpr snsize_t jau::sign (const fraction_timespec &rhs) noexcept
 Returns the value of the sign function applied to tv_sec. More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::tera (1 '000 '000 '000 '000l, 1lu)
 tera is 10^12 More...
 
bool jau::to_fraction_i64 (fraction_i64 &result, const std::string &value, const fraction_i64 &min_allowed, const fraction_i64 &max_allowed) noexcept
 Stores the fraction_i64 value of the given string value in format <num>/<denom>, which may contain whitespace. More...
 
template<typename int_type >
std::string jau::to_string (const fraction< int_type > &v) noexcept
 
std::string jau::to_string (const fraction_timespec &v) noexcept
 
constexpr const jau::fraction_i64 jau::fractions_i64::years (31 '557 '600l, 1lu)
 years is 31'557'600/1 using 365.2425 days per year More...
 
constexpr const jau::fraction_timespec jau::fraction_tv::zero (0, 0)
 jau::fraction_timespec zero is { 0, 0 } More...
 
constexpr const jau::fraction_i64 jau::fractions_i64::zero (0l, 1lu)
 zero is 0/1 More...