23 #ifndef PLLL_INCLUDE_GUARD__NINT_WRAPPER_CONV
24 #define PLLL_INCLUDE_GUARD__NINT_WRAPPER_CONV
40 namespace implementation
50 typedef void RetVal_Frac;
51 typedef void RetVal_Floor;
52 typedef void RetVal_Ceil;
53 typedef void RetVal_Round;
54 typedef void RetVal_Round2;
58 d.d_value = v.d_value;
71 typedef void RetVal_Frac;
72 typedef void RetVal_Floor;
73 typedef void RetVal_Ceil;
74 typedef void RetVal_Round;
75 typedef void RetVal_Round2;
79 d.d_value = v.d_value;
92 typedef void RetVal_Frac;
93 typedef void RetVal_Floor;
94 typedef void RetVal_Ceil;
95 typedef void RetVal_Round;
96 typedef void RetVal_Round2;
100 d.d_value = v.d_value;
113 typedef void RetVal_Frac;
114 typedef void RetVal_Floor;
115 typedef void RetVal_Ceil;
116 typedef void RetVal_Round;
117 typedef void RetVal_Round2;
121 d.d_value = v.d_value;
134 typedef void RetVal_Frac;
135 typedef void RetVal_Floor;
136 typedef void RetVal_Ceil;
137 typedef void RetVal_Round;
138 typedef void RetVal_Round2;
142 d.d_value = v.d_value;
155 typedef void RetVal_Frac;
156 typedef void RetVal_Floor;
157 typedef void RetVal_Ceil;
158 typedef void RetVal_Round;
159 typedef void RetVal_Round2;
163 d.d_value = v.d_value;
176 typedef void RetVal_Frac;
177 typedef void RetVal_Floor;
178 typedef void RetVal_Ceil;
179 typedef void RetVal_Round;
180 typedef void RetVal_Round2;
197 typedef void RetVal_Frac;
198 typedef void RetVal_Floor;
199 typedef void RetVal_Ceil;
200 typedef void RetVal_Round;
201 typedef void RetVal_Round2;
218 typedef void RetVal_Frac;
219 typedef void RetVal_Floor;
220 typedef void RetVal_Ceil;
221 typedef void RetVal_Round;
222 typedef void RetVal_Round2;
239 typedef void RetVal_Frac;
240 typedef void RetVal_Floor;
241 typedef void RetVal_Ceil;
242 typedef void RetVal_Round;
243 typedef void RetVal_Round2;
260 typedef void RetVal_Frac;
261 typedef void RetVal_Floor;
262 typedef void RetVal_Ceil;
263 typedef void RetVal_Round;
264 typedef void RetVal_Round2;
277 template<
typename Type>
284 static float round(
float f) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
289 static float round(
float f,
bool & up) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
301 static double round(
double d) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
306 static double round(
double d,
bool & up) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
308 double v = ::round(d);
318 static long double round(
long double ld) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
323 static long double round(
long double ld,
bool & up) PLLL_INTERNAL_NOTHROW_POSTFIX_INLINE
325 long double v = roundl(ld);
335 typedef void RetVal_Frac;
353 d.d_value = std::floor(v);
383 d.d_value = std::ceil(v);
396 typedef void RetVal_Frac;
414 d.d_value = std::floor(v);
444 d.d_value = std::ceil(v);
457 typedef void RetVal_Frac;
475 d.d_value = std::floor(v);
505 d.d_value = std::ceil(v);
518 typedef void RetVal_Frac;
519 typedef void RetVal_Floor;
520 typedef void RetVal_Ceil;
521 typedef void RetVal_Round;
522 typedef void RetVal_Round2;
526 d.d_value = arithmetic::convert<Type>(v);
531 return NInt<Type>(
false, arithmetic::convert<Type>(v));
539 typedef void RetVal_Frac;
540 typedef void RetVal_Floor;
541 typedef void RetVal_Ceil;
542 typedef void RetVal_Round;
543 typedef void RetVal_Round2;
560 typedef void RetVal_Frac;
568 d.d_value = arithmetic::convert<Type>(v);
573 return NInt<Type>(
false, arithmetic::convert<Type>(v));
578 d.d_value = convert_floor<Type>(v);
583 return NInt<Type>(
false, convert_floor<Type>(v));
588 d.d_value = convert_round<Type>(v);
593 return NInt<Type>(
false, convert_round<Type>(v));
598 d.d_value = convert_round<Type>(v, up);
603 return NInt<Type>(
false, convert_round<Type>(v, up));
608 d.d_value = convert_ceil<Type>(v);
613 return NInt<Type>(
false, convert_ceil<Type>(v));
622 typedef void RetVal_Floor;
623 typedef void RetVal_Ceil;
624 typedef void RetVal_Round;
625 typedef void RetVal_Round2;
652 typedef void RetVal_Frac;
660 d.d_value = arithmetic::convert<Type>(v);
665 return NInt<Type>(
false, arithmetic::convert<Type>(v));
670 d.d_value = convert_floor<Type>(v);
675 return NInt<Type>(
false, convert_floor<Type>(v));
680 d.d_value = convert_round<Type>(v);
685 return NInt<Type>(
false, convert_round<Type>(v));
690 d.d_value = convert_round<Type>(v, up);
695 return NInt<Type>(
false, convert_round<Type>(v, up));
700 d.d_value = convert_ceil<Type>(v);
705 return NInt<Type>(
false, convert_ceil<Type>(v));
714 typedef void RetVal_Floor;
715 typedef void RetVal_Ceil;
716 typedef void RetVal_Round;
717 typedef void RetVal_Round2;
748 static unsigned int toUInt(
const NInt<Type> & v)
758 static unsigned long toULong(
const NInt<Type> & v)
763 static long long toLongLong(
const NInt<Type> & v)
778 static long double toLongDouble(
const NInt<Type> & v)
784 template<
typename Type,
typename Op>
787 enum { supported =
true, intermediate_expression =
false };
792 template<
typename Type>
795 enum { supported =
true, intermediate_expression =
false };
Provides information on the result of an unary arithmetic operation.
Header for rational number arithmetic.
Provides conversion implementation from type SourceType to DestContext::Type.
Provides information on the result of a binary arithmetic operation.
void convert(typename DestContext::Type &dst, const SourceType &src, const DestContext &context)
Converts the value in src to the type described by context and stores the result in dst...
Implementation backend for conversions from context types to native types.
Represents a rational number as a quotient of two arbitrary precision integers.
Represents a native integer.
Represents an arbitrary precision floating point value.
Represents an arithmetic context for arbitrary precision floating point values.
Represents an arbitrary precision integer.
Represents an arithmetic context for native integers.
Represents an arithmetic context for rational numbers.
Represents an arithmetic context for arbitrary precision integer.