summary refs log tree commit diff stats
path: root/lib/pure/math.nim
Commit message (Collapse)AuthorAgeFilesLines
* Fixes classify function to detect subnormal floating points (#12836)KeepCoolWithCoolidge2019-12-081-16/+20
| | | | | | | | * Fix classify to test for subnormality. * Minor fix. * Modified to maintain existing API. * Minor change. * Removed 32-bit case since float is always 64-bit.
* Fix for 16 bit platforms (#12760) [backend]PMunch2019-11-281-1/+3
| | | | | This fixes some tiny issues with using Nim on 16-bit platforms. Not entirely sure why the AVR chip I was compiling for with "cpu = avr" was detected as 16-bit, but that's probably another issue..
* added support for openArray's for `gcd` and `lcm` (#12621)Yanis Zafirópulos2019-11-071-1/+25
|
* fix several typos in documentation and comments (#12553)Nindaleth2019-10-301-1/+1
|
* Fix many broken links and prefer relative links within docs (#12463)Miran2019-10-241-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix many broken links Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol. * Prefer relative links for Nim documentation This is more friendly to those browsing the documentation without a network connection. The nim-doc package in Debian allows this, for example. Also, the domain name being used was not consistent. It could have been either nim-lang.org or nim-lang.github.io, and those reading the stable docs could have found themselves suddenly reading the devel docs instead. * koch.rst: remove link to nonexistent section * manual.rst: remove unintended link cast[T](0) is interpreted as a link to id 0 with text T, so escape the opening parentheses to display the intended output. * asyncstreams: replace unintended link with emphasis * Fix word wrapping
| * Fix many broken linksJjp1372019-10-221-1/+1
| | | | | | | | | | | | Note that contrary to what docgen.rst currently says, the ids have to match exactly or else most web browsers will not jump to the intended symbol.
* | [backport] Documentation Math module (#12460)Juan Carlos2019-10-241-0/+2
|/
* [backport] run nimpretty on numbers stuffnarimiran2019-09-301-27/+33
|
* Fix the broken link in math.nim (#11653) [ci skip]Graeme Cross2019-07-041-1/+1
|
* [documentation] fix #4630, document unsupported functions for JSnarimiran2019-06-241-0/+8
|
* Add `cbrt()` bindings for the JS Target (#11528)Benjamin Summerton2019-06-181-0/+3
| | | | | | `Math.cbrt()` exists: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/cbrt The binding was missing for the JavaScript backend.
* Render deprecated pragmas (#8886)LemonBoy2019-06-031-13/+7
| | | | | | | | | * Render deprecated pragmas * fix the expected html * clean up the documentation regarding deprecations * fix typo * fix system.nim * fix random
* stdlib: more consistent formattingAraq2019-05-221-5/+5
|
* fix #10910, optimize squaring and cubing (#11291)Miran2019-05-211-16/+21
|
* code cleanup (#10874)Arne Döring2019-03-281-6/+4
|
* 32 bit fixes (#10608)Arne Döring2019-02-131-1/+1
|
* Genode fixes (#10491)Emery Hemingway2019-01-291-1/+1
| | | Readline pasthru, add linker to config, do not pass -lm to linker.
* documentation: remove author field [ci skip]narimiran2019-01-171-3/+0
|
* better docs: mathnarimiran2019-01-161-97/+420
|
* Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)c-blake2018-12-311-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Fix #9585 hypot in jsB3liever2018-10-311-1/+2
|
* more examples for mod and div, plus corrections [ci skip]narimiran2018-10-281-8/+46
|
* Documentation improved for `math` module (#9266)eqperes2018-10-101-79/+171
|
* fix for #9082 (#9089)Arne Döring2018-10-091-14/+16
|
* math.nim: document what to use instead of 'fmod'Araq2018-09-251-2/+2
|
* fixes 8594 (#8721)cooldome2018-08-221-1/+1
|
* Merge pull request #8628 from hlaaftana/patch-1Dominik Picheta2018-08-141-2/+2
|\ | | | | Small documentation typo in math
| * Small documentation typo in mathhlaaf2018-08-141-2/+2
| |
* | Haiku support for Nim (#8542)alaviss2018-08-141-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * posix_other: Haiku now has spawn.h This is added per https://dev.haiku-os.org/ticket/13446 * posix_other: Add Haiku specific Dirent members * cpuinfo: Add an implementation for Haiku * distros: Add basic Haiku support * encodings: update Haiku support * fenv, math: Haiku now provides libm * times: Add Haiku struct members * ansi_c, osalloc: Add Haiku constants * threads: Add Haiku support * testament: Haiku uses LIBRARY_PATH * nim.cfg: Update Haiku support libnetwork should only be linked if network functions are used * threads: Haiku does not support -pthread switch * tworkingdir: Haiku's env is in /bin * posix_other: add SIGKILLTHR for Haiku * sockets: link with libnetwork on Haiku * coro: correct ucontext.h location http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html * coro: ucontext backend is not available on Haiku Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX * coro: fix setjmp backend The compiler does not allow statements after a noreturn function * nativesockets: Haiku doesn't support AI_V4MAPPED * system: hostOS can contains "haiku" * os: add support for Haiku's packagefs packagefs is read-only, but there are writable holes to the underlying file system as well * os: update constant for Haiku
* fixes #8421, fixes #7968, Nim compiler compiles with MSVC C89 version (#8556)andri lim2018-08-071-24/+58
|
* Merge pull request #7950 from Paalon/math-logAndreas Rumpf2018-06-141-5/+15
|\ | | | | Add log for base b of x
| * Fix a testKoki Fushimi2018-06-141-1/+1
| |
| * Use one same type for two parametersKoki Fushimi2018-06-141-5/+1
| |
| * Use concrete expressionKoki Fushimi2018-06-051-7/+6
| |
| * Bug fixKoki Fushimi2018-06-051-2/+3
| |
| * Change to use log(x, base)Koki Fushimi2018-06-051-3/+3
| |
| * Broaden the argument typesKoki Fushimi2018-06-041-1/+6
| |
| * Generalize and add testKoki Fushimi2018-06-041-7/+14
| |
| * Add log proc for base b of xKoki Fushimi2018-06-041-1/+3
| |
* | Rename tgamma to gamma (#7929)Koki Fushimi2018-06-051-3/+10
| | | | | | | | | | | | | | | | * Rename tgamma to gamma * set the deprecating version 0.19.0 * update changelog and use description in deprecated pragma
* | Add product proc (#7951)Koki Fushimi2018-06-041-1/+13
|/ | | | | | * Add product proc * Update changelog
* Removed spaces in math moduledata-man2018-05-301-1/+1
|
* Use truncation division in mod for floats (#7118)Oscar Nihlgård2018-05-301-11/+40
| | | | | | | | | | * Use truncation division in mod for floats * Add changelog entry * Add floorDiv/floorMod to math.nim * Update changelog
* Add inverse hyperbolic, and cot, sec and csc; and their hyperbolic, inverse, ↵Koki Fushimi2018-05-301-61/+96
| | | | | | | | | | | | | | | | inverse hyperbolic, and change to use defined functions in C or JS for logs and hyperbolics. (#7893) * Add secant, cosecant and cotangent. * Add hyperbolic functions of cotangent, secant and cosecant. * Add inverse hyperbolic functions. * Change to use defined function of C and JS. * Bug fix and refactoring. * Add change to changelog.md
* Faster binary gcd algorithm (#7849)Koki Fushimi2018-05-261-2/+30
| | | | | | | | | | | | * Faster binary gcd algorithm. * Use built in countTrailingZeroBits to calculate gcd. * Add definitions of gcd for integers and other types. * Unified signed case and unsinged case in one proc by using when syntax. * Change to faster one.
* Fixes factorial's bugdata-man2018-05-171-1/+12
|
* Replace factorial function with a compile time one (#7276)notTito2018-05-041-4/+14
| | | | | | | | * Replace factorial function with a compile time one * Fix the indentation * Update
* fixes #6353 (#6951)skilchen2017-12-211-4/+13
|
* add missing math.trunc for js backend (#6950)skilchen2017-12-201-0/+2
|
* Add hint about computing powers between integers (#6419)Federico Ceratto2017-10-161-0/+2
|