YSTest
PreAlpha_b500_20140530
The YSLib Test Project
|
通用定点数。 更多...
#include <rational.hpp>
Public 类型 | |
using | base_type = _tBase |
Public 成员函数 | |
fixed_point () | |
无参数构造。 更多... | |
bool | operator< (const fixed_point &f) const |
bool | operator== (const fixed_point &f) const |
bool | operator! () const |
fixed_point | operator- () const |
fixed_point & | operator++ () |
fixed_point & | operator-- () |
fixed_point & | operator+= (const fixed_point &f) |
fixed_point & | operator-= (const fixed_point &f) |
fixed_point & | operator*= (const fixed_point &f) |
fixed_point & | operator/= (const fixed_point &f) |
fixed_point & | operator>>= (size_t s) |
fixed_point & | operator<<= (size_t s) |
template<typename _type , typename = enable_if_t<is_arithmetic<_type>::value, _type>> | |
operator _type () const | |
base_type | get () const |
fixed_point (base_type v, raw_tag) | |
template<typename _tInt > | |
fixed_point (_tInt val, enable_if_t< is_integral< _tInt >::value, _tInt * >={}) | |
template<typename _tFloat > | |
fixed_point (_tFloat val, enable_if_t< is_floating_point< _tFloat >::value, _tFloat * >={}) | |
template<typename _tFirst , typename _tSecond > | |
fixed_point (_tFirst x, _tSecond y, enable_if_t< is_integral< _tFirst >::value &&!is_same< _tSecond, raw_tag >::value, _tFirst * >={}) | |
template<typename _tFirst , typename _tSecond > | |
fixed_point (_tFirst x, _tSecond y, enable_if_t< is_floating_point< _tFirst >::value &&!is_same< _tSecond, raw_tag >::value, _tFirst * >={}) | |
fixed_point (const fixed_point &)=default | |
template<size_t _vOtherInt, size_t _vOtherFrac> | |
fixed_point (const fixed_point< base_type, _vOtherInt, _vOtherFrac > &f, enable_if_t<(_vOtherInt< int_bit_n), base_type * >={}) | |
template<size_t _vOtherInt, size_t _vOtherFrac> | |
fixed_point (const fixed_point< base_type, _vOtherInt, _vOtherFrac > &f, enable_if_t<(int_bit_n< _vOtherInt), base_type * >={}) | |
template<typename _tOtherBase , size_t _vOtherInt, size_t _vOtherFrac> | |
fixed_point (const fixed_point< _tOtherBase, _vOtherInt, _vOtherFrac > &f, enable_if_t<(frac_bit_n==_vOtherFrac), base_type * >={}) | |
template<typename _tOtherBase , size_t _vOtherInt, size_t _vOtherFrac> | |
fixed_point (const fixed_point< _tOtherBase, _vOtherInt, _vOtherFrac > &f, enable_if_t<(frac_bit_n< _vOtherFrac), base_type * >={}) | |
template<typename _tOtherBase , size_t _vOtherInt, size_t _vOtherFrac> | |
fixed_point (const fixed_point< _tOtherBase, _vOtherInt, _vOtherFrac > &f, enable_if_t<(_vOtherFrac< frac_bit_n), base_type * >={}) | |
静态 Public 成员函数 | |
static base_type | base_element () |
取 base_type 表达的单位元。 更多... | |
static fixed_point | identity () |
取单位元。 更多... | |
静态 Public 属性 | |
static const size_t | int_bit_n = _vInt |
整数部分二进制位数。 更多... | |
static const size_t | frac_bit_n = _vFrac |
小数部分二进制位数。 更多... | |
static const size_t | digit_bit_n = int_bit_n + frac_bit_n |
非符号位的二进制位数。 更多... | |
Private 成员函数 | |
template<typename _type > | |
enable_if_t< is_integral < _type >::value, _type > | cast () const |
template<typename _type > | |
enable_if_t< is_floating_point < _type >::value, _type > | cast () const |
静态 Private 成员函数 | |
template<size_t _vShiftBits> | |
static base_type | mul (base_type x, base_type y, true_type) |
template<size_t _vShiftBits> | |
static base_type | mul (base_type x, base_type y, false_type) |
template<size_t _vShiftBits> | |
static base_type | mul_signed (typename fixed_multiplicative< base_type >::type tmp) |
Private 属性 | |
base_type | value |
友元 | |
template<typename _OtherBase , size_t _vOtherInt, size_t _vOtherFrac> | |
class | fixed_point |
class | std::numeric_limits< fixed_point< _tBase, _vInt, _vFrac > > |
fixed_point | fabs (fixed_point x) |
fixed_point | ceil (fixed_point x) |
fixed_point | floor (fixed_point x) |
fixed_point | round (fixed_point x) |
通用定点数。
基于整数算术实现的确定有限精度二进制定点小数类型。可用于替换内建的浮点数类型。 是否有符号同基本整数类型参数。若有符号,则最高有效位为符号位。 逻辑布局: [符号位]|整数部分|小数部分 。各个部分的内部为补码表示。
_tBase | 基本整数类型。 |
_vInt | 整数部分(若有符号则不包括符号位,下同)二进制位数。 |
_vFrac | 分数部分二进制位数。 |
实现模除和位操作。
根据范围禁止算术类型隐式转换。
在文件 rational.hpp 第 139 行定义.
using ystdex::fixed_point< _tBase, _vInt, _vFrac >::base_type = _tBase |
在文件 rational.hpp 第 152 行定义.
|
inline |
无参数构造。
在文件 rational.hpp 第 170 行定义.
参考自 ystdex::fixed_point< _tBase, _vInt, _vFrac >::identity().
|
inline |
在文件 rational.hpp 第 176 行定义.
|
inline |
在文件 rational.hpp 第 181 行定义.
|
inline |
在文件 rational.hpp 第 187 行定义.
|
inline |
在文件 rational.hpp 第 195 行定义.
|
inline |
在文件 rational.hpp 第 201 行定义.
|
inlinedefault |
|
inline |
在文件 rational.hpp 第 210 行定义.
|
inline |
在文件 rational.hpp 第 216 行定义.
|
inline |
在文件 rational.hpp 第 222 行定义.
|
inline |
在文件 rational.hpp 第 228 行定义.
|
inline |
在文件 rational.hpp 第 234 行定义.
|
inlinestatic |
取 base_type
表达的单位元。
取值等于 1 的元素,使用 base_type
表达。
在文件 rational.hpp 第 390 行定义.
参考 ystdex::fixed_point< _tBase, _vInt, _vFrac >::frac_bit_n.
参考自 ystdex::fixed_point< _tBase, _vInt, _vFrac >::cast(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::identity(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator++() , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator--().
|
inlineprivate |
在文件 rational.hpp 第 346 行定义.
参考 ystdex::fixed_point< _tBase, _vInt, _vFrac >::frac_bit_n , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::value.
|
inlineprivate |
在文件 rational.hpp 第 353 行定义.
参考 ystdex::fixed_point< _tBase, _vInt, _vFrac >::base_element() , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::value.
|
inline |
|
inlinestatic |
取单位元。
取值等于 1 的元素。
在文件 rational.hpp 第 401 行定义.
参考 ystdex::fixed_point< _tBase, _vInt, _vFrac >::base_element() , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::fixed_point().
|
inlinestaticprivate |
在文件 rational.hpp 第 360 行定义.
|
inlinestaticprivate |
在文件 rational.hpp 第 367 行定义.
|
inlinestaticprivate |
在文件 rational.hpp 第 378 行定义.
|
inline |
在文件 rational.hpp 第 330 行定义.
|
inline |
在文件 rational.hpp 第 253 行定义.
|
inline |
在文件 rational.hpp 第 296 行定义.
|
inline |
|
inline |
在文件 rational.hpp 第 282 行定义.
|
inline |
在文件 rational.hpp 第 259 行定义.
|
inline |
|
inline |
在文件 rational.hpp 第 289 行定义.
|
inline |
|
inline |
在文件 rational.hpp 第 241 行定义.
|
inline |
在文件 rational.hpp 第 320 行定义.
参考 platform_ex::Windows::s , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::value.
|
inline |
在文件 rational.hpp 第 247 行定义.
|
inline |
在文件 rational.hpp 第 313 行定义.
参考 platform_ex::Windows::s , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::value.
|
friend |
在文件 rational.hpp 第 413 行定义.
|
friend |
在文件 rational.hpp 第 407 行定义.
|
friend |
在文件 rational.hpp 第 141 行定义.
|
friend |
在文件 rational.hpp 第 420 行定义.
|
friend |
在文件 rational.hpp 第 426 行定义.
|
friend |
在文件 rational.hpp 第 149 行定义.
|
static |
非符号位的二进制位数。
在文件 rational.hpp 第 159 行定义.
|
static |
|
static |
整数部分二进制位数。
在文件 rational.hpp 第 155 行定义.
|
private |
在文件 rational.hpp 第 162 行定义.
参考自 ystdex::fixed_point< _tBase, _vInt, _vFrac >::cast(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::get(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator!(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator*=(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator++(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator+=(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator-(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator--(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator-=(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator/=(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator<(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator<<=(), ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator==() , 以及 ystdex::fixed_point< _tBase, _vInt, _vFrac >::operator>>=().