Fix += and -= for Rational

This commit is contained in:
def
2015-01-03 05:09:56 +01:00
parent d57d1f00cd
commit b1f4eda723

View File

@@ -68,7 +68,7 @@ proc `+=` *(x: var Rational, y: Rational) =
proc `+=` *(x: var Rational, y: int) =
## Add int `y` to rational `x`.
x.num += y
x.num += y * x.den
proc `-` *(x: Rational): Rational =
## Unary minus for rational numbers.
@@ -101,7 +101,7 @@ proc `-=` *(x: var Rational, y: Rational) =
proc `-=` *(x: var Rational, y: int) =
## Subtract int `y` from rational `x`.
x.num -= y
x.num -= y * x.den
proc `*` *(x, y: Rational): Rational =
## Multiply two rational numbers.