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 library itself.
///! The quoted behavior definitions are from///! https://gcc.gnu.org/onlinedocs/gcc-12.1.0/gccint/Soft-float-library-routines.html#Soft-float-library-routinesconstcompiler_rt = @import("../compiler_rt.zig");
constsymbol = compiler_rt.symbol;
constcomparef = @import("./comparef.zig");
comptime {
symbol(&__eqxf2, "__eqxf2");
symbol(&__nexf2, "__nexf2");
symbol(&__lexf2, "__lexf2");
symbol(&__cmpxf2, "__cmpxf2");
symbol(&__ltxf2, "__ltxf2");
}
/// "These functions calculate a <=> b. That is, if a is less than b, they return -1;/// if a is greater than b, they return 1; and if a and b are equal they return 0./// If either argument is NaN they return 1..."////// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`,/// and `__ltxf2`.fn__cmpxf2(a: f80, b: f80) callconv(.c) i32 {
return@backingInt(comparef.cmp_f80(comparef.LE, a, b));
}
/// "These functions return a value less than or equal to zero if neither argument is NaN,/// and a is less than or equal to b."fn__lexf2(a: f80, b: f80) callconv(.c) i32 {
return__cmpxf2(a, b);
}
/// "These functions return zero if neither argument is NaN, and a and b are equal."/// Note that due to some kind of historical accident, __eqxf2 and __nexf2 are defined/// to have the same return value.fn__eqxf2(a: f80, b: f80) callconv(.c) i32 {
return__cmpxf2(a, b);
}
/// "These functions return a nonzero value if either argument is NaN, or if a and b are unequal."/// Note that due to some kind of historical accident, __eqxf2 and __nexf2 are defined/// to have the same return value.fn__nexf2(a: f80, b: f80) callconv(.c) i32 {
return__cmpxf2(a, b);
}
/// "These functions return a value less than zero if neither argument is NaN, and a/// is strictly less than b."fn__ltxf2(a: f80, b: f80) callconv(.c) i32 {
return__cmpxf2(a, b);
}