Your complier has an issue!

Hello, so I recently developed an online calculator for Barrowmans equations on COP. It involves squaring a couple numbers in the equations. Between the time I developed it and I used it, I received very strange answers. After about 2 hours of debugging the simple code I decided to test weather the engine was squaring number right, because that seemed to be the only thing that was changing my answers. I have added an example of the output below. I believe t is somehow adding the numbers. I think this is a massive probelm that should be fixed soon, but I have no clue how this happened. Im surprised everything still works.

In Javascript, the ^ in 5^2 is not a power operator, rather it’s a bitwise XOR. The correct power operator is **. If you try 5**2, you’ll get 25 (as you expect it to be) in most modern browsers.

2 Likes