diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-16 05:52:17 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-16 05:52:17 +0000 |
commit | e56c8c561f6adc1f88ce7d03e16c494dddeab5d3 (patch) | |
tree | e3d4fbebb2bac7877ce9645c6beb0540b0066c9f /src/library/scala/math/BigDecimal.scala | |
parent | 42a2169161189a2391f645b60afc6fe816c732de (diff) | |
download | scala-e56c8c561f6adc1f88ce7d03e16c494dddeab5d3.tar.gz scala-e56c8c561f6adc1f88ce7d03e16c494dddeab5d3.tar.bz2 scala-e56c8c561f6adc1f88ce7d03e16c494dddeab5d3.zip |
Basic scaladoc for some scala.math classes.
Contributed by desterkin.
Diffstat (limited to 'src/library/scala/math/BigDecimal.scala')
-rw-r--r-- | src/library/scala/math/BigDecimal.scala | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/library/scala/math/BigDecimal.scala b/src/library/scala/math/BigDecimal.scala index a4056c173c..4137f43ae9 100644 --- a/src/library/scala/math/BigDecimal.scala +++ b/src/library/scala/math/BigDecimal.scala @@ -366,11 +366,32 @@ extends ScalaNumber with ScalaNumericConversions with Serializable { */ def doubleValue = this.bigDecimal.doubleValue - /** This BigDecimal as an exact value. - */ + /** Converts this `BigDecimal` to a [[scala.Byte]], checking for lost information. + * If this `BigDecimal` has a nonzero fractional part, or is out of the possible + * range for a [[scala.Byte]] result, then a `java.lang.ArithmeticException` is + * thrown. + */ def toByteExact = bigDecimal.byteValueExact + + /** Converts this `BigDecimal` to a [[scala.Short]], checking for lost information. + * If this `BigDecimal` has a nonzero fractional part, or is out of the possible + * range for a [[scala.Short]] result, then a `java.lang.ArithmeticException` is + * thrown. + */ def toShortExact = bigDecimal.shortValueExact + + /** Converts this `BigDecimal` to a [[scala.Int]], checking for lost information. + * If this `BigDecimal` has a nonzero fractional part, or is out of the possible + * range for an [[scala.Int]] result, then a `java.lang.ArithmeticException` is + * thrown. + */ def toIntExact = bigDecimal.intValueExact + + /** Converts this `BigDecimal` to a [[scala.Long]], checking for lost information. + * If this `BigDecimal` has a nonzero fractional part, or is out of the possible + * range for a [[scala.Long]] result, then a `java.lang.ArithmeticException` is + * thrown. + */ def toLongExact = bigDecimal.longValueExact /** Creates a partially constructed NumericRange[BigDecimal] in range |