Nonsense Divide
Hello there!
Can some explain why static item_count; item_count = 0; client_print(id, print_chat, "Item Count: %i | Page: %i", item_count, (item_count - 1) / 7); prints "Item Count: 0 | Page: -1" instead of prints "Item Count: 0 | Page: 0" So why -1 divided by 7 is -1 instead of 0? Shouldn't be it zero? Please don't think me stupid. :D |
Re: Nonsense Divide
The result of -1 divided by 7 is -0.14285714285. In your example, the value is probably being rounded.
If what you are trying to do is calculate the total number of pages, this is the correct formula: Code:
|
Re: Nonsense Divide
Quote:
More importantly, I don't think item count should ever be zero. If it's zero, then there is no concept of pages so it doesn't make sense to print that value. |
Re: Nonsense Divide
From "Pawn The Language":
Quote:
|
Re: Nonsense Divide
Quote:
|
All times are GMT -4. The time now is 19:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.