Commit graph

121 commits

Author SHA1 Message Date
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
Koki Fushimi
09283bb939 Faster binary gcd algorithm (#7849)
* 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.
2018-05-26 08:31:45 +03:00
data-man
173c92d374 Fixes factorial's bug 2018-05-17 19:54:41 +03:00
notTito
8f7bd6cf5c Replace factorial function with a compile time one (#7276)
* Replace factorial function with a compile time one

* Fix the indentation

* Update
2018-05-04 07:37:57 +02:00
skilchen
a89b81eb96 fixes #6353 (#6951) 2017-12-21 16:32:26 +01:00
skilchen
47d00eb397 add missing math.trunc for js backend (#6950) 2017-12-20 22:26:22 +01:00
Federico Ceratto
590512873c Add hint about computing powers between integers (#6419) 2017-10-16 14:59:37 +02:00
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