Update from dev #16

Merged
altavir merged 18 commits from dev into master 2018-10-12 11:18:55 +03:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 3576ddaf31 - Show all commits

View File

@ -101,6 +101,9 @@ interface Field<T> : Ring<T> {
operator fun T.div(b: T): T = divide(this, b) operator fun T.div(b: T): T = divide(this, b)
operator fun Number.div(b: T) = this * divide(one, b) operator fun Number.div(b: T) = this * divide(one, b)
operator fun T.plus(b: Number) = this.plus(b * one)
operator fun Number.plus(b: T) = b + this
} }
/** /**

View File

@ -10,7 +10,7 @@ class FieldExpressionContextTest {
val context = FieldExpressionContext(DoubleField) val context = FieldExpressionContext(DoubleField)
val expression = with(context) { val expression = with(context) {
val x = variable("x", 2.0) val x = variable("x", 2.0)
x * x + 2 * x + 1.0 * one x * x + 2 * x + 1.0
} }
assertEquals(expression("x" to 1.0), 4.0) assertEquals(expression("x" to 1.0), 4.0)
assertEquals(expression(), 9.0) assertEquals(expression(), 9.0)