abs_cap¶
-
sknano.core.math.
abs_cap
(val, max_abs_val=1)[source] [edit on github][source]¶ Returns the value with its absolute value capped at max_abs_val.
Modified implementation of
pymatgen.util.num_utils.abs_cap
.Particularly useful in passing values to trignometric functions where numerical errors may result in an argument > 1 being passed in.
Parameters: Returns: Return type: val if abs(val) <
max_abs_val
else sign of val * max_abs_val.