| Qore Programming Language Reference Manual 2.2.0

Loading...
Searching...
No Matches
Pseudo_QC_Number.dox.h
1
3 namespace Qore {
5/***/
6 class <number> : public <value> {
7
8 public:
10
24 number abs();
25
26 public:
28
61 string format(string fmt);
62
63 public:
65
89 string format(int prec = 2, string decimal_sep = ".", string thousands_sep = "");
90
91 public:
93
106 bool infp();
107
108 public:
110
123 bool intp();
124
125 public:
127
140 bool nanp();
141
142 public:
144
156 int prec();
157
158 public:
160
172 int sign();
173
174 public:
176
189 bool strp();
190
191 public:
193
217 string toBase(int base = 10);
218
219 public:
221
230 string toString(int fmt);
231
232 public:
234
250 int typeCode();
251
252 public:
254
270 bool val();
271};
272
275
277 const NF_Default = QORE_NF_DEFAULT;
279
285 const NF_Raw = QORE_NF_RAW;
287 const NF_Scientific = QORE_NF_SCIENTIFIC;
289
292
294
299 const SNF_AllDigits = QORE_NUM_ALL_DIGITS;
301}
<number>
Methods in this pseudo-class can be executed on arbitrary precision number values.
Definition Pseudo_QC_Number.dox.h:6
<number>::prec
int prec()
Returns the precision of the current number.
<number>::format
string format(int prec=2, string decimal_sep=".", string thousands_sep="")
Returns a formatted string of the number according to format arguments.
<number>::sign
int sign()
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive.
<number>::val
bool val()
Returns True if the number is non-zero, False if zero.
<number>::abs
number abs()
Returns the absolute value of the number.
<number>::strp
bool strp()
Returns True because number values can be converted to strings.
<number>::nanp
bool nanp()
Returns True if the number is NaN (not a number)
<number>::infp
bool infp()
Returns True if the number is infinity (+ or -)
<number>::format
string format(string fmt)
Returns a formatted string of the number according to the format argument.
<number>::intp
bool intp()
Returns True because number values can be converted to integers.
<number>::typeCode
int typeCode()
Returns Qore::NT_NUMBER.
<number>::toBase
string toBase(int base=10)
Converts the number to a different base (and returns it as a string).
<number>::toString
string toString(int fmt)
Returns the string representation of the number according to the format argument.
<value>
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
Qore::NF_Raw
const NF_Raw
for the raw format without the noise reduction heuristic in the NF_Default format
Definition Pseudo_QC_Number.dox.h:285
Qore::NF_Default
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
Qore::NF_Scientific
const NF_Scientific
for the scientific format (exponential notation)
Definition Pseudo_QC_Number.dox.h:287
Qore::SNF_AllDigits
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
Qore::number
number number(softnumber n)
Converts the argument to a number value.
Qore
main Qore-language namespace
Definition Pseudo_QC_All.dox.h:3