22 #include <tdelibs_export.h> 24 #include "knumber_priv.h" 70 static KNumber const NotDefined;
86 enum NumType {SpecialType, IntegerType, FractionType, FloatType};
105 enum ErrorType {UndefinedNumber, Infinity, MinusInfinity};
110 KNumber(
unsigned long int num);
111 KNumber(
unsigned long long int num);
141 static void setDefaultFloatOutput(
bool flag);
150 static void setDefaultFractionalInput(
bool flag);
157 static void setDefaultFloatPrecision(
unsigned int prec);
167 static void setSplitoffIntegerForFractionOutput(
bool flag);
181 TQString
const toTQString(
int width = -1,
int prec = -1)
const;
203 KNumber const sqrt(
void)
const;
218 KNumber const cbrt(
void)
const;
227 KNumber const integerPart(
void)
const;
232 KNumber const operator -(
void)
const;
243 operator bool(
void)
const;
244 operator signed long int(
void)
const;
245 operator unsigned long int(
void)
const;
246 operator unsigned long long int(
void)
const;
247 operator double(
void)
const;
249 bool const operator==(
KNumber const & arg2)
const 250 {
return (compare(arg2) == 0); }
252 bool const operator!=(
KNumber const & arg2)
const 253 {
return (compare(arg2) != 0); }
255 bool const operator>(
KNumber const & arg2)
const 256 {
return (compare(arg2) > 0); }
258 bool const operator<(
KNumber const & arg2)
const 259 {
return (compare(arg2) < 0); }
261 bool const operator>=(
KNumber const & arg2)
const 262 {
return (compare(arg2) >= 0); }
264 bool const operator<=(
KNumber const & arg2)
const 265 {
return (compare(arg2) <= 0); }
277 void simplifyRational(
void);
278 int const compare(
KNumber const & arg2)
const;
281 static bool _float_output;
282 static bool _fraction_input;
283 static bool _splitoffinteger_output;
Class that provides arbitrary precision numbers.
ErrorType
A KNumber that represents an error, i.e.
NumType
KNumber tries to provide transparent access to the following type of numbers: