| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* make more standard libraries work with `nimPreviewSlimSystem`
* typo
* part two
* Delete specutils.nim
* fixes more tests
* more fixes
* fixes tests
* fixes three more tests
* add formatfloat import
* fix
* last
|
|
|
|
|
|
|
| |
* Remove Deprecated math proc
* Remove Deprecated math proc
* Remove Deprecated math proc
|
|
|
|
|
|
| |
* Use assert in runnableExamples and improve boundary check
* Add more tests for ceilDiv
* Fix comment in ceilDiv
* Calling ceilDiv with int type T such like sizeof(T) > 8 is error
|
|
|
|
|
|
|
| |
* Fix #17017
Add more test cases
* USe signbit in example
|
|
|
|
|
|
|
| |
* Added math.clamp for slice clamping
* Added inline to math.clamp
* Cleaned up math.clamp + test
|
|
|
|
|
| |
* fix js unsigned integer
* Use `std` prefix for standard library modules
* fix #17118
|
|
|
|
|
|
| |
* make copySign work more robustly in js
* improve tests
* improve tests/vm/tcastint.nim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Improve documentation for math
Support empty input for cumsummed
Use runnableExamples
Move some examples to tests
Add more tests
* Update tests/stdlib/tmath.nim
Move some tests to trandom.nim
Move tests into main template where possible
Add test for #17017
* Add more tests for gamma & lgamma
Remove gamma(-1.0) example
Small fixes/changes
* Move more tests into template main()
* Fix typos
* Add edge case examples for copySign
|
|
|
|
|
|
|
| |
* fix #16815 round+places works again in vm
* improve tests; fix for linux 32bit
* fix test for windows
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix #9125
* Update tests/stdlib/tmath.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* back
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
|
|
|
|
| |
Don't use approximate equality when comparing
numbers that are representable with perfect precision.
|
| |
|
|
|
|
|
|
|
| |
* refs #16576: honor matrix in testament by making such tests non joinable
* add tests + misc fixes
* fix test for i386 with -d:danger
|
| |
|
|
|
|
|
| |
* add math.copySign
* fix + tests
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* add `euclDiv` and `euclMod` to `math`
* use abs
* Update lib/pure/math.nim
Co-authored-by: Clyybber <darkmine956@gmail.com>
|
|
|
|
|
|
|
| |
* add math.isNaN
* isNaN now works with --passc:-ffast-math; tests
* Update lib/pure/math.nim
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
| |
output spec (#16151)
* fix megatest newlines
* still allow missing trailing newline for now but in a more strict way than before
|
|
|
|
|
|
|
|
|
| |
* move tests to testament
* minor
* fix random
* disable test random
|
| |
|
| |
|
|
|
|
| |
in tests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ?
CDF is a standard ident in all things related to random numbers/sampling,
and full words "cumulativeDistributionFunction" would be silly long, in
this case, IMO. We use lowercase `cdf` to make it not look like a type,
remove all looping from `sample` letting callers do it. Besides just
side-stepping any `sampleSize` name choice, callers may want to filter
out samples anyway which this makes slightly simpler.
Also add two variants of `cumsum`, value return and in-place update
distinguished by the var-ness of the first argument. Add tests for
`int` and `float` for both `cumsum` and the new `sample`. (The sample
tests exercise the value return mode of `cumsum`.)
Functionality pre-this-PR `sample(a, w)` is now the almost as simple
`for i in 0..<n: sample(a, w.cumsum)`, but this new code factoring is
almost surely better. The statistical tests pass, as before.
* Address Araq comment in https://github.com/nim-lang/Nim/pull/10084
We can always add in some `var` version later if desired to save
memory, but this change now at least firms up the `sample` interface.
* Rename `cumsum` -> `cumsummed` to honor NEP1 style. Re-instate `cumsum` as
the in-place transformation. Test both in `tests/stdlib/tmath.nim` and use
`cumsummed` in the example code for sample since that's a simpler example.
* Fix requests from https://github.com/nim-lang/Nim/pull/10084 :
example in lib/pure/math.nim and comment whitespace in lib/pure/random.nim
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#10072)
* Add the ability to sample elements from an openArray according to a parallel
array of weights/unnormalized probabilities (any sort of histogram, basically).
Also add a non-thread safe version for convenience.
* Address Araq comments on https://github.com/nim-lang/Nim/pull/10072
* import at top of file and space after '#'.
* Put in a check for non-zero total weight.
* Clarify constraint on `w`.
* Rename `rand(openArray[T])` to `sample(openArray[T])` to `sample`, deprecating
old name and name new (openArray[T], openArray[U]) variants `sample`.
* Rename caller-provided state version of rand(openArray[T]) and also clean
up doc comments.
* Add test for new non-uniform array sampler. 3 sd bound makes it 99% likely
that it will still pass in the future if the random number generator changes.
We cannot both have a tight bound to check distribution *and* loose check to
ensure resilience to RNG changes. (We cannot *guarantee* resilience, anyway.
There's always a small chance any test hits a legitimate random fluctuation.)
|
| |
|
| |
|
|
|
|
| |
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
|
| |
|
|
|