Skip to content
Advertisement

Finding absolute value of a number without using Math.abs()

Is there any way to find the absolute value of a number without using the Math.abs() method in java.

Advertisement

Answer

If you look inside Math.abs you can probably find the best answer:

Eg, for floats:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement