summaryrefslogtreecommitdiff
path: root/src/library/scala/BigDecimal.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-06-05 21:08:02 +0000
committerPaul Phillips <paulp@improving.org>2009-06-05 21:08:02 +0000
commitc260301efef7c83d6fb8094954ae0ae555dc5b0f (patch)
tree1884e94efefa23ad91c5e597cf69f33cde79b6ec /src/library/scala/BigDecimal.scala
parent9f6fe27b218039362ce72d90e548e06eed323dc7 (diff)
downloadscala-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.scala6
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())