As others have already said, you received an error due to the initial value, so the correct way is to transfer it to BigDecimal. In addition, if you have a number of such functions and you do not want to write BigDecimal(value) everywhere, you can create an implicit conversion function as follows:
implicit def intToBigDecimal(value: Int) = BigDecimal(value)
and next time Scala will seamlessly convert all your Ints (including constants) to BigDecimal. In fact, most programming languages use noiseless conversions from integers to decimals or even decimals to fractions (e.g. Lisps), so this seems like a very logical move.
source share