Floating-Point Types
A floating-point type is one of: f16, f32, or f64.
The type f16 is an IEEE 754 binary16 half-precision floating-point type occupying 2 bytes with 2-byte alignment.
The type f32 is an IEEE 754 binary32 single-precision floating-point type occupying 4 bytes with 4-byte alignment.
The type f64 is an IEEE 754 binary64 double-precision floating-point type occupying 8 bytes with 8-byte alignment.
Floating-point types are copy types.
A floating-point literal is a sequence of digits containing a decimal point or an exponent. The literal 42.0 is a floating-point literal; 42 without a decimal point is an integer literal.
An unqualified floating-point literal (one without an explicit type annotation) has type f64 by default.
A floating-point literal can be assigned to any floating-point type variable via type inference. The literal value is narrowed to the target type's precision during code generation.
The arithmetic operators +, -, *, /, and % are defined for floating-point types. Both operands must have the same floating-point type, and the result has that type.
The comparison operators ==, !=, <, >, <=, and >= are defined for floating-point types. Both operands must have the same floating-point type, and the result has type bool. Comparisons use ordered semantics: if either operand is NaN, the result is false for all operators except !=, which returns true.
The unary negation operator - is defined for floating-point types. The operand and result have the same floating-point type.
Bitwise operators (&, |, ^, <<, >>, ~) are not defined for floating-point types. Using a bitwise operator on a floating-point operand is a compile-time error.