I have been encountering this error for my project, which involves working with Digital Audio Signals.
So I have been getting the amplitude values and recently encou
What value would you have it be? there is no 32768 in short - only 32767.
You could write your own method, of course:
public static short LossyAbs(short value)
{
if(value >= 0) return value;
if(value == short.MinValue) return short.MaxValue;
return -value;
}
but this is lossy in that it sort-of loses a value. Perhaps a better idea is: don't use short.MinValue if you intend to (potentially) negate it. Limiting yourself to -32767 would make this go away.