- #1
128GB
- 2
- 0
3 Simple questions -- Math for ABS(), Round()
To find the absolute value of a number you can use this
((x ^ 2) ^ 0.5)
To round a number up you can use this
-(((-x - 1) - ((-x - 1) % 1)) + 1)
To round a number down
(x - (x % 1))
Are there better ways to do this? The middle one is the one I'm thinking should somehow be shorter
This is for a program I'm making so it needs to be in normal text format please
To find the absolute value of a number you can use this
((x ^ 2) ^ 0.5)
To round a number up you can use this
-(((-x - 1) - ((-x - 1) % 1)) + 1)
To round a number down
(x - (x % 1))
Are there better ways to do this? The middle one is the one I'm thinking should somehow be shorter
This is for a program I'm making so it needs to be in normal text format please