Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Public Function

nextAfter

Public Function
std.math.nextafter.nextAfter
pub fn nextAfter(comptime T: type, x: T, y: T) T

Returns the next representable value after x in the direction of y.

Special cases:

  • If x == y, y is returned.
  • For floats, if either x or y is a NaN, a NaN is returned.
  • For floats, if x == 0.0 and @abs(y) > 0.0, the smallest subnormal number with the sign of y is returned.

Params

  • T: type
  • x: T
  • y: T

File

math/nextafter.zig:15
15
16
17
18
19
20
21
pub fn nextAfter(comptime T: type, x: T, y: T) T {
    return switch (@typeInfo(T)) {
        .int, .comptime_int => nextAfterInt(T, x, y),
        .float => nextAfterFloat(T, x, y),
        else => @compileError("expected int or non-comptime float, found '" ++ @typeName(T) ++ "'"),
    };
}