79258932

Date: 2024-12-06 18:04:30
Score: 0.5
Natty:
Report link

If you like pythonic list comprehension and one-liner:

b =7 
x= [-3.14, 0, 3.14]
x2 = np.array([int((2**b - 1) * xi / np.max(np.abs(x))) if xi > 0 
               else int(-2**b * xi / np.max(np.abs(x))) 
               for xi in x])
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: rehaqds