I wanted to write a simple post and yet make it interesting for everyone. So here is a neat little trivia and wondering how many want to take a shot at this. Why do I get different results for below queries. What could be the reason?
SELECT 20.0 /–2.0 / 5.0 * 3.0
SELECT 20.0 /(-2.0)/ 5.0 * 3.0
Though the question is simple it is quite intriguing how the engine works behind the scene. So let the ideas flow and any guesses how we can get the same result?
PS: Awesome to see some complete solutions expressed via comments. Thanks to those who took time to write. Understanding the behavior is important and hope we learnt something new here.
This entry was posted on Thursday, April 4th, 2013 at 12:13 and is filed under Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.