pub enum FloatConstantType {
Float,
Double,
LongDouble,
Float16,
Float32,
Float64,
Float128,
Float32x,
Float64x,
Float80,
}Expand description
The type of a floating constant.
This is not rucc_types::FloatKind, which has the three types C has. The suffixes reach
further than that, and a constant knows exactly which type it was written as long before
anything has to decide what that type is on this target.
Variants§
Float
f or F.
Double
No suffix, or the d and D that GCC also accepts for it.
LongDouble
l or L.
Float16
f16 or F16, which is _Float16.
Float32
f32 or F32, which is _Float32 and is the same format as float.
Float64
f64 or F64, which is _Float64 and is the same format as double.
Float128
f128 or F128, and q or Q, which is _Float128 and __float128. GCC keeps the
two spellings as distinct types and they are the same format, which is all this says.
Float32x
f32x or F32x, which is _Float32x. The name suggests something wider than
_Float32 and on every target here it is exactly double.
Float64x
f64x or F64x, which is _Float64x: the widest format the target has beyond
_Float64, so the x87 one on x86 and quad precision elsewhere.
Float80
w or W, which is GCC’s __float80. It is the x87 format whatever long double is,
which is the reason it is not the same thing as FloatConstantType::LongDouble, and
GCC has it on x86 only.
Implementations§
Source§impl FloatConstantType
impl FloatConstantType
Sourcepub fn format(self, target: &TargetInfo) -> Format
pub fn format(self, target: &TargetInfo) -> Format
The format a constant of this type is converted in.
The two that depend on the target are the two that have to: long double is the x87
format on x86-64 Linux and quad precision on AArch64 Linux, and _Float64x is whatever
the target has above _Float64, which is the same split.
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
The C spelling of the type, which a diagnostic naming it has to print.
GCC says “floating constant exceeds range of ‘double’” and puts the type in the message, so the type has to be able to say what it is called.
Sourcepub const fn suffix(self) -> &'static str
pub const fn suffix(self) -> &'static str
The suffix that names this type, for a printer putting the constant back.
One spelling per type rather than the one that was written, so 0.1q and 0.1f128 both
come back as f128. They are the same type, and the printer’s job is to mean the same
thing rather than to look the same.
Trait Implementations§
Source§impl Clone for FloatConstantType
impl Clone for FloatConstantType
Source§fn clone(&self) -> FloatConstantType
fn clone(&self) -> FloatConstantType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more