Numeric Literals and Suffixes Summary Creates a numeric value. Syntax number[suffix] Parameters number A number. This can be a whole number, decimal number, hexadecimal literal, or octal literal. suffix An optional suffix for whole numbers and decimal numbers. Possible values: f, F, d, D, L, UL Description Numeric literals create a numeric value. Integrals without a suffix are interpreted in this order: int, unsigned int, long, unsigned long, byte, signed byte, short, unsigned short, and char. If the integral value does not "fit" within any specified types, such as possible function overloads or a specified variable type, an error will be raised at compile time. Decimal numbers without a suffix are interpreted as double. Suffixes Numeric suffixes allow "overriding" the default type for a number. For example, 1.1 is interpreted as a double by default. However, by adding an f or F suffix, it can be treated as a float: 121.1; // 'double'1.1f; // 'float' The following is a list of available suffixes: Suffix Type L long UL unsigned long f float F float d double D double Lowercase l and ul are not supported for long and unsigned long, respectively. This was a design decision to avoid confusion between lowercase l and the numeric value 1 (one) in some fonts. Scientific Notation JS++ supports scientific notation using the e or E syntax: 123410e1; // 10010e2; // 10001.5e2; // 1501.5e-2; // 0.015 This syntax is a short-hand for the following mathematical formula: m × 10n Hexadecimal Literals JS++ supports hexadecimal literals: 12340xF; // 150xFF; // 2550X9; // 90X4; // 4 Hexadecimal literals support scientific notation, but they do not support decimals or numeric suffixes. Octal Literals Octal literals are used for representing numbers in base 8 form: 1010; // 8 See Also Primitive Types Share HTML | BBCode | Direct Link