aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math
AgeCommit message (Collapse)Author
2025-10-10Coff: implement threadlocal variablesJacob Young
2025-09-18std.math.modf: disable vector test on LoongArch with LSXAlex Rønne Petersen
https://github.com/llvm/llvm-project/issues/159529
2025-09-13std.math.big.int: normalize zero result for small multiplicationsmlugg
Resolves: #25221
2025-08-30Merge pull request #25077 from ziglang/GenericReaderAndrew Kelley
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30std: skip some failing tests on hexagonAlex Rønne Petersen
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-24Update powi.zig to fix docstring formattingBecker A.
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-16re-enable std.math.modf vector tests (#24786)Rue
* re-enable std.math.modf vector tests * re-disable std.math.modf vector tests for `aarch64-macos` * re-disable for s390x architecture
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-05std: replace various mem copies with `@memmove`Andrew Kelley
2025-07-31std: stop relying on precision-losing coercionsmlugg
2025-07-22aarch64: add new from scratch self-hosted backendJacob Young
2025-07-17Make sure to test the sign of the zero resultsLewis Gaul
2025-07-17Add tests for math.expm1(), fixing bug in 32-bit functionLewis Gaul
2025-07-17Add tests for math.log1p()Lewis Gaul
2025-07-11Remove numerous things deprecated during the 0.14 release cycleLinus Groh
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-09std: replace formatInteger with formatNumberAndrew Kelley
2025-07-08std: revert big int test to master branchAndrew Kelley
oops, it depends on usize
2025-07-07std.io.Writer.printValue: rework logicAndrew Kelley
Alignment and fill options only apply to numbers. Rework the implementation to mainly branch on the format string rather than the type information. This is more straightforward to maintain and more straightforward for comptime evaluation. Enums support being printed as decimal, hexadecimal, octal, and binary. `formatInteger` is another possible format method that is unconditionally called when the value type is struct and one of the integer-printing format specifiers are used.
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-06-19x86_64: increase passing test coverage on windowsJacob Young
Now that codegen has no references to linker state this is much easier. Closes #24153
2025-06-15std: disable test on LLVM (#24191)mlugg
2025-06-15big.int: implement float conversionsJacob Young
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-05-17x86_64: rewrite scalar `<<|`Jacob Young
Closes #23035
2025-04-16improve test syntax for better stack trace in case of failuresamy007
2025-04-14std.math.big: add and update testssamy007
2025-04-14std.math.big.int: changed llshr and llshl implementationsamy007
2025-04-13std.math.big.int: remove setRuntimeSafetysamy007
2025-04-05pow: fix typo 0 instead of infhomersimpsons
2025-03-25Merge pull request #23310 from Rexicon226/fix-23309Alex Rønne Petersen
big.int: return normalized results from `{add,sub}Carry`
2025-03-24std.math: Add least common multiple (lcm)oittaa
2025-03-24big.int: return normalized results from `{add,sub}Carry`David Rubin
2025-03-21big.int: fix negative multi-limb shift right adjust crashJacob Young
2025-03-21big.int: fix yet another truncate bugJacob Young
Too many bugs have been found with `truncate` at this point, so it was rewritten from scratch. Based on the doc comment, the utility of `convertToTwosComplement` over `r.truncate(a, .unsigned, bit_count)` is unclear and it has a subtle behavior difference that is almost certainly a bug, so it was deleted.
2025-02-23std.math.big.int: Support strings up to base 36Linus Groh
Co-Authored-By: samy007 <samy2014@free.fr>
2025-02-18x86_64: rewrite scalar `@ctz`Jacob Young
2025-02-17std.Target: Remove functions that just wrap component functions.Alex Rønne Petersen
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look at multiple components of the target. But functions like isWasm(), isDarwin(), isGnu(), etc only exist to save 4-8 characters. I don't think this is a good enough reason to keep them, especially given that: * It's not immediately obvious to a reader whether target.isDarwin() means the same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar functions *do* look at multiple components. * It's not clear where we would draw the line. The logical conclusion before this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(), Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand. * It's nice to just have a single correct way of doing something.
2025-02-06x86_64: rewrite scalar `@truncate`Jacob Young
2025-02-03compiler,std: implement ZON supportMason Remaley
This commit allows using ZON (Zig Object Notation) in a few ways. * `@import` can be used to load ZON at comptime and convert it to a normal Zig value. In this case, `@import` must have a result type. * `std.zon.parse` can be used to parse ZON at runtime, akin to the parsing logic in `std.json`. * `std.zon.stringify` can be used to convert arbitrary data structures to ZON at runtime, again akin to `std.json`.
2025-01-18autodocs: reflow comment to prevent it from been put in blockquoteandrewkraevskii
2025-01-16x86_64: implement switch jump tablesJacob Young
2025-01-16x86_64: implement clz and notJacob Young
2025-01-09Sema: rewrite semantic analysis of function callsmlugg
This rewrite improves some error messages, hugely simplifies the logic, and fixes several bugs. One of these bugs is technically a new rule which Andrew and I agreed on: if a parameter has a comptime-only type but is not declared `comptime`, then the corresponding call argument should not be *evaluated* at comptime; only resolved. Implementing this required changing how function types work a little, which in turn required allowing a new kind of function coercion for some generic use cases: function coercions are now allowed to implicitly *remove* `comptime` annotations from parameters with comptime-only types. This is okay because removing the annotation affects only the call site. Resolves: #22262
2024-12-27std.math.tanh: fix special cases commentsaccharin
2024-12-18Add branchHint to `std.math.pow`Liam Swayne
NaN is an unlikely case, and a branchHint `.unlikely` could be appropriate.
2024-11-26std.math: Disable isSignalNan test on mips32.Alex Rønne Petersen
https://github.com/ziglang/zig/issues/14366
2024-11-26std.math.complex: Add squared magnitude function (#21998)Chris Boesch
2024-11-03std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm().Alex Rønne Petersen
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-10-12Remove packed_int_array usage from WasmPageAllocator and BigIntKrzysztof Wolicki