Commit graph

18 commits

Author SHA1 Message Date
Jacob Young
5060ab99c9 aarch64: add new from scratch self-hosted backend 2025-07-22 19:43:47 -07:00
Jacob Young
1f98c98fff x86_64: increase passing test coverage on windows
Now that codegen has no references to linker state this is much easier.

Closes #24153
2025-06-19 18:41:12 -04:00
Jacob Young
6b41beb370 big.int: implement float conversions
These conversion routines accept a `round` argument to control how the
result is rounded and return whether the result is exact. Most callers
wanted this functionality and had hacks around it being missing.

Also delete `std.math.big.rational` because it was only being used for
float conversion, and using rationals for that is a lot more complex
than necessary. It also required an allocator, whereas the new integer
routines only need to be passed enough memory to store the result.
2025-06-15 14:15:18 -04:00
Alex Rønne Petersen
c13713dd02
std.math: Re-enable snan() test.
This now passes on all targets that we test in CI.

See: https://github.com/ziglang/zig/issues/14366
2024-10-02 04:08:24 +02:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
expikr
103b885fc6
math.hypot: fix incorrect over/underflow behavior (#19472) 2024-05-30 09:58:05 +00:00
Ryan Liptak
726a1149e0 Change many test blocks to doctests/decltests 2024-02-26 15:18:31 -08:00
Ryan Liptak
16b3d1004e Remove redundant test name prefixes now that test names are fully qualified
Follow up to #19079, which made test names fully qualified.

This fixes tests that now-redundant information in their test names. For example here's a fully qualified test name before the changes in this commit:

"priority_queue.test.std.PriorityQueue: shrinkAndFree"

and the same test's name after the changes in this commit:

"priority_queue.test.shrinkAndFree"
2024-02-26 15:18:31 -08:00
Carl Åstholm
4c1da0912a Fix compile errors from the expectEqual change 2024-01-03 21:20:48 +01:00
Lewis Gaul
387b0ac4f1
Make NaNs quiet by default and other NaN tidy-up (#16826)
* Generalise NaN handling and make std.math.nan() give quiet NaNs

* Address uses of std.math.qnan_* and std.math.nan_* consts

* Comment out failing test due to issues with signalling NaN

* Fix issue in c_builtins.zig where we need qnan_u32
2023-08-18 02:07:49 -04:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
Veikka Tuominen
b55a5007fa Sema: fix parameter of type 'T' must be comptime error
Closes #12519
Closes #12505
2022-08-22 11:16:36 +03:00
Andrew Kelley
92bc3cbe27 stage2: fix comptime bitcast involving f80
* Sema: implement comptime bitcast of f80 with integer-like types
  bitwise rather than taking a round trip through memory layout.
* Type: introduce `isAbiInt`.
* Value: comptime memory write of f80 writes 0 bytes for padding
  instead of leaving the memory uninitialized.
* Value: floatReadFromMemory has a more general implementation, checking
  the endianness rather than checking for specific architectures.

This fixes behavior test failures occurring on MIPS.
2022-07-13 13:14:37 -07:00
Andrew Kelley
efe34243c6 std.math: add inline to some functions
These functions semantically benefit from being inline; it makes sense
that `isInf(x)` where `x` is comptime-known should have a
comptime-known result.
2022-07-13 11:14:46 -07:00
vi
6ad9ac59e7 std.math.float: fix f80-backed c_longdouble consts 2022-04-14 02:55:46 -04:00
Cody Tapscott
319555a669 Add floatFractionalBits to replace floatMantissaDigits 2022-04-12 12:33:16 -07:00
viri
c5c6260534
std.math: generalise inf, even simpler isFinite 2022-04-07 02:38:31 -06:00
viri
5b8ac9821d derive float constants in a generic way (#10133) 2022-04-06 15:50:36 +02:00