nextAfter
Returns the next representable value after x in the direction of y.
Special cases:
- If
x == y,yis returned. - For floats, if either
xoryis a NaN, a NaN is returned. - For floats, if
x == 0.0and@abs(y) > 0.0, the smallest subnormal number with the sign ofyis returned.
Function parameters
Parameters
- T:type
- x:T
- y:T
Returns the next representable value after `x` in the direction of `y`.
Functions
- nextAfter
- Returns the next representable value after `x` in the direction of `y`.
Source
Implementation
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) ++ "'"),
};
}