Fabian Keller
a6e0494a6f
fixes #5966
2017-06-20 12:11:09 +02:00
John Novak
17b55f9b29
Add sgn() function to the math module ( #5971 )
2017-06-15 21:00:18 +02:00
AdrianV
8a487d3223
bcc misses the same functions like vcc
2016-12-28 17:34:14 +01:00
andri lim
be6f792cbd
Fixed #4532 , VS2010 now can compile Nim
...
Fixed #4532 , VS2010 now can compile Nim
Fixed #4532 , VS2010 now can compile Nim
2016-08-08 20:24:33 +07:00
Mathijs Saey
756beb5b5b
Removed trailing whitespace in math module
2016-08-05 17:58:31 +02:00
Mathijs Saey
2a84206e89
Fixed #4574
2016-08-05 17:57:51 +02:00
A. S. Budden
f9bb209c32
Corrected comment in maths library.
2016-06-20 09:15:56 +01:00
matkuki
39fd0e801d
Update math.nim
2016-06-18 12:26:21 +02:00
matkuki
f9a659f7ab
Windows MSVC < 2012 'round' function update
...
Microsoft Visual C++ compilers prior to 2012 do not implement the 'round', 'roundl' or 'roundf' functions.
This change is fixes this. Tested it with MSVC 2010.
2016-06-17 21:52:41 +02:00
A. S. Budden
695b25100c
Changed math.nim tests to use newly defined ==~ operator
2016-05-31 15:53:18 +01:00
A. S. Budden
1b9c66d720
Correction to round0 following review.
2016-05-31 15:16:50 +01:00
A. S. Budden
46a2993917
Implemented function to split floating point numbers at the decimal place (equivalent to C's modf function). Fixes #4195 .
2016-05-31 13:26:41 +01:00
A. S. Budden
0cc7c9a13c
Modification to implementation of round() such that it returns a float and accepts a places argument ( fixes #3473 ).
...
This also involved moving some functions around to get the hierarchy correct and the documentation for frexp was modified such that it was clear that it can return a float in either the range [-1, -0.5] or [0.5, 1].
2016-05-31 13:17:40 +01:00
Andreas Rumpf
95bb19a579
moved random procs from math to its own module (breaking change)
2016-05-30 16:24:52 +02:00
Andreas Rumpf
0ef7d802ca
Merge branch 'patch-8' of https://github.com/apense/Nim into apense-patch-8
2016-05-30 02:04:25 +02:00
gmpreussner
05418890ca
Setting TAU to 2 * PI
2016-03-17 23:03:20 -04:00
gmpreussner
fc1dedae73
Added TAU constant.
2016-03-17 21:57:50 -04:00
JamesP
0cf4e2603f
Removal of stats procs for openarray (use the RunningStat methodology)
2015-11-11 08:56:12 +10:00
JamesP
03590a1c42
Removal of RunningStats ready for new stats.nim pure lib file
2015-11-07 15:10:51 +10:00
Aman Gupta
2fbdf9320c
fix float comparision failure in math tests
...
FAIL: math.nim
Test "lib/pure/math.nim" in category "lib"
Failure: reExitcodesDiffer
Expected:
exitcode: 0
Gotten:
exitcode: 1
Output:
Traceback (most recent call last)
math.nim(478) math
system.nim(3343) failedAssertImpl
system.nim(3335) raiseAssert
system.nim(2531) sysFatal
Error: unhandled exception: tgamma(5.0'f64) == 24.0'f64 [AssertionError]
2015-10-02 18:34:04 -07:00
Araq
a4a5003b7d
fixes #3312
2015-09-18 02:24:13 +02:00
Araq
c56a1f8266
math.nim works with NimScript
2015-08-21 21:34:15 +02:00
Reimer Behrends
22789a8275
Fix exponentiation operation to avoid overflow.
...
The exponentation implementation unnecessarily multiplied the
result with itself at the end if the exponent was an even number.
This led to overflow if result*result > high(int).
2015-08-14 14:32:30 +02:00
apense
c3e6fb0e38
Corrected erroneous description
...
Hypotenuse is really just the euclidean norm
2015-06-29 23:07:06 -04:00
apense
9e8c8f473b
Added some documentation and examples
...
I think I remember reading that the documentation is generated from the normal targets (not javascript), so that's where I put the docs
2015-06-29 22:48:38 -04:00
Araq
d46407caf3
disable vcc specific code which doesn't work
2015-06-29 02:48:29 +02:00
Andreas Rumpf
43c64c7545
Merge pull request #2977 from apense/patch-5
...
Conversion between radians and degrees.Fixes #2881
2015-06-25 13:14:59 +02:00
apense
6d1532439b
Fixed silly format error
...
Needed other bracket
2015-06-24 16:17:11 -04:00
apense
6165e8498c
Converted tabs
...
Not sure what was going on before
2015-06-24 16:12:19 -04:00
apense
35690dc37f
Rewrote procs for float32/float64
...
When a proc is `importc`-ed, made explicit. Otherwise, used `[T: float32|float64]`
2015-06-24 16:09:18 -04:00
apense
bfcbe64778
Specific float32/float64 procs
...
I still used generics, but made them choose from `float32` or `float64`. I can rewrite in separate, explicit procs if is wanted
2015-06-24 14:49:15 -04:00
apense
67b3c4b31f
Added documentation for mod
...
Along with a brief example for sign demonstration
2015-06-24 03:33:48 -04:00
apense
edbd191f74
Conversion between radians and degrees.Fixes #2881
...
provides a new constant for conversion (not public, but that can be changed if it's wanted). the functions are pretty simple, honestly. top-level comment so documentation for each function could remain. Fixes #2881
2015-06-24 03:22:04 -04:00
apense
c0c4a7d6a6
Added some C99 funcs
...
Error function (and complementary) and gamma function (and truncated)
2015-06-18 16:07:00 -04:00
apense
4072a39c69
Updated RNG for Visual C
...
Can't test it, but it should work just fine. Can be extended to MinGW w/ GCC and other compilers sometime in the future
2015-06-14 21:16:39 -04:00
apense
7fba7d934b
Discarded randomize for windows
...
It actually doesn't use it because `rand_s` doesn't.
2015-06-11 18:56:59 -04:00
apense
294989daf5
Updated random functions
...
For Windows, `rand_s` has been available since Windows XP (see https://msdn.microsoft.com/en-us/library/sxtz2fa8.aspx ). It gives a better quality random number in a larger range (the max is actually `0xffffffff`).
2015-06-11 18:47:28 -04:00
Boris Vassilev
9723e30647
Document explicitly the behaviour of math.gcd with float arguments
2015-05-13 13:00:20 +03:00
Varriount
ace11f08aa
Merge pull request #2537 from jsanjuas/devel
...
Generalize mean to other types
2015-05-07 12:59:01 -04:00
Koala Zen
cf68d926d8
fixes isPowerOfTwo returning true on the smallest integer
2015-05-06 12:37:15 -07:00
Oleh Prypin
32109a7867
Don't run non-test code when defined(testing)
2015-04-21 14:37:29 +03:00
Josep Sanjuas
f72bb57fff
Convert to float before sum
2015-04-18 13:40:20 +02:00
Josep Sanjuas
44246b6709
Document toFloat is necessary
2015-04-18 13:38:15 +02:00
Josep Sanjuas
e76f54e059
Generalize variance to other types
2015-04-18 13:28:48 +02:00
Josep Sanjuas
d0ff06b8c1
Generalize mean to other types
2015-04-12 19:40:30 +02:00
Simon Hafner
4ea5f3e6e6
no side effects on math procs, fixes #2458
2015-04-04 16:44:59 -05:00
def
43bc72f1fe
Make gcd iterative instead of recursive
2015-02-16 20:44:24 +01:00
def
cc757d538c
Remove shuffle again
2015-02-16 20:44:24 +01:00
def
8c92a78853
Export new math procs
2015-02-16 20:44:24 +01:00
def
d57d1f00cd
Add shuffle to math module
2015-02-16 20:44:24 +01:00