zig/std/math
Andrew Kelley 9c13e9b7ed
breaking changes to std.mem.Allocator interface API
Before, allocator implementations had to provide `allocFn`,
`reallocFn`, and `freeFn`.

Now, they must provide only `reallocFn` and `shrinkFn`.
Reallocating from a zero length slice is allocation, and
shrinking to a zero length slice is freeing.

When the new memory size is less than or equal to the
previous allocation size, `reallocFn` now has the option
to return `error.OutOfMemory` to indicate that the allocator
would not be able to take advantage of the new size.

For more details see #1306. This commit closes #1306.

This commit paves the way to solving #2009.

This commit also introduces a memory leak to all coroutines.
There is an issue where a coroutine calls the function and it
frees its own stack frame, but then the return value of `shrinkFn`
is a slice, which is implemented as an sret struct. Writing to
the return pointer causes invalid memory write. We could work
around it by having a global helper function which has a void
return type and calling that instead. But instead this hack will
suffice until I rework coroutines to be non-allocating. Basically
coroutines are not supported right now until they are reworked as
in #1194.
2019-03-15 17:57:21 -04:00
..
big breaking changes to std.mem.Allocator interface API 2019-03-15 17:57:21 -04:00
complex rename std lib files to new convention 2019-03-02 16:46:04 -05:00
acos.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
acosh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
asin.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
asinh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
atan.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
atan2.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
atanh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
big.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
cbrt.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
ceil.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
complex.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
copysign.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
cos.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
cosh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
exp.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
exp2.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
expm1.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
expo2.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
fabs.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
floor.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
fma.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
frexp.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
hypot.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
ilogb.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
inf.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
isfinite.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
isinf.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
isnan.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
isnormal.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
ln.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
log.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
log1p.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
log2.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
log10.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
modf.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
nan.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
pow.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
powi.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
round.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
scalbn.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
signbit.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
sin.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
sinh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
sqrt.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
tan.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
tanh.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00
trunc.zig rename std lib files to new convention 2019-03-02 16:46:04 -05:00