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 › zon › parse › Parser › parseFloat Private Function parseFloat Doc Source Private Function std.zon.parse.Parser.parseFloat
fn parseFloat (self : @This (), T : type , node : Zoir .Node .Index ) !T Params self : @This () T : type node : Zoir .Node .Index File zon/parse.zig: 652
652
653
654
655
656
657
658
659
660
661
662
663
664
665 fn parseFloat (self : @This (), T : type , node : Zoir .Node .Index ) !T {
switch (node .get (self .zoir )) {
.int_literal => |int | switch (int ) {
.small => |val | return @floatFromInt (val ),
.big => |val | return val .toFloat (T , .nearest_even )[0 ],
},
.float_literal => |val | return @floatCast (val ),
.pos_inf => return std .math .inf (T ),
.neg_inf => return -std .math .inf (T ),
.nan => return std .math .nan (T ),
.char_literal => |val | return @floatFromInt (val ),
else => return error .WrongType ,
}
}