mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Add machine-dependent 'float' type.
This commit is contained in:
parent
afc0dc8bfc
commit
cb04275afa
@ -647,9 +647,10 @@ The keywords are:
|
|||||||
@tab @code{type}
|
@tab @code{type}
|
||||||
@tab @code{true}
|
@tab @code{true}
|
||||||
@tab @code{false}
|
@tab @code{false}
|
||||||
@item @code{any}
|
@tab @code{any}
|
||||||
@tab @code{int}
|
@item @code{int}
|
||||||
@tab @code{uint}
|
@tab @code{uint}
|
||||||
|
@tab @code{float}
|
||||||
@tab @code{char}
|
@tab @code{char}
|
||||||
@tab @code{bool}
|
@tab @code{bool}
|
||||||
@item @code{u8}
|
@item @code{u8}
|
||||||
@ -1750,6 +1751,7 @@ Rust; they cannot be used as user-defined identifiers in any context.
|
|||||||
* Ref.Type.Any:: An open sum of every possible type.
|
* Ref.Type.Any:: An open sum of every possible type.
|
||||||
* Ref.Type.Mach:: Machine-level types.
|
* Ref.Type.Mach:: Machine-level types.
|
||||||
* Ref.Type.Int:: The machine-dependent integer types.
|
* Ref.Type.Int:: The machine-dependent integer types.
|
||||||
|
* Ref.Type.Float:: The machine-dependent floating-point types.
|
||||||
* Ref.Type.Prim:: Primitive types.
|
* Ref.Type.Prim:: Primitive types.
|
||||||
* Ref.Type.Big:: The arbitrary-precision integer type.
|
* Ref.Type.Big:: The arbitrary-precision integer type.
|
||||||
* Ref.Type.Text:: Strings and characters.
|
* Ref.Type.Text:: Strings and characters.
|
||||||
@ -1842,9 +1844,21 @@ The Rust type @code{int}@footnote{A Rust @code{int} is analogous to a C99
|
|||||||
target-machine-dependent size. Its size, in bits, is equal to the size of the
|
target-machine-dependent size. Its size, in bits, is equal to the size of the
|
||||||
rust type @code{uint} on the same target machine.
|
rust type @code{uint} on the same target machine.
|
||||||
|
|
||||||
|
@node Ref.Type.Float
|
||||||
|
@subsection Ref.Type.Float
|
||||||
|
|
||||||
|
The Rust type @code{float} is a machine-specific type equal to one of the
|
||||||
|
supported Rust floating-point machine types (@code{f32} or @code{f64}). It is
|
||||||
|
the largest floating-point type that is directly supported by hardware on the
|
||||||
|
target machine, or if the target machine has no floating-point hardware
|
||||||
|
support, the largest floating-point type supported by the software
|
||||||
|
floating-point library used to support the other floating-point machine types.
|
||||||
|
|
||||||
|
Note that due to the preference for hardware-supported floating point, the
|
||||||
|
type @code{float} may not be equal to the largest @emph{supported}
|
||||||
|
floating-point type.
|
||||||
|
|
||||||
|
|
||||||
@page
|
|
||||||
@node Ref.Type.Prim
|
@node Ref.Type.Prim
|
||||||
@subsection Ref.Type.Prim
|
@subsection Ref.Type.Prim
|
||||||
|
|
||||||
@ -1863,7 +1877,7 @@ The boolean type @code{bool} with values @code{true} and @code{false}.
|
|||||||
@item
|
@item
|
||||||
The machine types.
|
The machine types.
|
||||||
@item
|
@item
|
||||||
The machine-dependent integer types.
|
The machine-dependent integer and floating-point types.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
|
|
||||||
("int", INT);
|
("int", INT);
|
||||||
("uint", UINT);
|
("uint", UINT);
|
||||||
|
("float", FLOAT);
|
||||||
|
|
||||||
("char", CHAR);
|
("char", CHAR);
|
||||||
("str", STR);
|
("str", STR);
|
||||||
|
@ -118,6 +118,7 @@ type token =
|
|||||||
| BOOL
|
| BOOL
|
||||||
| INT
|
| INT
|
||||||
| UINT
|
| UINT
|
||||||
|
| FLOAT
|
||||||
| CHAR
|
| CHAR
|
||||||
| STR
|
| STR
|
||||||
| MACH of Common.ty_mach
|
| MACH of Common.ty_mach
|
||||||
@ -267,6 +268,7 @@ let rec string_of_tok t =
|
|||||||
| BOOL -> "bool"
|
| BOOL -> "bool"
|
||||||
| INT -> "int"
|
| INT -> "int"
|
||||||
| UINT -> "uint"
|
| UINT -> "uint"
|
||||||
|
| FLOAT -> "float"
|
||||||
| CHAR -> "char"
|
| CHAR -> "char"
|
||||||
| STR -> "str"
|
| STR -> "str"
|
||||||
| MACH m -> Common.string_of_ty_mach m
|
| MACH m -> Common.string_of_ty_mach m
|
||||||
|
Loading…
Reference in New Issue
Block a user