412 Commits

Author SHA1 Message Date
mihael 764760df62 libzigc/math: Implement rintl, lrintl (#31791)
It's a fairly straightforward port of `musl`'s `rintl`, like `rint` and `rintf` were. `libc-test` tests for `rintl` are uncommented since they're now passing.

I've also covered special cases for `rint` with tests, and broke down the current `rint` and `modf` test declarations into multiple -- so each libc function get its own test declaration at the very least.

Contributes to #30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31791
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-27 16:48:55 +02:00
Alex Rønne Petersen fc56124fac std: re-enable some tests on s390x
closes https://github.com/ziglang/zig/issues/25957
2026-04-26 21:22:31 +02:00
Alex Rønne Petersen bd12a5a6e1 std: re-enable a bunch of tests that now pass
closes https://github.com/ziglang/zig/issues/21893
closes https://github.com/ziglang/zig/issues/23806
closes https://github.com/ziglang/zig/issues/23807
closes https://github.com/ziglang/zig/issues/24191
closes https://codeberg.org/ziglang/zig/issues/30220
2026-04-25 21:54:48 +02:00
Alex Rønne Petersen 51a6a5a2a6 Revert "std.math.modf: disable vector test on LoongArch with LSX"
This reverts commit 35d2b1e99a.

The bug was fixed in LLVM 22.
2026-04-25 21:54:48 +02:00
Jacob Young 1552bc7ad0 x86_64: fix mir rmi signedness 2026-04-10 23:23:33 +02:00
TemariVirus e498550952 std.math.pow: organise and add special case tests
Added tests for special cases which were previously untested.
Updated comments to use the same language as IEEE 754-2008.
2026-03-16 15:42:35 +08:00
TemariVirus 06d9ab7121 std.math.pow: fix wrong answer for large even exponents 2026-03-16 15:32:09 +08:00
Matthew Lugg 510ea6f61f type resolution progress 2026-03-10 10:26:07 +00:00
hemisputnik 74f361a5ce std.math.big.int: address log2/log10 reviews
There were good reviews made after #31365 was merged, so this commit
addresses them separately.

1. Assert that the number is greater than zero
2. Use `constants` instead of calculating constants manually
3. Use `Const.bitCountAbs` for log2
2026-03-01 20:34:17 +01:00
hemisputnik bd6f512f0c std.math.big.int: add log10 2026-02-28 20:16:32 +02:00
hemisputnik 925f82da09 std.math.big.int: add log2 2026-02-28 04:15:19 +02:00
hemisputnik 2f8e660805 std.math.log10: handle comptime_int inputs correctly
also add a few tests for comptime types

fixes #31333
2026-02-25 18:57:58 +01:00
lzm-build 51509fe63b std.math.acos/asin: Add @Vector(?,f32) and @Vector(?,f64) support 2026-02-14 16:57:05 +08:00
lzm-build ef13a373bc fix assertion argument order in acos/asin/atan 2026-02-14 13:33:55 +08:00
Andrew Kelley 12e6ac2e8f std.math.atan: simplify type logic 2026-02-13 12:25:53 -08:00
lzm-build 8901d38b7d std.math.atan: Add @Vector(?,f32) and @Vector(?,f64) support 2026-02-13 12:20:53 -08:00
kj4tmp@gmail.com 004872baec zig libc: acosf: fix fp exceptions
some fp exceptions are prohibited by zig test-libc (libc-test).
Promoting to f64 prevents vectorization of some floating point
divisions. The vectorization has unused lanes which contain zero. On
division the lanes containing zero are divided and trigger the INVALID
fp flags.
2026-02-13 11:30:19 -08:00
Pivok d0b39c7f2b libzigc: hypot (#31104)
First time contribution.

Implements hypot for libzigc #30978.

Commands i run:
```
$ stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=../../libc-test -Dtest-filter=hypot --summary line -fqemu -fwasmtime
Build Summary: 725/737 steps succeeded (12 skipped)
```

I also changed std.math.hypot becuase some libc-tests raised fp exceptions. Example:
```
../../libc-test/src/math/special/hypot.h:8: bad fp exception: RN hypot(0x1p-1074,0x0p+0)=0x1p-1074, want 0 got INEXACT|UNDERFLOW
../../libc-test/src/math/special/hypot.h:9: bad fp exception: RN hypot(0x1p-1074,-0x0p+0)=0x1p-1074, want 0 got INEXACT|UNDERFLOW
```

I also run this command as a quick sanity check:
```
$ stage4/bin/zig build test-std -Dtest-filter=hypot -Dtest-target-filter=x86_64-linux-musl --summary line
Build Summary: 5/5 steps succeeded; 136/136 tests passed
```

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31104
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Pivok <pivoc@protonmail.com>
Co-committed-by: Pivok <pivoc@protonmail.com>
2026-02-05 21:57:32 +01:00
lzm-build ccd82ae7cc Add f16, f80 and f128 support for atan 2026-01-30 06:20:14 +01:00
lzm-build 757ec185f0 Add f16, f80 and f128 support for acos and asin (#30997)
The software impl of `acos` and `asin` depends on the `sqrt` op. Since support for `sqrt` in `f16`, `f80`, and `f128` has been added, the impl of `acos` and `asin` for `f16`, `f80`, and `f128` is now being supplemented.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30997
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: lzm-build <3575188313@qq.com>
Co-committed-by: lzm-build <3575188313@qq.com>
2026-01-28 23:33:35 +01:00
rpkak e6ac1b77f0 libzigc: test and fix acos 2026-01-20 18:02:15 +01:00
Aaron Ang 9db3e23e80 std.math.big: require sufficient capacity for aliased params 2025-12-27 20:38:33 +01:00
Alex Rønne Petersen aa0249d74e Merge pull request 'std.ascii: rename indexOf functions to find' (#30101) from adria/zig:indexof-find into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30101
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
2025-12-22 12:50:46 +01:00
Alex Rønne Petersen 647866dd63 std.math: disable hypot tests on non-Debug powerpc64
https://github.com/llvm/llvm-project/issues/171869
2025-12-16 06:23:11 +01:00
Adrià Arrufat 02c5f05e2f std: replace usages of std.mem.indexOf with std.mem.find 2025-12-05 14:31:27 +01:00
unplanned 688af04725 math.big: stronger asserts to reduce risks of aliasing 2025-12-04 10:28:42 +01:00
unplanned 73e82332d0 big.Mutable.setString optimization and simplification 2025-12-04 10:28:31 +01:00
unplanned c6a1444864 std.math.big.int.int_test: replace mem.eql by expectEqualSlices 2025-12-04 01:12:50 +01:00
unplanned ded4e12559 big.Const.dump: fixed error 2025-12-04 01:12:34 +01:00
Justus Klausecker e5c2df9f17 std.math.big.int: fix format functions 2025-11-23 09:52:43 -08:00
Ali Cheraghi dec1163fbb all: replace all @Type usages
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-11-22 22:42:38 +00:00
Alex Rønne Petersen 9ab7eec23e represent Mac Catalyst as aarch64-maccatalyst-none rather than aarch64-ios-macabi
Apple's own headers and tbd files prefer to think of Mac Catalyst as a distinct
OS target. Earlier, when DriverKit support was added to LLVM, it was represented
a distinct OS. So why Apple decided to only represent Mac Catalyst as an ABI in
the target triple is beyond me. But this isn't the first time they've ignored
established target triple norms (see: armv7k and aarch64_32) and it probably
won't be the last.

While doing this, I also audited all Darwin OS prongs throughout the codebase
and made sure they cover all the tags.
2025-11-14 11:33:35 +01:00
Jacob Young 2e31077fe0 Coff: implement threadlocal variables 2025-10-10 22:47:47 -07:00
Alex Rønne Petersen 35d2b1e99a std.math.modf: disable vector test on LoongArch with LSX
https://github.com/llvm/llvm-project/issues/159529
2025-09-18 12:42:24 +02:00
mlugg 32a1aabff7 std.math.big.int: normalize zero result for small multiplications
Resolves: #25221
2025-09-13 17:13:27 +01:00
Andrew Kelley b7104231af Merge pull request #25077 from ziglang/GenericReader
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30 12:43:52 -07:00
Alex Rønne Petersen af78c55676 std: skip some failing tests on hexagon 2025-08-30 06:36:41 +02:00
Andrew Kelley 79f267f6b9 std.Io: delete GenericReader
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Becker A. 718ee31e21 Update powi.zig to fix docstring formatting
Without this change, the docs are formatted s.t. the text "Edge case rules ordered by precedence:" is appended onto the prior line of text "Underflow: Absolute value of result smaller than 1", instead of getting its own line.
2025-08-24 22:59:08 +02:00
Rue ee85c8b6d0 re-enable std.math.modf vector tests (#24786)
* re-enable std.math.modf vector tests
* re-disable std.math.modf vector tests for `aarch64-macos`
* re-disable for s390x architecture
2025-08-16 02:36:09 +00:00
Andrew Kelley 749f10af49 std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
Andrew Kelley 6f545683f3 std: replace various mem copies with @memmove 2025-08-05 09:56:02 -07:00
mlugg 64bf8bb146 std: stop relying on precision-losing coercions 2025-07-31 10:57:04 +01:00
Jacob Young 5060ab99c9 aarch64: add new from scratch self-hosted backend 2025-07-22 19:43:47 -07:00
Lewis Gaul 03dfd2ecc3 Make sure to test the sign of the zero results 2025-07-17 05:04:59 +02:00
Lewis Gaul 7abb170f59 Add tests for math.expm1(), fixing bug in 32-bit function 2025-07-17 05:04:59 +02:00
Lewis Gaul f34b26231e Add tests for math.log1p() 2025-07-17 05:04:59 +02:00
Linus Groh eb37552536 Remove numerous things deprecated during the 0.14 release cycle
Basically everything that has a direct replacement or no uses left.

Notable omissions:

- std.ArrayHashMap: Too much fallout, needs a separate cleanup.
- std.debug.runtime_safety: Too much fallout.
- std.heap.GeneralPurposeAllocator: Lots of references to it remain, not
  a simple find and replace as "debug allocator" is not equivalent to
  "general purpose allocator".
- std.io.Reader: Is being reworked at the moment.
- std.unicode.utf8Decode(): No replacement, needs a new API first.
- Manifest backwards compat options: Removal would break test data used
  by TestFetchBuilder.
- panic handler needs to be a namespace: Many tests still rely on it
  being a function, needs a separate cleanup.
2025-07-11 08:17:43 +02:00
Andrew Kelley 51a9a6aab6 std: replace formatInteger with formatNumber 2025-07-09 14:54:54 -07:00
Andrew Kelley 83c4000319 std: revert big int test to master branch
oops, it depends on usize
2025-07-08 08:36:04 -07:00