Qore Programming Language Reference Manual  0.8.13.2
Pseudo_QC_Number.dox.h
1 namespace Qore {
4 /***/
5 class <number> : public <value> {
6 
7 public:
9 
23 number abs();
24 
25 public:
27 
53 string format(string fmt);
54 
55 public:
57 
81 string format(int prec = 2, string decimal_sep = ".", string thousands_sep = "");
82 
83 public:
85 
98 bool infp();
99 
100 public:
102 
115 bool intp();
116 
117 public:
119 
132 bool nanp();
133 
134 public:
136 
148 int prec();
149 
150 public:
152 
164 int sign();
165 
166 public:
168 
181 bool strp();
182 
183 public:
185 
208 string toBase(int base = 10);
209 
210 public:
212 
221 string toString(int fmt);
222 
223 public:
225 
241 int typeCode();
242 
243 public:
245 
261 bool val();
262 };
266 
268  const NF_Default = QORE_NF_DEFAULT;
270 
276  const NF_Raw = QORE_NF_RAW;
278  const NF_Scientific = QORE_NF_SCIENTIFIC;
280 
283 
285 
290  const SNF_AllDigits = QORE_NUM_ALL_DIGITS;
292 };
bool nanp()
Returns True if the number is NaN (not a number)
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:268
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:5
int prec()
Returns the precision of the current number.
number number(softnumber n)
Converts the argument to a number value.
bool strp()
Returns True because number values can be converted to strings.
int typeCode()
Returns Qore::NT_NUMBER.
string toBase(int base=10)
Converts the number to a different base (and returns it as a string).
bool infp()
Returns True if the number is infinity (+ or -)
bool intp()
Returns True because number values can be converted to integers.
const NF_Raw
for the raw format without the noise reduction heuristic in the NF_Default format ...
Definition: Pseudo_QC_Number.dox.h:276
number abs()
Returns the absolute value of the number.
int sign()
Returns -1 if the number is negative, 0 if it is zero, or 1 if it is positive.
const NF_Scientific
for the scientific format (exponential notation)
Definition: Pseudo_QC_Number.dox.h:278
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:2
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:290
Methods in this pseudo-class can be executed on arbitrary precision number values.
Definition: Pseudo_QC_Number.dox.h:5
string format(string fmt)
Returns a formatted string of the number according to the format argument.
string toString()
Returns the string representation of the value; the default is an empty string.
bool val()
Returns True if the number is non-zero, False if zero.