math: improve how get_absolute_min/max() work