Liam Swayne
f857bf72e2
Add branchHint to std.math.pow
...
NaN is an unlikely case, and a branchHint `.unlikely` could be appropriate.
2024-12-18 05:30:08 -05:00
Alex Rønne Petersen
047311a76a
std.math: Disable isSignalNan test on mips32.
...
https://github.com/ziglang/zig/issues/14366
2024-11-26 18:29:13 +01:00
Chris Boesch
87863a834b
std.math.complex: Add squared magnitude function ( #21998 )
2024-11-26 13:03:48 +00:00
Alex Rønne Petersen
c9e67e71c1
std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().
...
The old isARM() function was a portability trap. With the name it had, it seemed
like the obviously correct function to use, but it didn't include Thumb. In the
vast majority of cases where someone wants to ask "is the target Arm?", Thumb
*should* be included.
There are exactly 3 cases in the codebase where we do actually need to exclude
Thumb, although one of those is in Aro and mirrors a check in Clang that is
itself likely a bug. These rare cases can just add an extra isThumb() check.
2024-11-03 09:29:30 +01:00
Krzysztof Wolicki
b1eaed6c8d
Remove packed_int_array usage from WasmPageAllocator and BigInt
2024-10-12 12:55:35 +02:00
Alex Rønne Petersen
1e838eba75
std.math: Re-enable isSignalNan test on most targets.
...
This remains disabled on arm, aarch64, and powerpc, as well as for the C
backend, as it still fails for these targets.
See: https://github.com/ziglang/zig/issues/14366
2024-10-03 04:38:53 +02: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
Fri3dNstuff
b2c53eb0d7
std.math: change gcd's implementation to use Stein's algorithm instead of Euclid's ( #21077 )
2024-09-23 17:15:57 -07:00
Alex Rønne Petersen
26119bd98d
test: Skip some floating point tests that fail on arm-linux-(gnu,musl)eabi.
...
https://github.com/ziglang/zig/issues/21234
2024-09-10 08:53:30 +02:00
Ian Johnson
3543f28320
std.math.big.int: fix shiftRight sign handling
...
Closes #21311
The sign of the result `r` needs to be initialized before the correction
`r.addScalar(r.toConst(), -1)`, or the intended end result could be off
by 2 (depending on the original sign of `r`).
2024-09-06 10:36:12 -07:00
Jeremy Hertel
227fb4875f
std.math: rename make_f80 to F80.toFloat and break_f80 to F80.fromFloat
2024-09-02 00:10:22 +03: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
mlugg
018262d537
std: update eval branch quotas after bdbc485
...
Also, update `std.math.Log2Int[Ceil]` to more efficient implementations
that don't use up so much damn quota!
2024-08-21 01:30:46 +01:00
Jacob Young
ef11bc9899
Dwarf: rework self-hosted debug info from scratch
...
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
2024-08-16 15:22:55 -04:00
Marc Tiehuis
843885512d
std.math.complex: fix cosh/tanh
2024-07-30 20:31:22 +12:00
Marc Tiehuis
0fda2f31aa
std.math.complex: tighten existing test bounds
2024-07-30 16:30:20 +12:00
Marc Tiehuis
2bd7af63d7
std.math.complex: fix acosh/atan/cosh/sqrt
...
Some of these are upstream changes since the original port, others are
translation errors.
2024-07-30 15:38:00 +12:00
Andrew Kelley
33c7984183
add std.testing.random_seed
...
closes #17609
2024-07-23 11:43:12 -07:00
Tau
2b99b04285
Fix right shift on negative BigInts
...
Closes #17662 .
2024-07-12 00:46:03 -07:00
expikr
103b885fc6
math.hypot: fix incorrect over/underflow behavior ( #19472 )
2024-05-30 09:58:05 +00:00
poypoyan
aa07366513
std.math.big.int.Managed: adjust size of arg for limbs_buffer in format()
2024-05-21 13:28:05 +00:00
Andrew Kelley
e89d6fc503
fix wrong int alignment for i65..i127 on x86 arch
2024-05-08 19:37:30 -07:00
Andrew Kelley
126c9a34af
restructure unit test to be easier to debug
2024-05-08 19:37:29 -07:00
Андрей Краевский
7cc0e6d4cd
std: fix big int llshr to respect aliasing ( #19612 )
2024-04-13 03:06:23 -07:00
Carl Åstholm
9181ecd951
Sema: fix runtime call of inline fn with comptime-known comptime-only ret type
2024-04-07 15:07:55 +02:00
Sean
a2df84d0ff
std.math: rework modf
...
- Changed `modf_result` to `Modf` to better fit naming conventions
- Reworked `modf` to be far simpler and support all floating point types (as well as vectors) (I have done benchmarks and can confirm that the performance is roughly equivalent to the old implementation)
- Added more descriptive tests for modf
- Deprecated `modf32_result` and `modf64_result` in favor of `Modf(f32)` and `Modf(f64)` respectively
2024-03-29 09:33:57 +00:00
Sean
f32723a237
Update frexp.zig ( #19370 )
...
1. Entirely rewrote frexp with generics, reducing the implementation to a single function and enabling parameters of types f80 and f16
2. Expanded upon the tests, making them more descriptive and comprehensive, and automatically generating the test bodies for each floating point type
3. Added a doctest for frexp
2024-03-21 18:08:52 -04:00
tinusgraglin
26e895e3dc
math.big.int: fix incorrect bitAnd behavior
2024-03-11 16:52:03 -07: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
Jacob Young
e27db373ec
x86_64: implement @clz and @ctz of big integers
2024-02-12 05:25:07 +01:00
Jacob Young
bcbd49b2a6
x86_64: implement shifts of big integers
2024-02-12 05:25:07 +01:00
Jacob Young
9023ff04d0
x86_64: fix register clobber
2024-02-12 05:25:07 +01:00
e4m2
8d56e472c9
Replace std.rand references with std.Random
2024-02-08 15:21:35 +01:00
expikr
b729a3f008
std.math: make hypot infer type from argument ( #17910 )
...
using peer type resolution
2024-01-20 01:32:07 -05:00
hdert
314533c28b
std/math/pow: Fix #18553 , isOddInteger: Return false if float value is greater than 1 << 53 (see comment), add test cases
2024-01-19 22:00:04 -08:00
Andrew Kelley
195eeed2d8
std: remove deprecated API
2024-01-16 04:20:05 -08:00
expikr
ff23efe9fa
Update pow.zig
2024-01-14 18:09:26 -08:00
expikr
0c70d9c714
use Peer Type Resolution for standalone complex fn
...
use peer type resolution
Update complex.zig
Revert "use peer type resolution"
This reverts commit 1bc681ca5b36d2b55b5efab5a5dbec7e8a17332e.
Revert "Update pow.zig"
This reverts commit 5487e8d3159f832b5a0bf29a06bd12575182464f.
Update pow.zig
Revert "Update pow.zig"
This reverts commit 521153d1ef004d627c785f2d3fe5e6497dc15073.
Update pow.zig
2024-01-14 18:09:17 -08:00
expikr
f9d8176e94
Update atan2.zig ( #17840 )
...
Co-authored-by: castholm <carl@astholm.se>
2024-01-14 21:04:30 -05:00
Guillaume Wenzek
c5d359e4cd
fix #17142 , wrong comptime log_int computation
2024-01-13 18:46:16 -08:00
PauloCampana
fcc0c5ddc7
Add std.math.gamma and lgamma ( #18449 )
...
See #7212
2024-01-09 14:53:47 -08:00
Carl Åstholm
4c1da0912a
Fix compile errors from the expectEqual change
2024-01-03 21:20:48 +01:00
John Benediktsson
54f4abae2f
Deprecate math.doNotOptimizeAway, use mem.doNotOptimizeAway ( #18011 )
2023-11-23 15:06:32 -05:00
mlugg
51595d6b75
lib: correct unnecessary uses of 'var'
2023-11-19 09:55:07 +00:00
Jacob Young
0c6cb8d8c8
x86_64: actually track state during @divFloor of i128
...
Closes #17998
2023-11-14 22:50:05 -05:00
Jakub Konka
ea3f1d27e0
std: disable failing test
2023-11-14 16:51:38 +01:00
Linus Groh
e72049bc61
std.math: Add isPositiveZero() and isNegativeZero()
2023-11-09 00:55:43 -07:00
tison
ee47643b6e
std.math.big: fix sqrt with bits > limb_bits
...
Signed-off-by: tison <wander4096@gmail.com>
2023-11-08 08:39:08 +02:00
David Rubin
03abac3824
fix sqrt(0)
2023-11-07 14:37:43 +02:00