Qore Programming Language Reference Manual 2.1.1
Loading...
Searching...
No Matches
Pseudo_QC_Number.dox.h
1
3namespace Qore {
5/***/
6class <number> : public <value> {
7
8public:
10
25
26public:
28
61string format(string fmt);
62
63public:
65
89string format(int prec = 2, string decimal_sep = ".", string thousands_sep = "");
90
91public:
93
106bool infp();
107
108public:
110
123bool intp();
124
125public:
127
140bool nanp();
141
142public:
144
156int prec();
157
158public:
160
172int sign();
173
174public:
176
189bool strp();
190
191public:
193
217string toBase(int base = 10);
218
219public:
221
230string toString(int fmt);
231
232public:
234
251
252public:
254
270bool val();
271};
275
279
289
292
294
301}
Methods in this pseudo-class can be executed on arbitrary precision number values.
Definition Pseudo_QC_Number.dox.h:6
int prec()
Returns the precision of the current number.
string format(int prec=2, string decimal_sep=".", string thousands_sep="")
Returns a formatted string of the number according to format arguments.
int sign()
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive.
bool val()
Returns True if the number is non-zero, False if zero.
number abs()
Returns the absolute value of the number.
bool strp()
Returns True because number values can be converted to strings.
bool nanp()
Returns True if the number is NaN (not a number)
bool infp()
Returns True if the number is infinity (+ or -)
string format(string fmt)
Returns a formatted string of the number according to the format argument.
bool intp()
Returns True because number values can be converted to integers.
int typeCode()
Returns Qore::NT_NUMBER.
string toBase(int base=10)
Converts the number to a different base (and returns it as a string).
string toString(int fmt)
Returns the string representation of the number according to the format argument.
Methods in this pseudo-class are available to be executed on any value type (even NOTHING); this is t...
Definition Pseudo_QC_All.dox.h:6
const NF_Raw
for the raw format without the noise reduction heuristic in the NF_Default format
Definition Pseudo_QC_Number.dox.h:285
const NF_Default
for the default format with a rounding heuristic to try to remove noise in insignificant digits from ...
Definition Pseudo_QC_Number.dox.h:277
const NF_Scientific
for the scientific format (exponential notation)
Definition Pseudo_QC_Number.dox.h:287
const SNF_AllDigits
This is a special constant to be used with string number formatting pseudo-methods that take an integ...
Definition Pseudo_QC_Number.dox.h:299
number number()
Always returns 0.0.
list< auto > list(...)
Returns a list of the arguments passed at the top level.
Qore namespace.
Definition QC_AbstractSmartLock.dox.h:2