(adsbygoogle = window.adsbygoogle || []).push({}); 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

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# 3 Simple questions - Math for ABS(), Round()

**Physics Forums | Science Articles, Homework Help, Discussion**