title: Alternative to Google calculator API
body: <p>I'm working on a webapp that for the last 2 years has used the unofficial API for Google Calculator like: <a href="http://www.google.com/ig/calculator?hl=en&amp;q=" rel="nofollow">http://www.google.com/ig/calculator?hl=en&amp;q=</a></p>
  
  <p>Now that iGoogle has been closed last week (<a href="https://support.google.com/websearch/answer/2664197" rel="nofollow">https://support.google.com/websearch/answer/2664197</a>) the google calculator api doesn't work either.</p>
  
  <p><strong>What's the best alternative for doing a javascript calculator?</strong> (Where I give it a string and it evaluates the answer.)</p>
  
  <p>Some ideas I've had:</p>
  
  <ul>
  <li>Find another <strong>Google search query</strong> that will return the results (I'm not afraid of doing some html scraping.)</li>
  <li>Find <strong>another api</strong> provided by someone else (something like YQL - I am already using them for currency conversion</li>
  <li>Use a <strong>pure javascript calculator</strong> - Is there a good javascript library or script you can recommend? (Most scripts I've seen are just doing eval(), which I can't use, and most seem to be tutorials to introduce javascript.)</li>
  </ul>
  
  <p>Any suggestions?</p>
  
  <p>Here are some sample queries that the Google Calculator handles. The more I can do, the better:</p>
  
  <ul>
  <li>10+10</li>
  <li>5*9+(sqrt 10)^3</li>
  <li>100 lbs in kg</li>
  <li><a href="http://www.googleguide.com/help/calculator.html" rel="nofollow">http://www.googleguide.com/help/calculator.html</a></li>
  </ul>
  
  <p><br>
  <hr>
  YQL currency conversion info for anyone that comes looking for it later:
  <a href="https://developer.yahoo.com/yql/console/?q=show%20tables&amp;env=store://datatables.org/alltableswithkeys#h=select%20Rate%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22nzDgbp%22%29" rel="nofollow">https://developer.yahoo.com/yql/console/?q=show%20tables&amp;env=store://datatables.org/alltableswithkeys#h=select%20Rate%20from%20yahoo.finance.xchange%20where%20pair%20in%20%28%22nzDgbp%22%29</a></p>
  
  <pre><code>"https://query.yahooapis.com/v1/public/yql?q=select%20Rate%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22" + from + to + "%22)&amp;format=json&amp;env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&amp;callback=callBackFunctionName"
  </code></pre>