Skip to content

Commit 031d147

Browse files
committed
Workaround scala/scala3#4984
This is more efficient anyway. Java BigDecimal::divideAndRemainder only returns an array with two elements.
1 parent 00c4011 commit 031d147

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/library/scala/math/BigDecimal.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,10 @@ extends ScalaNumber with ScalaNumericConversions with Serializable with Ordered[
498498
/** Division and Remainder - returns tuple containing the result of
499499
* divideToIntegralValue and the remainder. The computation is exact: no rounding is applied.
500500
*/
501-
def /% (that: BigDecimal): (BigDecimal, BigDecimal) =
502-
this.bigDecimal.divideAndRemainder(that.bigDecimal, mc) match {
503-
case Array(q, r) => (new BigDecimal(q, mc), new BigDecimal(r, mc))
504-
}
501+
def /% (that: BigDecimal): (BigDecimal, BigDecimal) = {
502+
val qr = this.bigDecimal.divideAndRemainder(that.bigDecimal, mc)
503+
(new BigDecimal(qr(0), mc), new BigDecimal(qr(1), mc))
504+
}
505505

506506
/** Divide to Integral value.
507507
*/

0 commit comments

Comments
 (0)