The scientific notation of reals is awkward, given the presence of e both for the exponent and the type indicator. The real type is basically useless in finance since it does not provide enough precision for quantities expressed in currencies such as Yen. A real can hold at least 6 decimal digits of precision. Be mindful that this type is called 'float' in some languages. The real type represents a single-precision, four-byte floating-point number and is denoted by numeric digits containing a decimal point and a trailing type indicator e. The + and leading 0 for a positive exponent are optional. To the right of the e is a two digit signed exponent. Here the e standards for "exponent" – i.e., a power of 10 – and should not be confused with a type indicator. q)3.14159265Ī float can also be specified in scientific notation. Observe that the console shortens the display of floats with no significant digits to the right of the decimal. It is denoted by optionally signed numeric digits with either a decimal point or an optional trailing type indicator f. A float can hold (at least) 15 decimal digits of precision. The float type represents an IEEE standard eight-byte floating-point number, often called "double" in traditional languages. Single- and double-precision floating-point data types are supported. This may be unintuitive in the context of other type promotion, but it will make sense for table columns. However, for a homogenous list of atoms of "wide" type, should a narrower type be presented for update or append in place, the narrow type will not be automatically promoted and an error will result. Type promotion is performed automatically in arithmetic operations. Observe that the type indicator j is accepted but redundant. It may also have an optional trailing type indicator j indicating it is a long and not another integer type. A literal is identified as a long by the fact that it contains only numeric digits, with an optional leading minus sign, and no decimal point. In q versions 3.0 and later, the basic integer type is a signed eight-byte integer, called long. Integer data types are ubiquitous in programming. We shall refer to this in subsequent sections. The next table collects the important information about q data types. They do have special meaning when used as name arguments in some operators, so do not use them as names. – are not reserved in q, so they are not displayed in a special font in this text. The words under the q heading – boolean, short, int, etc.
0 Comments
Leave a Reply. |