aboutsummaryrefslogtreecommitdiff
path: root/lib/std/math.zig
AgeCommit message (Collapse)Author
2021-01-10zig fmtAndrew Kelley
2021-01-10impl lossyCast #5080Adam Goertz
2020-12-31Year++Frank Denis
2020-12-16Fix typo in math.orderdata-man
2020-11-19Add builtin.Signedness, use it instead of is_signedTadeo Kondrak
2020-11-06Merge pull request #6941 from LemonBoy/floateqapproxAndrew Kelley
std: Implement more useful approxEq semantics
2020-11-05math.shl/math.shr: add support for vectorsFrank Denis
2020-11-05std: Implement more useful approxEq semanticsLemonBoy
Comparisons with absolute epsilons are usually useful when comparing numbers to zero, for non-zero numbers it's advised to switch to relative epsilons instead to obtain meaningful results (check [1] for more details). The new API introduces approxEqAbs and approxEqRel, where the former aliases and deprecated the old `approxEq`, allowing the user to pick the right tool for the job. The documentation is meant to guide the user in the choice of the correct alternative. [1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-10-29std/math: add support for vectors to rotl()/rotr()Frank Denis
2020-10-17Make std.meta.Int accept a signedness parameterJan Prudil
2020-10-15std: move std.meta.refAllDecls to std.testingTadeo Kondrak
2020-10-07restore ability to do comptime mathxavier
until https://github.com/ziglang/zig/issues/6168 is implemented, partially revert 0bd53dd2033c60d3446abfb83209237c6eb6c9e2 in order to restore the ability to use std.math in comptime functions.
2020-09-03update uses of deprecated type field accessVexu
2020-08-30Merge pull request #6189 from katesuyu/div-ceilAndrew Kelley
std: Add std.math.divCeil
2020-08-29std.math.divCeil: fix expectEqual argument orderKate Tsuyu
2020-08-29std.math.divCeil: use expectEqual for testsKate Tsuyu
2020-08-29std.math.divCeil: move compile error back downKate Tsuyu
2020-08-29std.math.divCeil: move compile error to topKate Tsuyu
2020-08-29std.math.divCeil: support comptime_int/floatKate Tsuyu
2020-08-28std.math.divCeil: conform to more test casesKate Tsuyu
2020-08-28std.math.divCeil: handle floats correctlierKate Tsuyu
2020-08-28std.math.divCeil: handle floats correctlyKate Tsuyu
2020-08-28std: Add std.math.divCeilKate Tsuyu
2020-08-26forceEval() -> doNotOptimizeAway()Frank Denis
2020-08-26Rename blackBox, move it to std.mem.forceEval()Frank Denis
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-13stage2: implement while loops (bool condition)Andrew Kelley
* introduce a dump() function on Module.Fn which helpfully prints to stderr the ZIR representation of a function (can be called before attempting to codegen it). This is a debugging tool. * implement x86 codegen for loops * liveness: fix analysis of conditional branches. The logic was buggy in a couple ways: - it never actually saved the results into the IR instruction (fixed now) - it incorrectly labeled operands as dying when their true death was after the conditional branch ended (fixed now) * zir rendering is enhanced to show liveness analysis results. this helps when debugging liveness analysis. * fix bug in zir rendering not numbering instructions correctly closes #6021
2020-08-08utilize math.ceilPowerOfTwoAndrew Kelley
2020-07-11run zig fmt on std lib and self hostedVexu
2020-07-08stage2: machine code for condbr jumpsAndrew Kelley
2020-06-17Improve f128 standard library supportantlilja
* Add functions: floor128, ceil128, trunc128 and round128 * Add corresponding tests
2020-05-01ZIR: add cmp and condbr instructionsAndrew Kelley
2020-04-28std.meta.IntType -> std.meta.IntTadeo Kondrak
2020-04-16std: make math.clamp work for common uses, remove automatic bounds swappingAndrius Mitkus
2020-03-24std: Add qNaN constantsLemonBoy
2020-03-05std: use testing.expectEqual in math.absCast testsdaurnimator
2020-03-05std: fix math.absCast on i1daurnimator
2020-03-04std: Use @TypeOf(x,y) as return value for maxLemonBoy
2020-02-24remove uses of `@ArgType` and `@IntType`Vexu
2020-02-24remove usages of `@typeId`, `@memberCount`, `@memberName` and `@memberType`Vexu
2020-01-14Add clamp function to math moduleHersh Krishna
2020-01-01std.mem.compare: breaking API changesAndrew Kelley
* `std.mem.Compare` is now `std.math.Order` and the enum tags renamed to follow new style convention. * `std.mem.compare` is renamed to `std.mem.order`. * new function `std.math.order`
2019-12-16allow comparison of any numeric typesAndrew Kelley
2019-12-16std: lessThan and greaterThan between signed and unsignedShawn Landden
It is a deviation from C, but I think we should consider making this the behavior of the operators. See #2133
2019-12-10Replace @typeOf with @TypeOf in all zig sourceRobin Voetter
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-11-29std.math: remove constants that should be expressionsAndrew Kelley
All four of these can be represented in fewer characters with expressions, which will be guaranteed to happen at compile-time, and have the same or better precision. The other math constants here which depend on function calls could be similarly removed if and when #425 is solved. However I left them for now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-19add `std.math.tau` constant (equivalent to 2 * pi)dbandstra
2019-11-08update more of the std lib to use `@as`Andrew Kelley
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-10-24refAllDecls in a test block to limit when it gets runAndrew Kelley