long levelDb = 0;
levelDb = 20 * log(30 / 220) + 60
Expected result: 20
Returned result: -2147483648
I assume this is some sort of overflow but I don't quite understand why it would happen, since levelDb is a long. This keeps happening with all values for 30, until the calculation inside the logarithm is >=1, after which it returns the desired results. Could somebody explain to me why this happens and if you're feeling generous, how to fix it?
Many thanks in advance!