import numpy as np import warnings np.seterr(all='warn') with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") result = np.float16(np.longdouble('70000.0')) print(f"Result: {result}") print(f"Warnings: {[str(warning.message) for warning in w]}")