Commit Graph

157 Commits

Author SHA1 Message Date
Hugo Granström
32ac1b7c9d fix #15033 (#15034) 2020-07-22 10:30:46 +02:00
Miran
e7f280bd26 Remove deprecated stuff from stdlib (#14699)
* update to the latest Jester

* remove deprecated procs from some stdlib modules

* 'criterion' is not maintained anymore and relies on obsolete stuff
2020-06-17 15:25:02 +02:00
hlaaftana
fbc97e712a move since from inclrtl to std/private/since (#14188)
* move since from inclrtl to std/private/since
* move since import in system below for HCR
2020-05-02 23:51:59 +02:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Miran
352232e62d style fix: change 'JS' to 'js' to make it consistent (#13168) 2020-01-16 14:14:03 +01:00
Araq
a1beeb313f fixes #13032 2020-01-04 19:33:49 +01:00
KeepCoolWithCoolidge
ae7b53ec51 Fixes classify function to detect subnormal floating points (#12836)
* 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.
2019-12-08 20:17:11 +01:00
PMunch
b662842bd0 Fix for 16 bit platforms (#12760) [backend]
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..
2019-11-28 17:11:56 +01:00
Yanis Zafirópulos
76085e8a45 added support for openArray's for gcd and lcm (#12621) 2019-11-07 18:06:48 +01:00
Nindaleth
34dbc5699e fix several typos in documentation and comments (#12553) 2019-10-30 09:08:45 +01:00
Miran
b03de8a4d9 Fix many broken links and prefer relative links within docs (#12463)
* 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
2019-10-24 14:07:43 +02:00
Juan Carlos
8f8916413f [backport] Documentation Math module (#12460) 2019-10-24 14:07:21 +02:00
Jjp137
93461aee34 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.
2019-10-22 17:59:12 -07:00
narimiran
6c994b2498 [backport] run nimpretty on numbers stuff 2019-09-30 13:58:05 +02:00
Graeme Cross
dad3c40f55 Fix the broken link in math.nim (#11653) [ci skip] 2019-07-04 13:24:19 +02:00
narimiran
436f570651 [documentation] fix #4630, document unsupported functions for JS 2019-06-24 12:52:54 +02:00
Benjamin Summerton
a009cbdc2f Add cbrt() bindings for the JS Target (#11528)
`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.
2019-06-18 02:26:47 -04:00
LemonBoy
7d217a71d3 Render deprecated pragmas (#8886)
* Render deprecated pragmas
* fix the expected html
* clean up the documentation regarding deprecations
* fix typo
* fix system.nim
* fix random
2019-06-03 10:15:20 +02:00
Araq
11fca968b2 stdlib: more consistent formatting 2019-05-22 07:41:16 +02:00
Miran
9bd4347abb fix #10910, optimize squaring and cubing (#11291) 2019-05-21 15:57:33 +02:00
Arne Döring
e904b3f952 code cleanup (#10874) 2019-03-28 12:32:02 +01:00
Arne Döring
28394153ab 32 bit fixes (#10608) 2019-02-13 23:30:14 +01:00
Emery Hemingway
15422a3e5a Genode fixes (#10491)
Readline pasthru, add linker to config, do not pass -lm to linker.
2019-01-29 15:08:43 +01:00
narimiran
52a54f5f04 documentation: remove author field [ci skip] 2019-01-17 07:15:40 +01:00
narimiran
387f481e86 better docs: math 2019-01-16 09:46:01 +01:00
c-blake
7ac1fc81fd Resolve things raised in https://github.com/nim-lang/Nim/issues/10081 ? (#10084)
* 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
2018-12-31 14:52:51 +01:00
B3liever
8a1d52fa48 Fix #9585 hypot in js 2018-10-31 14:09:39 +02:00
narimiran
80b78b50d0 more examples for mod and div, plus corrections [ci skip] 2018-10-28 22:37:58 +00:00
eqperes
6620b5dc8d Documentation improved for math module (#9266) 2018-10-10 14:25:39 +02:00
Arne Döring
5076fda2e2 fix for #9082 (#9089) 2018-10-09 19:37:53 +02:00
Araq
8029a649ba math.nim: document what to use instead of 'fmod' 2018-09-25 00:10:21 +02:00
cooldome
d0f4a929e0 fixes 8594 (#8721) 2018-08-22 12:16:18 +02:00
Dominik Picheta
bc957ace2e Merge pull request #8628 from hlaaftana/patch-1
Small documentation typo in math
2018-08-14 11:21:26 +01:00
alaviss
7ef268274f Haiku support for Nim (#8542)
* 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
2018-08-14 09:35:07 +02:00
hlaaf
ed4a267399 Small documentation typo in math 2018-08-14 01:33:56 +03:00
andri lim
c3d5ec8ead fixes #8421, fixes #7968, Nim compiler compiles with MSVC C89 version (#8556) 2018-08-07 09:07:18 +02:00
Andreas Rumpf
2d186f18ec Merge pull request #7950 from Paalon/math-log
Add log for base b of x
2018-06-14 14:02:57 +02:00
Koki Fushimi
5332da2e7c Fix a test 2018-06-14 13:37:37 +09:00
Koki Fushimi
5fc5e37194 Use one same type for two parameters 2018-06-14 13:17:17 +09:00
Koki Fushimi
959b6354c1 Rename tgamma to gamma (#7929)
* Rename tgamma to gamma

* set the deprecating version  0.19.0

* update changelog and use description in deprecated pragma
2018-06-05 11:15:04 -04:00
Koki Fushimi
a3e5242d31 Add product proc (#7951)
* Add product proc

* Update changelog
2018-06-04 18:24:34 -04:00
Koki Fushimi
090ffa3869 Use concrete expression 2018-06-05 02:32:39 +09:00
Koki Fushimi
41601e9307 Bug fix 2018-06-05 00:27:04 +09:00
Koki Fushimi
05f81482f4 Change to use log(x, base) 2018-06-05 00:22:40 +09:00
Koki Fushimi
abf8ee049a Broaden the argument types 2018-06-04 16:48:11 +09:00
Koki Fushimi
f849db1c5c Generalize and add test 2018-06-04 15:09:17 +09:00
Koki Fushimi
d7913419d7 Add log proc for base b of x 2018-06-04 15:03:08 +09:00
data-man
1bbd83de3f Removed spaces in math module 2018-05-30 20:55:53 +03:00
Oscar Nihlgård
65070a6936 Use truncation division in mod for floats (#7118)
* Use truncation division in mod for floats

* Add changelog entry

* Add floorDiv/floorMod to math.nim

* Update changelog
2018-05-30 19:14:21 +03:00
Koki Fushimi
2107c81d6d Add inverse hyperbolic, and cot, sec and csc; and their hyperbolic, inverse, 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
2018-05-30 15:29:34 +01:00