title: Scala and Java BigDecimal
body: <p>I want to switch from Java to a scripting language for the Math based modules in my app. This is due to the readability, and functional limitations of mathy Java.</p>
  
  <p>For e.g, in Java I have this:</p>
  
  <pre><code>BigDecimal x = new BigDecimal("1.1");
  BigDecimal y = new BigDecimal("1.1");
  BigDecimal z = x.multiply(y.exp(new BigDecimal("2"));
  </code></pre>
  
  <p>As you can see, without BigDecimal operator overloading, simple formulas get complicated real quick.</p>
  
  <p>With doubles, this looks fine, but I need the precision.</p>
  
  <p>I was hoping in Scala I could do this:</p>
  
  <pre><code>var x = 1.1;
  var y = 0.1;
  print(x + y);
  </code></pre>
  
  <p>And by default I would get decimal-like behaviour, alas Scala doesn't use decimal calculation by default.</p>
  
  <p>Then I do this in Scala:</p>
  
  <pre><code>var x = BigDecimal(1.1);
  var y = BigDecimal(0.1);
  println(x + y);
  </code></pre>
  
  <p>And I still get an imprecise result.</p>
  
  <p>Is there something I am not doing right in Scala?</p>
  
  <p>Maybe I should use Groovy to maximise readability (it uses decimals by default)?</p>