Numeric Constants
Syntax
digits
| digits.[digits][e[+-]digits]
| [digits].digits[e[+-]digits]
| digitse[+-]digits
| NaN
Semantics
digits represents one or more numeric characters (0 through 9).
Nan
means "not a number" and can be used in expressions.
Notes
- At least one digit must be before or after the decimal point, if one is used.
- At least one digit must follow the exponent marker (e), if one is present.
- There cannot be any spaces or other characters embedded in the constant.
- Leading plus or minus signs are not actually considered part of the constant; they are unary operators applied to the constant.
- A numeric constant that contains neither a decimal point nor an exponent is initially presumed to be type INTEGER if its value fits; otherwise it is presumed to be DOUBLE PRECISION.
- In most cases a numeric constant is automatically coerced to the most appropriate type depending on context. When necessary, you can force a numeric value to be interpreted as a specific data type by casting it as described in Data Type Coercion Operators (CAST).
- Vertica follows the IEEE specification for floating point, including Nan.
- A NaN is not greater than and at the same time not less than anything, even itself. In other words, comparisons always return false whenever a NaN is involved. See Numeric Expressions for examples.
Examples
42
3.5
4.
.001
5e2
1.925e-3