Commit Graph

79 Commits

Author SHA1 Message Date
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
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
def
1ad1b93f0a Add ^, gcd and lcm to math 2015-02-16 20:43:20 +01:00
Andreas Rumpf
2f62cc91a4 Merge pull request #2111 from lyro/fix-2110
fix conditions for int size in 'math.nextPowerOfTwo' #2110
2015-02-12 15:18:55 +01:00
Araq
10335fd726 fixed minor bugs; cleaned up tests 2015-02-12 14:56:56 +01:00
Frank Fischer
fcfaf2a844 fix conditions for int size in 'math.nextPowerOfTwo' #2110 2015-02-12 12:47:58 +01:00
Guillaume Gelin
3119fe087d Happy new year! 2015-01-06 15:26:33 +01:00
def
f52fd8785f Fix some deprecation warnings caused by renames 2014-11-13 21:34:46 +01:00
Araq
adad2d5f4a Merge branch 'devel' into bigbreak
Conflicts:
	lib/impure/db_postgres.nim
	lib/pure/json.nim
	lib/pure/math.nim
	lib/system/atomics.nim
2014-11-03 11:42:36 +01:00
Varriount
6935171b85 Fix math.nim on windows 2014-11-03 02:17:39 -05:00
Andreas Rumpf
a0ecfd19be Merge pull request #1448 from def-/posix-math
Add -lm for fesetround and fegetround
2014-11-03 01:58:50 +01:00
Araq
d05df2173b Nimrod renamed to Nim 2014-08-28 09:50:51 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Araq
2f43fdb837 renamefest 2014-08-23 01:43:49 +02:00
def
a019825d8f Move fenv to its own module 2014-08-22 13:12:49 +02:00
Dominik Picheta
add0a0e9bc Merge pull request #1351 from def-/random-openarrays
Add random() for openarrays
2014-08-13 21:12:12 +01:00
Araq
dd806cafa0 distinguish between 'defined' and 'declared' 2014-08-11 20:38:28 +02:00
def
c0422ae8af Move floating point rounding and exceptions handling to math
(it's C99 as well, not just POSIX)
2014-08-06 02:31:19 +02:00
def
fc6a799fc6 Add random() for openarrays 2014-07-12 03:04:43 +02:00
Grzegorz Adam Hankiewicz
2353b5633e Hyperlinks back JavaScript target. 2014-06-21 23:48:41 +02:00
Charlie
d32b4272c3 added a note about random(max: float): float's resolution on windows 2014-05-18 15:16:35 -04:00
Charlie
8a183dac78 added random(max: float): float support to windows 2014-05-18 15:13:37 -04:00
Araq
e6d17e6273 made large parts of the stdlib gcsafe 2014-04-20 20:01:24 +02:00
Dominik Picheta
96c97d4103 JS: Fixes math and streams module and implements json. 2014-04-11 21:41:45 +01:00