0

c-usage of 'floor(log10(abs(x))) + 1'

could anyone please explain what 'floor(log10(abs(x))) + 1' mean and its working?

22nd May 2020, 10:36 AM
Kingsly Andrews M
Kingsly Andrews M - avatar
1 Answer
+ 1
It returns the log of the absolute value of an "x" value rounded to the floor. You could rewrite it like this: int absoluteValue = abs(x); int logAbsVal = log10(absoluteValue); int floorRoundedNumber = floor(logAbsVal);
22nd May 2020, 10:55 AM
Alessandro Palazzolo
Alessandro Palazzolo - avatar