Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Backend Requirements

Boost , Chapter 1. Boost.Multiprecision , Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Требования к аргументу<Backend>шаблона<number>разделены на разделы: обязательные и факультативные.

Обязательные требования не имеют реализации по умолчанию в библиотеке, поэтому, если функция, которую они реализуют, должна поддерживаться вообще, то они должны быть реализованы бэкэндом.

Дополнительные требования имеют реализации по умолчанию, которые называются, если бэкэнд не предоставляет свой собственный. Как правило, бэкэнд реализует их для повышения производительности.

В следующих таблицах тип B является<Backend>шаблонным аргументом для<number>,<b>и<b2>являются переменными типа B*,<pb>является переменной типа B*,<cb>,<cb2>и<cb3>являются постоянными переменными типа<const B>,<rb>является переменной типа<B&&>,<a>и<a2>являются переменными типа<constchar*>,<ui>является переменной типа<unsigned>,<bb>является переменной типа указателя-арифметического типа,<pa>является переменной типа<B::exp_type>,<pexp>является переменной типа<B::exp_type*>,<i>является переменной типа<int>,<pi>указывает на переменную типа<int>, B2 является другим типом, который отвечает этим требованиям, b2 является переменной типа B2,<ss>является переменной типа<std::streamsize>и<ff>является переменной типа<std::ios_base::fmtflags>.

Table 1.8. Compulsory Requirements on the Backend type.

выражение

Тип возврата

Комментарий

броски

B::signed_types

mpl::list<type-list>

A list of signed integral types that can be assigned to type B. The types shall be listed in order of size, smallest first, and shall terminate in the type that is std::intmax_t.

 

B::unsigned_types

mpl::list<type-list>

A list of unsigned integral types that can be assigned to type B. The types shall be listed in order of size, smallest first, and shall terminate in the type that is std::uintmax_t.

 

<B::float_types>

mpl::list<type-list>

Перечень типов с плавающей запятой, которые могут быть присвоены типу В. Эти типы должны быть перечислены в порядке размера, наименьшего первого, и должны заканчиваться типом<longdouble>

.

 

<B::exponent_type>

Подписанный интегральный тип.

The type of the exponent of type B. This type is required only for floating-point types.

 

<B()>

Default constructor.

 

B(cb)

Copy Constructor.

 

<b= b>

B&

Оператор передачи.

 

b = a

B&

Назначение арифметического типа. Тип<a>должен быть указан в одном из типовых списков<B::signed_types>,<B::unsigned_types>или<B::float_types>.

 

b = s

B&

Assignment from a string.

Throws a std::runtime_error if the string could not be interpreted as a valid number.

<b.swap(b)>

<void>

Swaps the contents of its arguments.

noexcept

cb.str(ss, ff)

std::string

Returns the string representation of b with ss digits and formatted according to the flags set in ff. If ss is zero, then returns as many digits as are required to reconstruct the original value.

 

<b.negate()>

<void>

Negates b.

 

cb.compare(cb2)

<int>

Compares cb and cb2, returns a value less than zero if cb < cb2, a value greater than zero if cb > cb2 and zero if cb == cb2.

noexcept

<cb.compare(a)>

<int>

Compares cb and a, returns a value less than zero if cb < a, a value greater than zero if cb > a and zero if cb == a. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types.

 

eval_add(b, cb)

<void>

Добавляет<cb>к<b>

.

 

eval_subtract(b, cb)

<void>

Subtracts cb from b.

 

eval_multiply(b, cb)

<void>

Умножает<b>на<cb>

.

 

<eval_divide(b, cb)>

<void>

Divides b by cb.

<std::overflow_error>если cb имеет значение ноль, и<std::numeric_limits<number<B>>::has_infinity== false>

<eval_modulus(b, cb)>

<void>

Вычисления<b%= cb>, необходимые только тогда, когда<B>является целым типом.

std::overflow_error if cb has the value zero.

eval_bitwise_and(b, cb)

<void>

Вычисления<b&= cb>, необходимые только тогда, когда<B>является целым типом.

 

eval_bitwise_or(b, cb)

<void>

Computes b |= cb, only required when B is an integer type.

 

<eval_bitwise_xor(b,cb)>

<void>

Вычисления<b^= cb>, необходимые только тогда, когда<B>является целым типом.

 

eval_complement(b, cb)

<void>

Computes the ones-complement of cb and stores the result in b, only required when B is an integer type.

 

eval_left_shift(b, ui)

<void>

Computes b <<= ui, only required when B is an integer type.

 

eval_right_shift(b, ui)

<void>

Computes b >>= ui, only required when B is an integer type.

 

<eval_convert_to(pa,cb)>

<void>

Converts cb to the type of *pa and store the result in *pa. Type B shall support conversion to at least types std::intmax_t, std::uintmax_t and long long. Conversion to other arithmetic types can then be synthesised using other operations. Conversions to other types are entirely optional.

 

eval_frexp(b, cb, pexp)

<void>

Stores values in b and *pexp such that the value of cb is b * 2*pexp, only required when B is a floating-point type.

 

<eval_ldexp(b, cb, exp)>

<void>

Хранит значение в<b>, которое является cb * 2exp, только если<B>является типом с плавающей точкой.

 

eval_frexp(b, cb, pi)

<void>

Stores values in b and *pi such that the value of cb is b * 2*pi, only required when B is a floating-point type.

std::runtime_error if the exponent of cb is too large to be stored in an int.

eval_ldexp(b, cb, i)

<void>

Хранит значение в<b>, которое является cb * 2i, только если<B>является типом с плавающей точкой.

 

eval_floor(b, cb)

<void>

Stores the floor of cb in b, only required when B is a floating-point type.

 

<eval_ceil(b, cb)>

<void>

Хранит потолок<cb>в<b>, только если<B>является типом с плавающей точкой.

 

<eval_sqrt(b, cb)>

<void>

Хранит квадратный корень<cb>в<b>, только если<B>является типом с плавающей точкой.

 

boost::multiprecision::number_category<B>::type

<mpl::int_<N>>

N is one of the values number_kind_integer, number_kind_floating_point, number_kind_rational or number_kind_fixed_point. Defaults to number_kind_floating_point.

 


Table 1.9. Optional Requirements on the Backend Type

выражение

Возвращение

Комментарий

броски

Конструкция и назначение:

   

<B(rb)>

<B>

Move constructor. Afterwards variable rb shall be in sane state, albeit with unspecified value. Only destruction and assignment to the moved-from variable rb need be supported after the operation.

noexcept

<b= rb>

B&

Move-assign. Afterwards variable rb shall be in sane state, albeit with unspecified value. Only destruction and assignment to the moved-from variable rb need be supported after the operation.

noexcept

B(a)

<B>

Прямое построение из арифметического типа. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Когда это не предусмотрено, эта операция моделируется с использованием построения по умолчанию с последующим назначением.

 

B(b2)

<B>

Копировать конструктор из другого бэкэнд-типа. Когда это не предусмотрено, используется общая процедура интерконверсии. Этот конструктор может быть<explicit>, если соответствующий интерфейсный конструктор также должен быть<explicit>

.

 

b = b2

<b&>

Оператор назначения из другого бэкэнд-типа. Когда это не предусмотрено, используется общая процедура интерконверсии.

 

assign_components(b, a, a)

<void>

Назначает<b>два компонента в следующих аргументах. Это относится только к рациональным и сложным типам чисел. Если не предусмотрено, арифметические операции используются для синтеза результата из двух значений.

 

assign_components(b, b2, b2)

<void>

Назначает<b>два компонента в следующих аргументах. Это относится только к рациональным и сложным типам чисел. Если не предусмотрено, арифметические операции используются для синтеза результата из двух значений.

 

Comparisons:

   

eval_eq(cb, cb2)

<bool>

Возврат<true>, если<cb>и<cb2>равны по стоимости. Если не предусмотрено, реализация по умолчанию возвращается<cb.compare(cb2) ==0>.

noexcept

eval_eq(cb, a)

<bool>

Returns true if cb and a are equal in value. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, return the equivalent of eval_eq(cb, B(a)).

 

<eval_eq(a, cb)>

<bool>

Returns true if cb and a are equal in value. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version returns eval_eq(cb, a).

 

<eval_lt(cb, cb2)>

<bool>

Возврат<true>, если<cb>меньше<cb2>по стоимости. Если не предусмотрено, реализация по умолчанию возвращается<cb.compare(cb2)< 0>

.

noexcept

<eval_lt(cb, a)>

<bool>

Возврат<true>, если<cb>меньше<a>по стоимости. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если не предусмотрено, реализация по умолчанию возвращается<eval_lt(cb,B(a))>.

 

<eval_lt(a, cb)>

<bool>

Returns true if a is less than cb in value. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default implementation returns eval_gt(cb, a).

 

eval_gt(cb, cb2)

<bool>

Возврат<true>, если<cb>больше<cb2>по стоимости. Если не предусмотрено, реализация по умолчанию возвращается<cb.compare(cb2)> 0>.

noexcept

<eval_gt(cb, a)>

<bool>

Returns true if cb is greater than a in value. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default implementation returns eval_gt(cb, B(a)).

 

<eval_gt(a, cb)>

<bool>

Возврат<true>, если<a>больше<cb>по стоимости. Тип<a>указывается в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если не предусмотрено, реализация по умолчанию возвращается<eval_lt(cb,a)>.

 

<eval_is_zero(cb)>

<bool>

Возвращается<true>, если<cb>равно нулю, в противном случае<false>. По умолчанию версия этой функции возвращается<cb.compare(ui_type(0))== 0>, где<ui_type><ui_type><typenamempl::front<typename B::unsigned_types>::type>

.

 

eval_get_sign(cb)

<int>

Возвращает значение< ноль, если<cb>отрицательный, значение >ноль, если<cb>положительный, и ноль, если<cb>нулевой. По умолчанию версия этой функции возвращается<cb.compare(ui_type(0))>, где<ui_type>—<ui_type>—<typenamempl::front<typename B::unsigned_types>::type>.

 

Basic arithmetic:

   

eval_add(b, a)

<void>

Adds a to b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_add(b, B(a))

 

<eval_add(b, cb, cb2)>

<void>

Add cb to cb2 and stores the result in b. When not provided, does the equivalent of b = cb; eval_add(b, cb2).

 

eval_add(b, cb, a)

<void>

Добавить<cb>к<a>и сохранить результат в<b>. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то получается<eval_add(b,cb,B(a))>

.

 

eval_add(b, a, cb)

<void>

Add a to cb and stores the result in b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_add(b, cb, a).

 

<eval_subtract(b, a)>

<void>

Subtracts a from b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_subtract(b, B(a))

 

eval_subtract(b, cb, cb2)

<void>

Subtracts cb2 from cb and stores the result in b. When not provided, does the equivalent of b = cb; eval_subtract(b, cb2).

 

<eval_subtract(b, cb, a)>

<void>

Вычитает<a>из<cb>и сохраняет результат в<b>. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_subtract(b,cb,B(a))>

.

 

eval_subtract(b, a, cb)

<void>

Вычитает<cb>из<a>и сохраняет результат в<b>. Тип<a>должен быть указан в одном из перечней типов<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_subtract(b,cb,a);b.negate();>

.

 

<eval_multiply(b, a)>

<void>

Multiplies b by a. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_multiply(b, B(a))

 

eval_multiply(b, cb, cb2)

<void>

Multiplies cb by cb2 and stores the result in b. When not provided, does the equivalent of b = cb; eval_multiply(b, cb2).

 

<eval_multiply(b, cb, a)>

<void>

Multiplies cb by a and stores the result in b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_multiply(b, cb, B(a)).

 

eval_multiply(b, a, cb)

<void>

Умножает<a>на<cb>и сохраняет результат в<b>. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_multiply(b,cb,a)>

.

 

eval_multiply_add(b, cb, cb2)

<void>

Умножает<cb>на<cb2>и добавляет результат к<b>. Если же нет, то это равносильно созданию временного<Bt>и<eval_multiply(t,cb,cb2)>, а затем<eval_add(b,t)>

.

 

eval_multiply_add(b, cb, a)

<void>

Multiplies a by cb and adds the result to b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided does the equivalent of creating a temporary B t and eval_multiply(t, cb, a) followed by eval_add(b, t).

 

eval_multiply_add(b, a, cb)

<void>

Умножает<a>на<cb>и добавляет результат к<b>. Тип<a>должен быть указан в одном из перечней типов<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_multiply_add(b,cb,a)>

.

 

<eval_multiply_subtract(b,cb,cb2)>

<void>

Multiplies cb by cb2 and subtracts the result from b. When not provided does the equivalent of creating a temporary B t and eval_multiply(t, cb, cb2) followed by eval_subtract(b, t).

 

<eval_multiply_subtract(b,cb,a)>

<void>

Multiplies a by cb and subtracts the result from b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided does the equivalent of creating a temporary B t and eval_multiply(t, cb, a) followed by eval_subtract(b, t).

 

eval_multiply_subtract(b, a, cb)

<void>

Умножает<a>на<cb>и вычитает результат из<b>. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_multiply_subtract(b,cb,a)>

.

 

eval_multiply_add(b, cb, cb2, cb3)

<void>

Умножает<cb>на<cb2>и добавляет результат к<cb3>, сохраняя результат в<b>. Если же нет, то<eval_multiply(b,cb,cb2)>следует<eval_add(b,cb3)>. Для краткости здесь показана только версия, показывающая все аргументы типа<B>, но вы можете заменить до любых 2 из<cb>,<cb2>и<cb3>любым типом, перечисленным в одном из списков типов<B::signed_types>,<B::unsigned_types>или<B::float_types>.

 

eval_multiply_subtract(b, cb, cb2, cb3)

<void>

Умножает<cb>на<cb2>и вычитает из результата<cb3>, сохраняя результат в<b>. Если же нет, то<eval_multiply(b,cb,cb2)>следует<eval_subtract(b,cb3)>. Для краткости здесь показана только версия, показывающая все аргументы типа<B>, но вы можете заменить до любых 2 из<cb>,<cb2>и<cb3>любым типом, перечисленным в одном из списков типов<B::signed_types>,<B::unsigned_types>или<B::float_types>.

 

<eval_divide(b, a)>

<void>

Divides b by a. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_divide(b, B(a))

std::overflow_error if a has the value zero, and std::numeric_limits<number<B> >::has_infinity == false

eval_divide(b, cb, cb2)

<void>

Divides cb by cb2 and stores the result in b. When not provided, does the equivalent of b = cb; eval_divide(b, cb2).

std::overflow_error if cb2 has the value zero, and std::numeric_limits<number<B> >::has_infinity == false

eval_divide(b, cb, a)

<void>

Divides cb by a and stores the result in b. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_divide(b, cb, B(a)).

std::overflow_error if a has the value zero, and std::numeric_limits<number<B> >::has_infinity == false

<eval_divide(b, a, cb)>

<void>

Разделяет<a>на<cb>и сохраняет результат в<b>. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_divide(b,B(a),cb)>

.

<std::overflow_error>если cb имеет значение ноль, и<std::numeric_limits<number<B>>::has_infinity== false>

eval_increment(b)

void

Увеличивает значение<b>на единицу. Если же нет, то это равносильно<eval_add(b, static_cast<ui_type>(1u))>. где<ui_type><typenamempl::front<typename B::unsigned_types>::type>

.

 

<eval_decrement(b)>

void

Уменьшает значение<b>на единицу. Если же нет, то это равносильно<eval_subtract(b, static_cast<ui_type>(1u))>. где<ui_type><typenamempl::front<typename B::unsigned_types>::type>

.

 

Integer specific operations:

   

<eval_modulus(b, a)>

<void>

Вычисления<b%= cb>, необходимые только тогда, когда<B>является целым типом. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если не указано, по умолчанию версия вызывает<eval_modulus(b,B(a))>

<std::overflow_error>, если<a>имеет нулевое значение.

eval_modulus(b, cb, cb2)

<void>

Computes cb % cb2 and stores the result in b, only required when B is an integer type. When not provided, does the equivalent of b = cb; eval_modulus(b, cb2).

<std::overflow_error>, если<a>имеет нулевое значение.

<eval_modulus(b, cb, a)>

<void>

Вычисляет<cb% a>и сохраняет результат в<b>, только если<B>является целым типом. Тип<a>должен быть указан в одном из перечней типов<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_modulus(b,cb,B(a))>

.

<std::overflow_error>, если<a>имеет нулевое значение.

<eval_modulus(b, a, cb)>

<void>

Computes cb % a and stores the result in b, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_modulus(b, B(a), cb).

<std::overflow_error>, если<a>имеет нулевое значение.

eval_bitwise_and(b, a)

<void>

Computes b &= cb, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_bitwise_and(b, B(a))

 

<eval_bitwise_and(b,cb,cb2)>

<void>

Computes cb & cb2 and stores the result in b, only required when B is an integer type. When not provided, does the equivalent of b = cb; eval_bitwise_and(b, cb2).

 

<eval_bitwise_and(b,cb,a)>

<void>

Computes cb & a and stores the result in b, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_bitwise_and(b, cb, B(a)).

 

<eval_bitwise_and(b,a,cb)>

<void>

Вычисляет<cb& a>и сохраняет результат в<b>, только если<B>является целым типом. Тип<a>должен быть указан в одном из перечней типов<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_bitwise_and(b,cb,a)>

.

 

<eval_bitwise_or(b,a)>

<void>

Вычисления<b|= cb>, необходимые только тогда, когда<B>является целым типом. Тип<a>должен быть указан в одном из перечней типов<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если не указано, по умолчанию версия вызывает<eval_bitwise_or(b,B(a))>

 

eval_bitwise_or(b, cb, cb2)

<void>

Вычисляет<cb| cb2>и сохраняет результат в<b>, только если<B>является целым типом. Если же нет, то получается<b =cb;eval_bitwise_or(b,cb2)>

.

 

<eval_bitwise_or(b,cb,a)>

<void>

Computes cb | a and stores the result in b, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_bitwise_or(b, cb, B(a)).

 

eval_bitwise_or(b, a, cb)

<void>

Computes cb | a and stores the result in b, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_bitwise_or(b, cb, a).

 

eval_bitwise_xor(b, a)

<void>

Computes b ^= cb, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, the default version calls eval_bitwise_xor(b, B(a))

 

eval_bitwise_xor(b, cb, cb2)

<void>

Computes cb ^ cb2 and stores the result in b, only required when B is an integer type. When not provided, does the equivalent of b = cb; eval_bitwise_xor(b, cb2).

 

<eval_bitwise_xor(b,cb,a)>

<void>

Computes cb ^ a and stores the result in b, only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. When not provided, does the equivalent of eval_bitwise_xor(b, cb, B(a)).

 

<eval_bitwise_xor(b,a,cb)>

<void>

Вычисляет<a^ cb>и сохраняет результат в<b>, только если<B>является целым типом. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. Если же нет, то<eval_bitwise_xor(b,cb,a)>

.

 

<eval_left_shift(b,cb,ui)>

<void>

Computes cb << ui and stores the result in b, only required when B is an integer type. When not provided, does the equivalent of b = cb; eval_left_shift(b, a);.

 

eval_right_shift(b, cb, ui)

<void>

Вычисляет<cb>> ui>и сохраняет результат в<b>, только если<B>является целым типом. Если же нет, то<b =cb;eval_right_shift(b,a);>

.

 

<eval_qr(cb, cb2, b, b2)>

<void>

Sets b to the result of cb / cb2 and b2 to the result of cb % cb2. Only required when B is an integer type. The default version of this function is synthesised from other operations above.

<std::overflow_error>, если<a>имеет нулевое значение.

eval_integer_modulus(cb, ui)

unsigned

Возвращает результат<cb %ui>. Только если<B>является целочисленным типом. По умолчанию версия этой функции синтезируется из других операций выше.

<std::overflow_error>, если<a>имеет нулевое значение.

eval_lsb(cb)

unsigned

Returns the index of the least significant bit that is set. Only required when B is an integer type. The default version of this function is synthesised from other operations above.

 

eval_msb(cb)

unsigned

Возвращает индекс самого значительного бита, который установлен. Это необходимо только тогда, когда<B>является целочисленным типом. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_bit_test(cb, ui)

<bool>

Возвращается истинно, если<cb>имеет бит<ui>установлен. Это необходимо только тогда, когда<B>является целочисленным типом. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_bit_set(b, ui)>

<void>

Sets the bit at index ui in b. Only required when B is an integer type. The default version of this function is synthesised from other operations above.

 

<eval_bit_unset(b,ui)>

<void>

Отключает бит в индексе<ui>в<b>. Только если<B>является целочисленным типом. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_bit_flip(b, ui)

<void>

Flips the bit at index ui in b. Only required when B is an integer type. The default version of this function is synthesised from other operations above.

 

eval_gcd(b, cb, cb2)

<void>

Устанавливает<b>на наибольший общий делитель<cb>и<cb2>. Только если<B>является целочисленным типом. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_lcm(b, cb, cb2)>

<void>

Sets b to the least common multiple of cb and cb2. Only required when B is an integer type. The default version of this function is synthesised from other operations above.

 

<eval_gcd(b, cb, a)>

<void>

Sets b to the greatest common divisor of cb and cb2. Only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. The default version of this function calls eval_gcd(b, cb, B(a)).

 

<eval_lcm(b, cb, a)>

<void>

Sets b to the least common multiple of cb and cb2. Only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. The default version of this function calls eval_lcm(b, cb, B(a)).

 

<eval_gcd(b, a, cb)>

<void>

Устанавливает<b>на наибольший общий делитель<cb>и<a>. Только если<B>является целочисленным типом. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>или<B::float_types>. По умолчанию эта функция вызывает<eval_gcd(b,cb,a)>.

 

eval_lcm(b, a, cb)

<void>

Sets b to the least common multiple of cb and a. Only required when B is an integer type. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types or B::float_types. The default version of this function calls eval_lcm(b, cb, a).

 

eval_powm(b, cb, cb2, cb3)

<void>

Устанавливает<b>результат(cb^cb2)%cb3. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_powm(b, cb, cb2, a)

<void>

Sets b to the result of (cb^cb2)%a. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types. The default version of this function is synthesised from other operations above.

 

<eval_powm(b, cb, a, cb2)>

<void>

Устанавливает<b>результат(cb^a)%cb2. Тип<a>должен быть указан в одном из типовых перечней<B::signed_types>,<B::unsigned_types>. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_powm(b, cb, a, a2)>

<void>

Sets b to the result of (cb^a)%a2. The type of a shall be listed in one of the type lists B::signed_types, B::unsigned_types. The default version of this function is synthesised from other operations above.

 

eval_integer_sqrt(b, cb, b2)

<void>

Устанавливает<b>на наибольшее целое число, которое при квадрате меньше<cb>, также устанавливает<b2>на оставшуюся часть, то есть наcb - b2. По умолчанию версия этой функции синтезируется из других операций выше.

 

Sign manipulation:

   

<eval_abs(b, cb)>

<void>

Set b to the absolute value of cb. The default version of this functions assigns cb to b, and then calls b.negate() if eval_get_sign(cb) < 0.

 

eval_fabs(b, cb)

<void>

Set b to the absolute value of cb. The default version of this functions assigns cb to b, and then calls b.negate() if eval_get_sign(cb) < 0.

 

функции плавающей точки:

   

<eval_fpclassify(cb)>

<int>

Returns one of the same values returned by std::fpclassify. Only required when B is an floating-point type. The default version of this function will only test for zero cb.

 

eval_trunc(b, cb)

<void>

Performs the equivalent operation to std::trunc on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_round(b, cb)

<void>

Performs the equivalent operation to std::round on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

<eval_exp(b, cb)>

<void>

выполняет эквивалентную операцию<std::exp>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_log(b, cb)>

<void>

выполняет эквивалентную операцию<std::log>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей точкой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_log10(b, cb)

<void>

выполняет эквивалентную операцию<std::log10>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_sin(b, cb)>

<void>

выполняет эквивалентную операцию<std::sin>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_cos(b, cb)

<void>

выполняет эквивалентную операцию<std::cos>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_tan(b, cb)

<void>

выполняет эквивалентную операцию<std::exp>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_asin(b, cb)

<void>

выполняет эквивалентную операцию<std::asin>по аргументу<cb>и сохраняет результат<b>. Только если<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

<eval_acos(b, cb)>

<void>

Performs the equivalent operation to std::acos on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_atan(b, cb)

<void>

Performs the equivalent operation to std::atan on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_sinh(b, cb)

<void>

Performs the equivalent operation to std::sinh on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

<eval_cosh(b, cb)>

<void>

Performs the equivalent operation to std::cosh on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_tanh(b, cb)

<void>

Performs the equivalent operation to std::tanh on argument cb and stores the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_fmod(b, cb, cb2)

<void>

Performs the equivalent operation to std::fmod on arguments cb and cb2, and store the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

<eval_modf(b, cb, pb)>

<void>

Выполняет эквивалентную операцию<std::modf>по аргументу<cb>и сохраняет результат целого числа в<*pb>и дробную часть в<b>. Требуется только тогда, когда<B>является типом с плавающей точкой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_pow(b, cb, cb2)

<void>

Performs the equivalent operation to std::pow on arguments cb and cb2, and store the result in b. Only required when B is an floating-point type. The default version of this function is synthesised from other operations above.

 

eval_atan2(b, cb, cb2)

<void>

Выполняет эквивалентную операцию<std::atan>на аргументах<cb>и<cb2>и сохраняет результат в<b>. Требуется только тогда, когда<B>является типом с плавающей запятой. По умолчанию версия этой функции синтезируется из других операций выше.

 

eval_scalbn(b, cb, e)

<void>

Значение масштаба<cb>наre, гдеrявляется радиксом типа. По умолчанию версия этой функции реализована в терминах eval_ldexp, следовательно, эта функция должна быть предусмотрена для типов с радиксом, отличным от 2.

<eval_ilogb(cb)>

<B::exponent_type>

Returns the exponent e of value cb such that 1 <= cb*r-e < r, where r is the radix of type B. The default version of this function is implemented in terms of eval_frexp, consequently this function must be provided for types with a radix other than 2.

eval_logb(b, cb)

<B::exponent_type>

Sets b to the exponent e of value cb such that 1 <= cb*r-b < r, where r is the radix of type B. The default version of this function is implemented in terms of eval_ilogb.

hashing:

   

hash_value(cb)

std::size_t

Возвращает хеш-значение для аргумента, подходящего для использования с<std::hash>и т.д. Если не предусмотрено, то для типа номера не будет доступна автоматическая поддержка хеширования.


Если в приведенных выше таблицах не указаны,требования к операции, то для каждого типа, моделирующего эту концепцию, необходимо решить, когда или желательно ли бросать исключение. Однако выброшенные исключения всегда должны быть либо типом, либо наследоваться от типа<std::runtime_error>. Например, тип с плавающей запятой может выбрать бросок<std::overflow_error>всякий раз, когда результат операции будет бесконечным, и<std::underflow_error>всякий раз, когда он будет округлен до нуля.

[Note] Note

Все функции, не являющиеся членами, называются с префиксом «eval_», чтобы избежать конфликтов с одноимёнными классами шаблонов — на самом деле это соглашение об именах не должно быть необходимым, а скорее работает вокруг некоторых ошибок компилятора.


PrevUpHomeNext

Статья Backend Requirements раздела Chapter 1. Boost.Multiprecision Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 01:24:06/0.037429094314575/1