0

why if math.abs parameter is a negative integer then it returns a positive integer

28th Sep 2016, 11:38 AM
Raghavendrachar B
Raghavendrachar B - avatar
3 odpowiedzi
+ 1
-6 abs value is 6 So in practice "absolute value" means to remove any negative sign in front of a number, and to think of all numbers as positive (or zero).
20th Oct 2016, 9:14 AM
Onkar Ashok Gumate
Onkar Ashok Gumate - avatar
0
Returns the absolute value of a float/double/long/int value. If the argument is not negative, the argument is returned. If the argument is negative, the negation of the argument is returned. Special cases: If the argument is positive zero or negative zero, the result is positive zero. If the argument is infinite, the result is positive infinity. If the argument is NaN, the result is NaN. In other words, the result is the same as the value of the expression: Float.intBitsToFloat(0x7fffffff & Float.floatToIntBits(a))
13th Oct 2016, 2:25 PM
Shaik Shahnaz