Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › math › float › FloatRepr › BiasedExponent Public Enum BiasedExponent Doc Source Public Enum std.math.float.FloatRepr.BiasedExponent
pub const BiasedExponent = enum (@Int (.unsigned , exponent_bits )) Values Functions File math/float.zig: 82
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 pub const BiasedExponent = enum (@Int (.unsigned , exponent_bits )) {
denormal = 0 ,
min_normal = 1 ,
zero = (1 << (exponent_bits - 1 )) - 1 ,
max_normal = (1 << exponent_bits ) - 2 ,
infinite = (1 << exponent_bits ) - 1 ,
_ ,
pub const Int = @typeInfo (BiasedExponent ).@"enum" .tag_type ;
pub fn unbias (biased : BiasedExponent ) Exponent {
switch (biased ) {
.denormal => unreachable ,
else => return @bitCast (@backingInt (biased ) -% @backingInt (BiasedExponent .zero )),
.infinite => unreachable ,
}
}
pub fn bias (unbiased : Exponent ) BiasedExponent {
return @fromBackingInt (@intCast (@backingInt (BiasedExponent .zero ) +% @as (Int , @bitCast (unbiased ))));
}
}