12-Amethyst
January 10, 2023
Solved
Round up in relation/ program
- January 10, 2023
- 2 replies
- 3188 views
To do what you are describing you need to divide the number you are manipulating by 1000, get the ceil of that, then multiply the result by 1000.
For your example, this would read:
result = 1000 * ceil ( ( 5900 / 6 ) / 1000 )
If you are trying to actually "round" the value, i.e. any value between 500 and 999 yields 1000, numbers less than 500 are zero, you need to do something more like:
result = 1000 * floor ( ( 5900 / 6 ) / 1000 + 0.5 )
in the "ceil ( value, decimal )" command the "decimal" parameter is telling the function which decimal digit to "cut off" the result at. ceil ( 5.234, 2 ) means start at the second decimal place, so the result of ceil ( 5.234, 2 ) = 5.240. A negative "decimal" value is not valid.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.