narimiran
6c994b2498
[backport] run nimpretty on numbers stuff
2019-09-30 13:58:05 +02:00
Araq
5abe880469
last stdlib cleanups
2019-09-21 06:43:37 +02:00
Koki Fushimi
3027ca292c
Support div, mod, floorDiv and floorMod for Rationals ( #7918 )
...
* Support `div`, `mod`, floorDiv and floorMod for Ratinoals.
* Bug fix and add tests.
* Update changelog
2018-06-01 11:19:25 -04:00
Sergey Avseyev
8941f5bd9c
Use safe limit for toRational(float, int) ( #7021 )
...
Current limit `high(int32)` is not safe for 32-bit platforms
and it will overflow (even when running its own test suite).
Similar behaviour would be when try to set limit to `high(int64)`
on 64-bit platforms.
This change selects safe maximum value based on platform
size of int. Safe maximum considered half of int size (for
backward compatiblity).
2018-01-03 12:41:10 +01:00
konqoro
6315c641be
Make toRational proc to loop through integers ( #6633 )
2017-10-30 22:59:03 +01:00
Andreas Rumpf
280dae0ffb
make tests green again
2017-10-30 09:32:23 +01:00
Andreas Rumpf
90c1b94fbe
rationals.toRational now uses an algorithm based on continued fractions; refs #4968
2017-10-30 08:54:43 +01:00
Araq
6c022f4500
made test green for 32bit system
2016-09-30 22:14:29 +02:00
def
834ad57d94
Fix toRational overflow by calculating internally with int64s ( fixes #4194 )
2016-05-22 18:09:55 +02:00
pgkos
ef889a1009
Fixed a typo in proc -(x: T, y: Rational[T])
2016-03-18 16:59:15 +01:00
JamesP
77d4788655
Add toRational(float) conversion from any float to closest
...
approx for specified precision
2015-10-04 15:58:02 +10:00
JamesP
2f4cc4efce
add a few type checks to limit type to SomeInteger
...
(adding a compund type to the Rational type definition
made it too difficult to define new variables
using integer literals)
2015-10-01 15:07:23 +10:00
JamesP
d6b7f0ad9e
add assertion for zero denominator
2015-10-01 15:02:46 +10:00
Adam Strzelecki
43bddf62dd
lib: Trim .nim files trailing whitespace
...
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:03:56 +02:00
pdw
d18e18060e
lib/pure/p-t - Dropped 'T' from types
2015-06-04 13:18:36 +02:00
Andreas Rumpf
dfc3f9dcd7
Merge pull request #2486 from endragor/rational-hash
...
Add hash proc for Rational
2015-04-08 09:58:06 +02:00
Ruslan Mustakov
35f5ac2811
Added procvar pragma to rationals.cmp
2015-04-08 01:21:58 +06:00
Ruslan Mustakov
46e6fd4fa9
Added hash proc for Rational
2015-04-08 00:52:20 +06:00
def
bba2f7b0f1
Fix toRational
2015-04-07 00:36:16 +02:00
def
4dbb582311
Add for rationals
2015-02-27 20:46:05 +01:00
def
75959a0fb3
Add for easier intialization of rationals
2015-02-27 20:38:53 +01:00
def
77f506bd70
Make Rational an object
2015-02-24 19:54:27 +01:00
def
f710a31344
Make rationals generic
2015-02-20 12:21:09 +01:00
def
f6c83c32f3
Fix typo
2015-02-19 13:57:31 +01:00
def
c377e6883c
Change author of rationals module
2015-02-19 10:54:38 +01:00
def
2d004dd677
Update toInt doc
2015-02-16 20:44:24 +01:00
def
444beab5dd
Fix division and add tests
2015-02-16 20:44:24 +01:00
def
a85b6fd3fe
Change rationals.toInt behaviour
2015-02-16 20:44:24 +01:00
def
aa4d119e8c
Move rational.nim to rationals.nim
2015-02-16 20:44:24 +01:00