Qore Programming Language Reference Manual  1.2.0
Pseudo_QC_Number.dox.h
1 
3 namespace Qore {
5 /***/
6 class <number> : public <value> {
7 
8 public:
10 
25 
26 public:
28 
54 string format(string fmt);
55 
56 public:
58 
82 string format(int prec = 2, string decimal_sep = ".", string thousands_sep = "");
83 
84 public:
86 
99 bool infp();
100 
101 public:
103 
116 bool intp();
117 
118 public:
120 
133 bool nanp();
134 
135 public:
137 
149 int prec();
150 
151 public:
153 
165 int sign();
166 
167 public:
169 
182 bool strp();
183 
184 public:
186 
209 string toBase(int base = 10);
210 
211 public:
213 
222 string toString(int fmt);
223 
224 public:
226 
242 int typeCode();
243 
244 public:
246 
262 bool val();
263 };
266 
269  const NF_Default = QORE_NF_DEFAULT;
271 
277  const NF_Raw = QORE_NF_RAW;
279  const NF_Scientific = QORE_NF_SCIENTIFIC;
283 
286 
291  const SNF_AllDigits = QORE_NUM_ALL_DIGITS;
293 }
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:277
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:269
const NF_Scientific
for the scientific format (exponential notation)
Definition: Pseudo_QC_Number.dox.h:279
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:291
number number(softnumber n)
Converts the argument to a number value.
main Qore-language namespace
Definition: Pseudo_QC_All.dox.h:3