Slayer_rockzzz Posted August 7, 2022 Share Posted August 7, 2022 Hii @Enyby sir gg has this error please fix it. x = math.ceil((15/2)+1) Print (x) Output: 8.0 It should be 9.0 Link to comment Share on other sites More sharing options...
MonkeySAN Posted August 7, 2022 Share Posted August 7, 2022 im just messing around with the codes so i cant explain anything. apparently you will get the correct output by writing it like this.. x = math.ceil((15.0/2)+1) Print (x) hope someone with better knowledges will come to give their inputs on this. Link to comment Share on other sites More sharing options...
HEROGAMEOfficial Posted August 7, 2022 Share Posted August 7, 2022 3 hours ago, Slayer_rockzzz said: Hii @Enyby sir gg has this error please fix it. x = math.ceil((15/2)+1) Print (x) Output: 8.0 It should be 9.0 In mathematics, parentheses are done first Link to comment Share on other sites More sharing options...
CmP Posted August 7, 2022 Share Posted August 7, 2022 Quote Math is different from regular Lua. For binary operations, the first operand determines the type of result. For example, 3 / 2.0 will be 1, but 3.0 / 2.0 will be 1.5; 3 + 2.5 will be 5, but 2.5 + 3 will be 5.5. https://gameguardian.net/help/lua_details.html Link to comment Share on other sites More sharing options...
Question
Slayer_rockzzz
Hii @Enyby sir gg has this error please fix it.
x = math.ceil((15/2)+1)
Print (x)
Output:
8.0
It should be 9.0
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.