JacobSeated Posted July 25, 2020 Share Posted July 25, 2020 Hey, Strange issue here with basic math. It works on my calculator, but not in PHP.1000*1.1^1 should result in 1100, but instead gives me 1101. I.e: echo 1000*1.1^1; // 1101 What am I missing? What is with the tiny inaccuracy? Quote Link to comment https://forums.phpfreaks.com/topic/311215-exponential-growth-not-working/ Share on other sites More sharing options...
JacobSeated Posted July 25, 2020 Author Share Posted July 25, 2020 Ahh, it seems PHP is using "**" instead of "^" for some reason.https://www.php.net/manual/en/language.operators.arithmetic.php Somehow that slipped past me. Thanks anyway though 🙂 Quote Link to comment https://forums.phpfreaks.com/topic/311215-exponential-growth-not-working/#findComment-1580017 Share on other sites More sharing options...
requinix Posted July 25, 2020 Share Posted July 25, 2020 Most common programming languages use ^ for exclusive or. In PHP's case, ** is actually a relatively recent addition. 1 Quote Link to comment https://forums.phpfreaks.com/topic/311215-exponential-growth-not-working/#findComment-1580029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.