diff options
author | Paul Phillips <paulp@improving.org> | 2009-06-05 21:08:02 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-06-05 21:08:02 +0000 |
commit | c260301efef7c83d6fb8094954ae0ae555dc5b0f (patch) | |
tree | 1884e94efefa23ad91c5e597cf69f33cde79b6ec /src/library/scala/BigDecimal.scala | |
parent | 9f6fe27b218039362ce72d90e548e06eed323dc7 (diff) | |
download | scala-c260301efef7c83d6fb8094954ae0ae555dc5b0f.tar.gz scala-c260301efef7c83d6fb8094954ae0ae555dc5b0f.tar.bz2 scala-c260301efef7c83d6fb8094954ae0ae555dc5b0f.zip |
Fixed a couple bugs in GenericRange and added t...
Fixed a couple bugs in GenericRange and added the fun and exciting
BigDecimal Range. It throws an exception if it ever can't do anything
exactly, so it shouldn't be too dangerous to rely upon.
Diffstat (limited to 'src/library/scala/BigDecimal.scala')
-rw-r--r-- | src/library/scala/BigDecimal.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/library/scala/BigDecimal.scala b/src/library/scala/BigDecimal.scala index a5faf979e1..9bae9feb01 100644 --- a/src/library/scala/BigDecimal.scala +++ b/src/library/scala/BigDecimal.scala @@ -266,6 +266,12 @@ class BigDecimal(val bigDecimal: BigDec) extends java.lang.Number { */ def doubleValue = this.bigDecimal.doubleValue + /** See <code>Iterator.range</code>. */ + def until(end: BigDecimal, step: BigDecimal) = Range.BigDecimal(this, end, step) + + /** like <code>until</code>, but includes the last index */ + def to(end: BigDecimal, step: BigDecimal) = Range.BigDecimal.inclusive(this, end, step) + /** Converts this <code>BigDecimal</code> to a BigInteger. */ def toBigInt(): BigInt = new BigInt(this.bigDecimal.toBigInteger()) |