Skip to content

Commit

Permalink
Simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
boxleytw committed Feb 24, 2021
1 parent a670a5e commit 71f2f58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/hm/binkley/math/BigRationalBase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ abstract class BigRationalBase<T : BigRationalBase<T>> protected constructor(
/** Returns the absolute value. */
@Suppress("UNCHECKED_CAST")
val absoluteValue: T
get() = if (numerator < BInt.ZERO)
companion.valueOf(numerator.abs(), denominator)
else this as T
get() =
if (0 > numerator.signum()) -this
else this as T

/**
* Returns the reciprocal.
Expand Down

0 comments on commit 71f2f58

Please sign in to comment.