zig/lib/std/math
castholm ad6f8e3a59
std.math: add nextAfter (#16894)
`nextAfter()` returns the next representable value after `x` in the direction of `y` and is a standard math library function ([C++](https://en.cppreference.com/w/cpp/numeric/math/nextafter), [Java](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#nextAfter-double-double-)). It is primarily useful for bitwise incrementing/decrementing floats.

This implementation supports runtime integers, runtime floats and `comptime_int`. `comptime_float` is not supported because NaNs/infinities are intentionally difficult to obtain and because I'm not sure if the fact that it's backed by `f128` is supposed to be an implementation detail. Either way, the user could just call the function with the floating-point type whose behavior they want at comptime and then cast the result to `comptime_float`.

The float implementation was ported from mingw-w64 with some slight changes made possible because the Zig standard library doesn't care about raising FP exceptions.

The number of test cases may seem excessive but they should cover every normal and edge case for every float type and are especially important for verifying that `f80` works.
2023-10-06 14:44:47 -04:00
..
big std.math.big.int.Const.order 0 == -0 (#17299) 2023-09-29 18:09:47 +13:00
complex Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
acos.zig Make NaNs quiet by default and other NaN tidy-up (#16826) 2023-08-18 02:07:49 -04:00
acosh.zig Make NaNs quiet by default and other NaN tidy-up (#16826) 2023-08-18 02:07:49 -04:00
asin.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
asinh.zig std.math.asinh: changed unsigned int to hexadecimal 2023-09-12 22:22:07 +12:00
atan.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
atan2.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
atanh.zig Make NaNs quiet by default and other NaN tidy-up (#16826) 2023-08-18 02:07:49 -04:00
big.zig remove stage1 workaround for big int set 2023-02-04 00:29:04 -05:00
cbrt.zig std.math.cbrt: fixed -0.0 evaluating to 0.0 2023-09-12 18:39:34 +00:00
complex.zig std: remove names from incorrectly named tests 2023-04-21 23:08:48 -04:00
copysign.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
cosh.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
expm1.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
expo2.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
float.zig Make NaNs quiet by default and other NaN tidy-up (#16826) 2023-08-18 02:07:49 -04:00
frexp.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
gcd.zig std.math: add "Greatest common divisor" (gcd) 2022-09-29 21:42:56 +03:00
hypot.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
ilogb.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
isfinite.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
isinf.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
isnan.zig Make NaNs quiet by default and other NaN tidy-up (#16826) 2023-08-18 02:07:49 -04:00
isnormal.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
ldexp.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
log.zig std.math.log_int: implement integer logarithm without using float math 2023-09-14 19:33:56 +00:00
log1p.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
log2.zig libstd: skip problematic tests on aarch64-windows 2022-11-30 00:26:40 +01:00
log10.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
log_int.zig std.math.log_int: implement integer logarithm without using float math 2023-09-14 19:33:56 +00:00
modf.zig Use builtin inference over @as where possible 2023-07-24 10:23:51 -07:00
nextafter.zig std.math: add nextAfter (#16894) 2023-10-06 14:44:47 -04:00
pow.zig Remove @fabs, fabs and absCast/Int from std lib 2023-09-27 11:24:28 -07:00
powi.zig update uses of overflow arithmetic builtins 2022-12-27 15:13:14 +02:00
scalbn.zig Use the word 'base' consistently instead of 'radix' 2023-06-01 00:02:16 +03:00
signbit.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
sinh.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
sqrt.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
tanh.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00